svn commit: r328272 - head/sys/net

Ryan Stone rstone at FreeBSD.org
Tue Jan 23 07:15:17 UTC 2018


Author: rstone
Date: Tue Jan 23 03:15:44 2018
New Revision: 328272
URL: https://svnweb.freebsd.org/changeset/base/328272

Log:
  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

Modified:
  head/sys/net/route.c

Modified: head/sys/net/route.c
==============================================================================
--- head/sys/net/route.c	Tue Jan 23 03:15:39 2018	(r328271)
+++ head/sys/net/route.c	Tue Jan 23 03:15:44 2018	(r328272)
@@ -1733,6 +1733,8 @@ rtrequest1_fib_change(struct rib_head *rnh, struct rt_
 	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);
 
@@ -1822,6 +1824,13 @@ rtrequest1_fib_change(struct rib_head *rnh, struct rt_
 			if_updatemtu_cb(rt->rt_nodes, &ifmtu);
 		}
 	}
+
+	/*
+	 * 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;


More information about the svn-src-head mailing list