]> git.baikalelectronics.ru Git - kernel.git/commit
net: skip virtio_net_hdr_set_proto if protocol already set
authorWillem de Bruijn <willemb@google.com>
Mon, 20 Dec 2021 14:50:27 +0000 (09:50 -0500)
committerJakub Kicinski <kuba@kernel.org>
Tue, 21 Dec 2021 02:47:37 +0000 (18:47 -0800)
commitca08704cb6ca54a45c38b0790c55a3259a4a7152
tree38c8f57fc5231b57a47b0b0b5f98327f244d89d9
parent52898d777fa9850fc9fd702f173a9f9b57f2a0f7
net: skip virtio_net_hdr_set_proto if protocol already set

virtio_net_hdr_set_proto infers skb->protocol from the virtio_net_hdr
gso_type, to avoid packets getting dropped for lack of a proto type.

Its protocol choice is a guess, especially in the case of UFO, where
the single VIRTIO_NET_HDR_GSO_UDP label covers both UFOv4 and UFOv6.

Skip this best effort if the field is already initialized. Whether
explicitly from userspace, or implicitly based on an earlier call to
dev_parse_header_protocol (which is more robust, but was introduced
after this patch).

Fixes: 4b69b91dea15 ("net/packet: fix packet drop as of virtio gso")
Signed-off-by: Willem de Bruijn <willemb@google.com>
Link: https://lore.kernel.org/r/20211220145027.2784293-1-willemdebruijn.kernel@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/linux/virtio_net.h