svn commit: r232459 - user/andre/tcp_workqueue/sys/netinet

Andre Oppermann andre at FreeBSD.org
Sat Mar 3 13:02:29 UTC 2012


Author: andre
Date: Sat Mar  3 13:02:28 2012
New Revision: 232459
URL: http://svn.freebsd.org/changeset/base/232459

Log:
  Remove the need for routes to have the MTU explicitly set or inherited
  from their interface.  Unless explicitly set the route MTU is zero and
  the current interface MTU is being used.
  
  This allows interface MTU to be increased even after it got an IP address
  assigned.
  
  If a route has an MTU set that is lower than the interface MTU it will
  be used instead.  If a route has an MTU set that is higher than the
  interface MTU it will be adjusted and the interface MTU will be used
  as before.

Modified:
  user/andre/tcp_workqueue/sys/netinet/in_rmx.c
  user/andre/tcp_workqueue/sys/netinet/ip_fastfwd.c
  user/andre/tcp_workqueue/sys/netinet/ip_input.c
  user/andre/tcp_workqueue/sys/netinet/ip_output.c
  user/andre/tcp_workqueue/sys/netinet/tcp_subr.c

Modified: user/andre/tcp_workqueue/sys/netinet/in_rmx.c
==============================================================================
--- user/andre/tcp_workqueue/sys/netinet/in_rmx.c	Sat Mar  3 12:41:19 2012	(r232458)
+++ user/andre/tcp_workqueue/sys/netinet/in_rmx.c	Sat Mar  3 13:02:28 2012	(r232459)
@@ -104,7 +104,8 @@ in_addroute(void *v_arg, void *n_arg, st
 	if (IN_MULTICAST(ntohl(sin->sin_addr.s_addr)))
 		rt->rt_flags |= RTF_MULTICAST;
 
-	if (!rt->rt_rmx.rmx_mtu && rt->rt_ifp)
+	if (rt->rt_rmx.rmx_mtu > 0 && rt->rt_ifp != NULL &&
+	    rt->rt_rmx.rmx_mtu > rt->rt_ifp->if_mtu)
 		rt->rt_rmx.rmx_mtu = rt->rt_ifp->if_mtu;
 
 	return (rn_addroute(v_arg, n_arg, head, treenodes));

Modified: user/andre/tcp_workqueue/sys/netinet/ip_fastfwd.c
==============================================================================
--- user/andre/tcp_workqueue/sys/netinet/ip_fastfwd.c	Sat Mar  3 12:41:19 2012	(r232458)
+++ user/andre/tcp_workqueue/sys/netinet/ip_fastfwd.c	Sat Mar  3 13:02:28 2012	(r232459)
@@ -534,7 +534,7 @@ passout:
 	/*
 	 * Check if packet fits MTU or if hardware will fragment for us
 	 */
-	if (ro.ro_rt->rt_rmx.rmx_mtu)
+	if (ro.ro_rt->rt_rmx.rmx_mtu > 0)
 		mtu = min(ro.ro_rt->rt_rmx.rmx_mtu, ifp->if_mtu);
 	else
 		mtu = ifp->if_mtu;

Modified: user/andre/tcp_workqueue/sys/netinet/ip_input.c
==============================================================================
--- user/andre/tcp_workqueue/sys/netinet/ip_input.c	Sat Mar  3 12:41:19 2012	(r232458)
+++ user/andre/tcp_workqueue/sys/netinet/ip_input.c	Sat Mar  3 13:02:28 2012	(r232459)
@@ -1493,8 +1493,12 @@ ip_forward(struct mbuf *m, int srcrt)
 
 	error = ip_output(m, NULL, &ro, IP_FORWARDING, NULL, NULL);
 
-	if (error == EMSGSIZE && ro.ro_rt)
-		mtu = ro.ro_rt->rt_rmx.rmx_mtu;
+	if (error == EMSGSIZE && ro.ro_rt) {
+		if (ro.ro_rt->rt_rmx.rmx_mtu > 0)
+			mtu = ro.ro_rt->rt_rmx.rmx_mtu;
+		else
+			mtu = ro.ro_rt->rt_ifp->if_mtu;
+	}
 	if (ro.ro_rt)
 		RTFREE(ro.ro_rt);
 

Modified: user/andre/tcp_workqueue/sys/netinet/ip_output.c
==============================================================================
--- user/andre/tcp_workqueue/sys/netinet/ip_output.c	Sat Mar  3 12:41:19 2012	(r232458)
+++ user/andre/tcp_workqueue/sys/netinet/ip_output.c	Sat Mar  3 13:02:28 2012	(r232459)
@@ -309,7 +309,8 @@ again:
 	 * Calculate MTU.  If we have a route that is up, use that,
 	 * otherwise use the interface's MTU.
 	 */
-	if (rte != NULL && (rte->rt_flags & (RTF_UP|RTF_HOST))) {
+	if (rte != NULL && (rte->rt_flags & (RTF_UP|RTF_HOST)) &&
+	    rte->rt_rmx.rmx_mtu > 0) {
 		/*
 		 * This case can happen if the user changed the MTU
 		 * of an interface after enabling IP on it.  Because

Modified: user/andre/tcp_workqueue/sys/netinet/tcp_subr.c
==============================================================================
--- user/andre/tcp_workqueue/sys/netinet/tcp_subr.c	Sat Mar  3 12:41:19 2012	(r232458)
+++ user/andre/tcp_workqueue/sys/netinet/tcp_subr.c	Sat Mar  3 13:02:28 2012	(r232459)
@@ -1731,10 +1731,10 @@ tcp_maxmtu(struct in_conninfo *inc, int 
 	}
 	if (sro.ro_rt != NULL) {
 		ifp = sro.ro_rt->rt_ifp;
-		if (sro.ro_rt->rt_rmx.rmx_mtu == 0)
-			maxmtu = ifp->if_mtu;
-		else
+		if (sro.ro_rt->rt_rmx.rmx_mtu > 0)
 			maxmtu = min(sro.ro_rt->rt_rmx.rmx_mtu, ifp->if_mtu);
+		else
+			maxmtu = ifp->if_mtu;
 
 		/* Report additional interface capabilities. */
 		if (flags != NULL) {


More information about the svn-src-user mailing list