summaryrefslogtreecommitdiffstats
path: root/net/ipv4/route.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/route.c')
-rw-r--r--net/ipv4/route.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index cee640281e02..6cb7cff22db9 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1981,7 +1981,7 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
1981 u32 itag = 0; 1981 u32 itag = 0;
1982 struct rtable *rth; 1982 struct rtable *rth;
1983 struct flowi4 fl4; 1983 struct flowi4 fl4;
1984 bool do_cache; 1984 bool do_cache = true;
1985 1985
1986 /* IP on this device is disabled. */ 1986 /* IP on this device is disabled. */
1987 1987
@@ -2058,6 +2058,9 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
2058 if (res->type == RTN_BROADCAST) { 2058 if (res->type == RTN_BROADCAST) {
2059 if (IN_DEV_BFORWARD(in_dev)) 2059 if (IN_DEV_BFORWARD(in_dev))
2060 goto make_route; 2060 goto make_route;
2061 /* not do cache if bc_forwarding is enabled */
2062 if (IPV4_DEVCONF_ALL(net, BC_FORWARDING))
2063 do_cache = false;
2061 goto brd_input; 2064 goto brd_input;
2062 } 2065 }
2063 2066
@@ -2095,18 +2098,15 @@ brd_input:
2095 RT_CACHE_STAT_INC(in_brd); 2098 RT_CACHE_STAT_INC(in_brd);
2096 2099
2097local_input: 2100local_input:
2098 do_cache = false; 2101 do_cache &= res->fi && !itag;
2099 if (res->fi) { 2102 if (do_cache) {
2100 if (!itag) { 2103 struct fib_nh_common *nhc = FIB_RES_NHC(*res);
2101 struct fib_nh_common *nhc = FIB_RES_NHC(*res);
2102 2104
2103 rth = rcu_dereference(nhc->nhc_rth_input); 2105 rth = rcu_dereference(nhc->nhc_rth_input);
2104 if (rt_cache_valid(rth)) { 2106 if (rt_cache_valid(rth)) {
2105 skb_dst_set_noref(skb, &rth->dst); 2107 skb_dst_set_noref(skb, &rth->dst);
2106 err = 0; 2108 err = 0;
2107 goto out; 2109 goto out;
2108 }
2109 do_cache = true;
2110 } 2110 }
2111 } 2111 }
2112 2112