diff mbox

[1/2] macvlan : fix checksums error when we are in bridge mode

Message ID 1300118888-2311-1-git-send-email-daniel.lezcano@free.fr
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Daniel Lezcano March 14, 2011, 4:08 p.m. UTC
When the lower device has offloading capabilities, the packets checksums
are not computed. That leads to have any macvlan port in bridge mode to
not work because the packets are dropped due to a bad checksum.

If the macvlan is in bridge mode, the packet is forwarded to another
macvlan port and reach the network stack where it looks for a checksum
but this one was not computed due to the offloading of the lower device.
In this case, we have to set the packet with CHECKSUM_UNNECESSARY
when it is forwarded to a bridged port and restore the previous value of
ip_summed when the packet goes to the lowerdev.

Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr>
Cc: Patrick McHardy <kaber@trash.net>
Cc: Andrian Nord <nightnord@gmail.com>
---
 drivers/net/macvlan.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Comments

Eric Dumazet March 14, 2011, 5:04 p.m. UTC | #1
Le lundi 14 mars 2011 à 17:08 +0100, Daniel Lezcano a écrit :
> When the lower device has offloading capabilities, the packets checksums
> are not computed. That leads to have any macvlan port in bridge mode to
> not work because the packets are dropped due to a bad checksum.
> 
> If the macvlan is in bridge mode, the packet is forwarded to another
> macvlan port and reach the network stack where it looks for a checksum
> but this one was not computed due to the offloading of the lower device.
> In this case, we have to set the packet with CHECKSUM_UNNECESSARY
> when it is forwarded to a bridged port and restore the previous value of
> ip_summed when the packet goes to the lowerdev.
> 
> Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr>
> Cc: Patrick McHardy <kaber@trash.net>
> Cc: Andrian Nord <nightnord@gmail.com>

Acked-by: Eric Dumazet <eric.dumazet@gmail.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
diff mbox

Patch

diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 6ed577b..497991b 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -219,9 +219,11 @@  static int macvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev)
 	const struct macvlan_dev *vlan = netdev_priv(dev);
 	const struct macvlan_port *port = vlan->port;
 	const struct macvlan_dev *dest;
+	__u8 ip_summed = skb->ip_summed;
 
 	if (vlan->mode == MACVLAN_MODE_BRIDGE) {
 		const struct ethhdr *eth = (void *)skb->data;
+		skb->ip_summed = CHECKSUM_UNNECESSARY;
 
 		/* send to other bridge ports directly */
 		if (is_multicast_ether_addr(eth->h_dest)) {
@@ -241,6 +243,7 @@  static int macvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev)
 	}
 
 xmit_world:
+	skb->ip_summed = ip_summed;
 	skb_set_dev(skb, vlan->lowerdev);
 	return dev_queue_xmit(skb);
 }