summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorJianfeng Tan <jianfeng.tan@linux.alibaba.com>2018-09-29 15:41:27 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-10-18 09:18:09 +0200
commit53afeb0b222beabc386f3ae02c47a005e59ce0a7 (patch)
treecde10e1c131e33e826a6ddce04cd98f2f78a6955 /net
parent75ebeb2e6a60156279c2e9aaeff93290543aefca (diff)
net/packet: fix packet drop as of virtio gso
[ Upstream commit 9d2f67e43b73e8af7438be219b66a5de0cfa8bd9 ] When we use raw socket as the vhost backend, a packet from virito with gso offloading information, cannot be sent out in later validaton at xmit path, as we did not set correct skb->protocol which is further used for looking up the gso function. To fix this, we set this field according to virito hdr information. Fixes: e858fae2b0b8f4 ("virtio_net: use common code for virtio_net_hdr and skb GSO conversion") Signed-off-by: Jianfeng Tan <jianfeng.tan@linux.alibaba.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r--net/packet/af_packet.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index e6445d8f3f57..3237e9978c1a 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -2712,10 +2712,12 @@ tpacket_error:
}
}
- if (po->has_vnet_hdr && virtio_net_hdr_to_skb(skb, vnet_hdr,
- vio_le())) {
- tp_len = -EINVAL;
- goto tpacket_error;
+ if (po->has_vnet_hdr) {
+ if (virtio_net_hdr_to_skb(skb, vnet_hdr, vio_le())) {
+ tp_len = -EINVAL;
+ goto tpacket_error;
+ }
+ virtio_net_hdr_set_proto(skb, vnet_hdr);
}
skb->destructor = tpacket_destruct_skb;
@@ -2911,6 +2913,7 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len)
if (err)
goto out_free;
len += sizeof(vnet_hdr);
+ virtio_net_hdr_set_proto(skb, &vnet_hdr);
}
skb_probe_transport_header(skb, reserve);