From: Jesse Gross Date: Mon, 10 Nov 2014 19:45:13 +0000 (-0800) Subject: udptunnel: Add SKB_GSO_UDP_TUNNEL during gro_complete. X-Git-Tag: v3.17.4~133 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0fee76308e4193dc38412e7ff7e7b7e369b91fb5;p=thirdparty%2Fkernel%2Fstable.git udptunnel: Add SKB_GSO_UDP_TUNNEL during gro_complete. [ Upstream commit cfdf1e1ba5bf55e095cf4bcaa9585c4759f239e8 ] When doing GRO processing for UDP tunnels, we never add SKB_GSO_UDP_TUNNEL to gso_type - only the type of the inner protocol is added (such as SKB_GSO_TCPV4). The result is that if the packet is later resegmented we will do GSO but not treat it as a tunnel. This results in UDP fragmentation of the outer header instead of (i.e.) TCP segmentation of the inner header as was originally on the wire. Signed-off-by: Jesse Gross Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index b4831274b0ab8..6ab737bc0773b 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -620,6 +620,8 @@ static int vxlan_gro_complete(struct sk_buff *skb, int nhoff) int vxlan_len = sizeof(struct vxlanhdr) + sizeof(struct ethhdr); int err = -ENOSYS; + udp_tunnel_gro_complete(skb, nhoff); + eh = (struct ethhdr *)(skb->data + nhoff + sizeof(struct vxlanhdr)); type = eh->h_proto; diff --git a/include/net/udp_tunnel.h b/include/net/udp_tunnel.h index ffd69cbded352..55003b84e2e12 100644 --- a/include/net/udp_tunnel.h +++ b/include/net/udp_tunnel.h @@ -26,6 +26,15 @@ struct udp_port_cfg { use_udp6_rx_checksums:1; }; +static inline void udp_tunnel_gro_complete(struct sk_buff *skb, int nhoff) +{ + struct udphdr *uh; + + uh = (struct udphdr *)(skb->data + nhoff - sizeof(struct udphdr)); + skb_shinfo(skb)->gso_type |= uh->check ? + SKB_GSO_UDP_TUNNEL_CSUM : SKB_GSO_UDP_TUNNEL; +} + int udp_sock_create(struct net *net, struct udp_port_cfg *cfg, struct socket **sockp);