Message ID | 20210228235224.30445-2-henry.shen@alliedtelesis.co.nz (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | net:ipv4: Packet is not forwarded when ingress interface is not configured with bc_forwarding | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Guessed tree name to be net-next |
netdev/subject_prefix | warning | Target tree name not specified in the subject |
netdev/cc_maintainers | success | CCed 5 of 5 maintainers |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | fail | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 5 this patch: 5 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 38 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 5 this patch: 5 |
netdev/header_inline | success | Link |
netdev/stable | success | Stable not CCed |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 02d81d79deeb..d082b199b8c6 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -2101,6 +2101,8 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, struct rtable *rth; struct flowi4 fl4; bool do_cache = true; + struct in_device *out_dev; + int rcv_local = 0; /* IP on this device is disabled. */ @@ -2176,12 +2178,20 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, } if (res->type == RTN_BROADCAST) { + out_dev = in_dev_get(FIB_RES_DEV(*res)); + if (!out_dev) + goto out; + + if (in_dev == out_dev) + rcv_local = 1; + in_dev_put(out_dev); if (IN_DEV_BFORWARD(in_dev)) goto make_route; /* not do cache if bc_forwarding is enabled */ if (IPV4_DEVCONF_ALL(net, BC_FORWARDING)) do_cache = false; - goto brd_input; + if (rcv_local) + goto brd_input; } if (res->type == RTN_LOCAL) { @@ -2197,7 +2207,8 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, goto no_route; } if (res->type != RTN_UNICAST) - goto martian_destination; + if (res->type != RTN_BROADCAST) + goto martian_destination; make_route: err = ip_mkroute_input(skb, res, in_dev, daddr, saddr, tos, flkeys);