diff mbox

[net-next-2.6] net: Handle vlan packets in skb_gso_segment()

Message ID 1264454194.28852.130.camel@w-sridhar.beaverton.ibm.com
State Rejected, archived
Delegated to: David Miller
Headers show

Commit Message

Sridhar Samudrala Jan. 25, 2010, 9:16 p.m. UTC
Handle VLAN packets in skb_gso_segment(). Currently, when large
VLAN packets are sent via virtio_net on guest and tun on host, 
skb_gso_segment() fails with EPROTONOSUPPORT.

Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>




--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

David Miller Feb. 2, 2010, 3:45 p.m. UTC | #1
From: Sridhar Samudrala <sri@us.ibm.com>
Date: Mon, 25 Jan 2010 13:16:34 -0800

> Handle VLAN packets in skb_gso_segment(). Currently, when large
> VLAN packets are sent via virtio_net on guest and tun on host, 
> skb_gso_segment() fails with EPROTONOSUPPORT.
> 
> Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>
 ...
> @@ -1672,6 +1672,12 @@ struct sk_buff *skb_gso_segment(struct sk_buff *skb, int features)
>  
> 	skb_reset_mac_header(skb);
> 	skb->mac_len = skb->network_header - skb->mac_header;
> +	if (ntohs(type) == ETH_P_8021Q) {
> +		skb->protocol = vlan_eth_hdr(skb)->h_vlan_encapsulated_proto;
> +		type = skb->protocol;
> +		skb->mac_len += VLAN_HLEN;
> +		skb_set_network_header(skb, skb->mac_len);
> +	}
> 	__skb_pull(skb, skb->mac_len);
>  

You can't do this.

Now, VLAN packets that are GSO handled will show up differently to
sniffers than those which do not get GSO handling.

You really can't pop the MAC header and modify the skb->protocol
here.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/core/dev.c b/net/core/dev.c
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1672,6 +1672,12 @@  struct sk_buff *skb_gso_segment(struct sk_buff *skb, int features)
 
	skb_reset_mac_header(skb);
	skb->mac_len = skb->network_header - skb->mac_header;
+	if (ntohs(type) == ETH_P_8021Q) {
+		skb->protocol = vlan_eth_hdr(skb)->h_vlan_encapsulated_proto;
+		type = skb->protocol;
+		skb->mac_len += VLAN_HLEN;
+		skb_set_network_header(skb, skb->mac_len);
+	}
	__skb_pull(skb, skb->mac_len);
 
	if (unlikely(skb->ip_summed != CHECKSUM_PARTIAL)) {