Increment the route table gen count after a modify

Increment the route table generation count after modifying a
route.  This signals back to TCP connections that they need to
update their L2 caches as the gateway for their route may have
changed.  This is a heavier hammer than is needed, strictly
speaking, but route changes will be unlikely enough that the
performance effects of invalidating all connection route caches
should be negligible.

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D13990
Reviewed by:	karels
This commit is contained in:
rstone 2018-01-23 03:15:44 +00:00
parent c0c5474ab0
commit 9c794ac899

View File

@ -1733,6 +1733,8 @@ rtrequest1_fib_change(struct rib_head *rnh, struct rt_addrinfo *info,
int family, mtu;
struct if_mtuinfo ifmtu;
RIB_WLOCK_ASSERT(rnh);
rt = (struct rtentry *)rnh->rnh_lookup(info->rti_info[RTAX_DST],
info->rti_info[RTAX_NETMASK], &rnh->head);
@ -1823,6 +1825,13 @@ rtrequest1_fib_change(struct rib_head *rnh, struct rt_addrinfo *info,
}
}
/*
* This route change may have modified the route's gateway. In that
* case, any inpcbs that have cached this route need to invalidate their
* llentry cache.
*/
rnh->rnh_gen++;
if (ret_nrt) {
*ret_nrt = rt;
RT_ADDREF(rt);