Skip to content

Commit 13d82bf

Browse files
klassertdavem330
authored andcommitted
ipv4: Fix flushing of cached routing informations
Currently we can not flush cached pmtu/redirect informations via the ipv4_sysctl_rtcache_flush sysctl. We need to check the rt_genid of the old route and reset the nh exeption if the old route is expired when we bind a new route to a nh exeption. Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 18c22a0 commit 13d82bf

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

net/ipv4/route.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,8 +1163,12 @@ static bool rt_bind_exception(struct rtable *rt, struct fib_nh_exception *fnhe,
11631163
spin_lock_bh(&fnhe_lock);
11641164

11651165
if (daddr == fnhe->fnhe_daddr) {
1166-
struct rtable *orig;
1167-
1166+
struct rtable *orig = rcu_dereference(fnhe->fnhe_rth);
1167+
if (orig && rt_is_expired(orig)) {
1168+
fnhe->fnhe_gw = 0;
1169+
fnhe->fnhe_pmtu = 0;
1170+
fnhe->fnhe_expires = 0;
1171+
}
11681172
if (fnhe->fnhe_pmtu) {
11691173
unsigned long expires = fnhe->fnhe_expires;
11701174
unsigned long diff = expires - jiffies;
@@ -1181,7 +1185,6 @@ static bool rt_bind_exception(struct rtable *rt, struct fib_nh_exception *fnhe,
11811185
} else if (!rt->rt_gateway)
11821186
rt->rt_gateway = daddr;
11831187

1184-
orig = rcu_dereference(fnhe->fnhe_rth);
11851188
rcu_assign_pointer(fnhe->fnhe_rth, rt);
11861189
if (orig)
11871190
rt_free(orig);

0 commit comments

Comments
 (0)