[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEP_g=-hHQRSg95rJEgMkFkvzgXfEPvmgU38-Es4SpEHmXGd7w@mail.gmail.com>
Date: Fri, 22 Feb 2013 17:04:20 -0800
From: Jesse Gross <jesse@...ira.com>
To: Cong Wang <amwang@...hat.com>
Cc: netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>
Subject: Re: [PATCH 1/2] openvswitch: fix the calculation of checksum for vlan header
On Fri, Feb 22, 2013 at 1:32 AM, Cong Wang <amwang@...hat.com> wrote:
> From: Cong Wang <amwang@...hat.com>
>
> In vlan_insert_tag(), we insert a 4-byte VLAN header _after_
> mac header:
>
> memmove(skb->data, skb->data + VLAN_HLEN, 2 * ETH_ALEN);
> ...
> veth->h_vlan_proto = htons(ETH_P_8021Q);
> ...
> veth->h_vlan_TCI = htons(vlan_tci);
>
> so after it, we should recompute the checksum to include these 4 bytes.
> skb->data still points to the mac header, therefore VLAN header is at
> (2 * ETH_ALEN = 12) bytes after it, not (ETH_HLEN = 14) bytes.
>
> This can also be observed via tcpdump:
>
> 0x0000: ffff ffff ffff 5254 005d 6f6e 8100 000a
> 0x0010: 0806 0001 0800 0604 0001 5254 005d 6f6e
> 0x0020: c0a8 026e 0000 0000 0000 c0a8 0282
>
> Similar for __pop_vlan_tci(), the vlan header we remove is the one
> overwritten in:
>
> memmove(skb->data + VLAN_HLEN, skb->data, 2 * ETH_ALEN);
>
> Therefore the VLAN_HLEN = 4 bytes after 2 * ETH_ALEN is the part
> we want to sub from checksum.
>
> Cc: David S. Miller <davem@...emloft.net>
> Cc: Jesse Gross <jesse@...ira.com>
> Signed-off-by: Cong Wang <amwang@...hat.com>
Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists