* [Patch] openvswitch: fix the calculation of checksum for vlan header
@ 2013-02-22 5:25 Cong Wang
2013-02-22 9:29 ` Cong Wang
0 siblings, 1 reply; 2+ messages in thread
From: Cong Wang @ 2013-02-22 5:25 UTC (permalink / raw)
To: netdev; +Cc: David S. Miller, Jesse Gross, Cong Wang
From: Cong Wang <amwang@redhat.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
Cc: David S. Miller <davem@davemloft.net>
Cc: Jesse Gross <jesse@nicira.com>
Signed-off-by: Cong Wang <amwang@redhat.com>
---
diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
index ac2defe..a0e202c 100644
--- a/net/openvswitch/actions.c
+++ b/net/openvswitch/actions.c
@@ -115,7 +115,7 @@ static int push_vlan(struct sk_buff *skb, const struct ovs_action_push_vlan *vla
if (skb->ip_summed == CHECKSUM_COMPLETE)
skb->csum = csum_add(skb->csum, csum_partial(skb->data
- + ETH_HLEN, VLAN_HLEN, 0));
+ + (2 * ETH_ALEN), VLAN_HLEN, 0));
}
__vlan_hwaccel_put_tag(skb, ntohs(vlan->vlan_tci) & ~VLAN_TAG_PRESENT);
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [Patch] openvswitch: fix the calculation of checksum for vlan header
2013-02-22 5:25 [Patch] openvswitch: fix the calculation of checksum for vlan header Cong Wang
@ 2013-02-22 9:29 ` Cong Wang
0 siblings, 0 replies; 2+ messages in thread
From: Cong Wang @ 2013-02-22 9:29 UTC (permalink / raw)
To: netdev; +Cc: David S. Miller, Jesse Gross
On Fri, 2013-02-22 at 13:25 +0800, Cong Wang wrote:
> @@ -115,7 +115,7 @@ static int push_vlan(struct sk_buff *skb, const struct ovs_action_push_vlan *vla
>
> if (skb->ip_summed == CHECKSUM_COMPLETE)
> skb->csum = csum_add(skb->csum, csum_partial(skb->data
> - + ETH_HLEN, VLAN_HLEN, 0));
> + + (2 * ETH_ALEN), VLAN_HLEN, 0));
>
> }
> __vlan_hwaccel_put_tag(skb, ntohs(vlan->vlan_tci) & ~VLAN_TAG_PRESENT);
__pop_vlan_tci() has same problem...
I will resend this patch.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-02-22 10:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-22 5:25 [Patch] openvswitch: fix the calculation of checksum for vlan header Cong Wang
2013-02-22 9:29 ` Cong Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).