From 93f33aca235863c198489ffb08994a6ca86e897e Mon Sep 17 00:00:00 2001 From: bz Date: Fri, 1 Jun 2012 11:42:50 +0000 Subject: 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. MFC after: 3 days X-MFC with: r235981 --- sys/netinet/tcp_lro.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sys/netinet/tcp_lro.c b/sys/netinet/tcp_lro.c index 3a5878d..3718e4d 100644 --- a/sys/netinet/tcp_lro.c +++ b/sys/netinet/tcp_lro.c @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -370,10 +371,14 @@ tcp_lro_rx(struct lro_ctrl *lc, struct mbuf *m, uint32_t csum) 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) @@ -381,13 +386,18 @@ tcp_lro_rx(struct lro_ctrl *lc, struct mbuf *m, uint32_t csum) 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) @@ -395,6 +405,7 @@ tcp_lro_rx(struct lro_ctrl *lc, struct mbuf *m, uint32_t csum) 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: -- cgit v1.1