Skip to content

Commit cbdb042

Browse files
Vlad Yasevichdavem330
authored andcommitted
mactap: Fix checksum errors for non-gso packets in bridge mode
The following is a problematic configuration: VM1: virtio-net device connected to macvtap0@eth0 VM2: e1000 device connect to macvtap1@eth0 The problem is is that virtio-net supports checksum offloading and thus sends the packets to the host with CHECKSUM_PARTIAL set. On the other hand, e1000 does not support any acceleration. For small TCP packets (and this includes the 3-way handshake), e1000 ends up receiving packets that only have a partial checksum set. This causes TCP to fail checksum validation and to drop packets. As a result tcp connections can not be established. Commit 3e4f8b7 macvtap: Perform GSO on forwarding path. fixes this issue for large packets wthat will end up undergoing GSO. This commit adds a check for the non-GSO case and attempts to compute the checksum for partially checksummed packets in the non-GSO case. CC: Daniel Lezcano <daniel.lezcano@free.fr> CC: Patrick McHardy <kaber@trash.net> CC: Andrian Nord <nightnord@gmail.com> CC: Eric Dumazet <eric.dumazet@gmail.com> CC: Michael S. Tsirkin <mst@redhat.com> CC: Jason Wang <jasowang@redhat.com> Signed-off-by: Vlad Yasevich <vyasevic@redhat.com> Acked-by: Jason Wang <jasowang@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent fc9f350 commit cbdb042

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎drivers/net/macvtap.c‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,15 @@ static rx_handler_result_t macvtap_handle_frame(struct sk_buff **pskb)
322322
segs = nskb;
323323
}
324324
} else {
325+
/* If we receive a partial checksum and the tap side
326+
* doesn't support checksum offload, compute the checksum.
327+
* Note: it doesn't matter which checksum feature to
328+
* check, we either support them all or none.
329+
*/
330+
if (skb->ip_summed == CHECKSUM_PARTIAL &&
331+
!(features & NETIF_F_ALL_CSUM) &&
332+
skb_checksum_help(skb))
333+
goto drop;
325334
skb_queue_tail(&q->sk.sk_receive_queue, skb);
326335
}
327336

0 commit comments

Comments
 (0)