Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Jul 2012 17:30:33 -0400
From:      gnn@freebsd.org
To:        net@freebsd.org
Subject:   Interface MTU question...
Message-ID:  <86liiqrnnq.wl%gnn@neville-neil.com>

next in thread | raw e-mail | index | archive | help
Howdy,

Does anyone know the reason for this particular check in
ip_output.c?

	if (rte != NULL && (rte->rt_flags & (RTF_UP|RTF_HOST))) {
		/*
		 * This case can happen if the user changed the MTU
		 * of an interface after enabling IP on it.  Because
		 * most netifs don't keep track of routes pointing to
		 * them, there is no way for one to update all its
		 * routes when the MTU is changed.
		 */
		if (rte->rt_rmx.rmx_mtu > ifp->if_mtu)
 			rte->rt_rmx.rmx_mtu = ifp->if_mtu;
 		mtu = rte->rt_rmx.rmx_mtu;
 	} else {
		mtu = ifp->if_mtu;
	}

To my mind the > ought to be != so that any change, up or down, of the
interface MTU is eventually reflected in the route.  Also, this code
does not check if it is both a HOST route and UP, but only if it is
one other the other, so don't be fooled by that, this check happens
for any route we have if it's up.

My proposed change is this:

Index: ip_output.c
===================================================================
--- ip_output.c	(revision 225561)
+++ ip_output.c	(working copy)
@@ -320,7 +320,7 @@
 		 * them, there is no way for one to update all its
 		 * routes when the MTU is changed.
 		 */
-		if (rte->rt_rmx.rmx_mtu > ifp->if_mtu)
+		if (rte->rt_rmx.rmx_mtu != ifp->if_mtu)
 			rte->rt_rmx.rmx_mtu = ifp->if_mtu;
 		mtu = rte->rt_rmx.rmx_mtu;
 	} else {

Please let me know what y'all think.

Best,
George



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86liiqrnnq.wl%gnn>