]> git.baikalelectronics.ru Git - kernel.git/commit
net: in virtio_net_hdr only add VLAN_HLEN to csum_start if payload holds vlan
authorWillem de Bruijn <willemb@google.com>
Wed, 6 Jun 2018 15:23:01 +0000 (11:23 -0400)
committerDavid S. Miller <davem@davemloft.net>
Thu, 7 Jun 2018 20:15:38 +0000 (16:15 -0400)
commitc80d2cfc17dd1e34976923adc8212728e91f2722
tree73ec5aec120ca37add89d275b0adbd593164ac55
parent9c0e88e3fe4187d646f443fcac5df31ee31ced85
net: in virtio_net_hdr only add VLAN_HLEN to csum_start if payload holds vlan

Tun, tap, virtio, packet and uml vector all use struct virtio_net_hdr
to communicate packet metadata to userspace.

For skbuffs with vlan, the first two return the packet as it may have
existed on the wire, inserting the VLAN tag in the user buffer.  Then
virtio_net_hdr.csum_start needs to be adjusted by VLAN_HLEN bytes.

Commit 15dcd45c8aa3 ("macvtap: restore vlan header on user read")
added this feature to macvtap. Commit 60d2b2687f17 ("macvtap: Fix
csum_start when VLAN tags are present") then fixed up csum_start.

Virtio, packet and uml do not insert the vlan header in the user
buffer.

When introducing virtio_net_hdr_from_skb to deduplicate filling in
the virtio_net_hdr, the variant from macvtap which adds VLAN_HLEN was
applied uniformly, breaking csum offset for packets with vlan on
virtio and packet.

Make insertion of VLAN_HLEN optional. Convert the callers to pass it
when needed.

Fixes: a7a35bbe1312cc ("virtio_net: use common code for virtio_net_hdr and skb GSO conversion")
Fixes: af454b170728 ("packet: use common code for virtio_net_hdr and skb GSO conversion")
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
arch/um/drivers/vector_transports.c
drivers/net/tap.c
drivers/net/tun.c
drivers/net/virtio_net.c
include/linux/virtio_net.h
net/packet/af_packet.c