svn commit: r238239 - stable/9/sys/netinet

Bjoern A. Zeeb bz at FreeBSD.org
Sun Jul 8 12:23:28 UTC 2012


Author: bz
Date: Sun Jul  8 12:23:27 2012
New Revision: 238239
URL: http://svn.freebsd.org/changeset/base/238239

Log:
  MFC r235981,236394
  
   In case forwarding is turned on for a given address family, refuse to
   queue the packet for LRO and tell the driver to directly pass it on.
   This avoids re-assembly and later re-fragmentation problems when
   forwarding.
  
   It's not the best solution but the simplest and most effective for
   the moment.
  
   Make TCP LRO work properly with VIMAGE kernels rather than just panicing.
   There's no VIMAGE context set there yet as this is before if_ethersubr.c.
  
  Approved by:	re

Modified:
  stable/9/sys/netinet/tcp_lro.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/netinet/tcp_lro.c
==============================================================================
--- stable/9/sys/netinet/tcp_lro.c	Sun Jul  8 12:17:56 2012	(r238238)
+++ stable/9/sys/netinet/tcp_lro.c	Sun Jul  8 12:23:27 2012	(r238239)
@@ -46,14 +46,18 @@ __FBSDID("$FreeBSD$");
 #include <net/if.h>
 #include <net/if_var.h>
 #include <net/ethernet.h>
+#include <net/vnet.h>
 
 #include <netinet/in_systm.h>
 #include <netinet/in.h>
 #include <netinet/ip6.h>
 #include <netinet/ip.h>
+#include <netinet/ip_var.h>
 #include <netinet/tcp.h>
 #include <netinet/tcp_lro.h>
 
+#include <netinet6/ip6_var.h>
+
 #include <machine/in_cksum.h>
 
 #ifndef LRO_ENTRIES
@@ -369,6 +373,14 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m
 	switch (eh_type) {
 #ifdef INET6
 	case ETHERTYPE_IPV6:
+	{
+		CURVNET_SET(lc->ifp->if_vnet);
+		if (V_ip6_forwarding != 0) {
+			/* XXX-BZ stats but changing lro_ctrl is a problem. */
+			CURVNET_RESTORE();
+			return (TCP_LRO_CANNOT);
+		}
+		CURVNET_RESTORE();
 		l3hdr = ip6 = (struct ip6_hdr *)(eh + 1);
 		error = tcp_lro_rx_ipv6(lc, m, ip6, &th);
 		if (error != 0)
@@ -376,9 +388,18 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m
 		tcp_data_len = ntohs(ip6->ip6_plen);
 		ip_len = sizeof(*ip6) + tcp_data_len;
 		break;
+	}
 #endif
 #ifdef INET
 	case ETHERTYPE_IP:
+	{
+		CURVNET_SET(lc->ifp->if_vnet);
+		if (V_ipforwarding != 0) {
+			/* XXX-BZ stats but changing lro_ctrl is a problem. */
+			CURVNET_RESTORE();
+			return (TCP_LRO_CANNOT);
+		}
+		CURVNET_RESTORE();
 		l3hdr = ip4 = (struct ip *)(eh + 1);
 		error = tcp_lro_rx_ipv4(lc, m, ip4, &th);
 		if (error != 0)
@@ -386,6 +407,7 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m
 		ip_len = ntohs(ip4->ip_len);
 		tcp_data_len = ip_len - sizeof(*ip4);
 		break;
+	}
 #endif
 	/* XXX-BZ what happens in case of VLAN(s)? */
 	default:


More information about the svn-src-stable-9 mailing list