packet: always probe for transport header
authorDaniel Borkmann <daniel@iogearbox.net>
Wed, 11 Nov 2015 22:25:41 +0000 (23:25 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sun, 15 Nov 2015 23:00:35 +0000 (18:00 -0500)
We concluded that the skb_probe_transport_header() should better be
called unconditionally. Avoiding the call into the flow dissector has
also not really much to do with the direct xmit mode.

While it seems that only virtio_net code makes use of GSO from non
RX/TX ring packet socket paths, we should probe for a transport header
nevertheless before they hit devices.

Reference: http://thread.gmane.org/gmane.linux.network/386173/
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/packet/af_packet.c

index 80c36c0867d3a6f88cc5eb7237d886b8c25cc150..bdecf17a15bb4cce054fb80f26fd536ef18257e6 100644 (file)
@@ -2447,8 +2447,7 @@ static int tpacket_fill_skb(struct packet_sock *po, struct sk_buff *skb,
                len = ((to_write > len_max) ? len_max : to_write);
        }
 
-       if (!packet_use_direct_xmit(po))
-               skb_probe_transport_header(skb, 0);
+       skb_probe_transport_header(skb, 0);
 
        return tp_len;
 }
@@ -2808,8 +2807,8 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len)
                len += vnet_hdr_len;
        }
 
-       if (!packet_use_direct_xmit(po))
-               skb_probe_transport_header(skb, reserve);
+       skb_probe_transport_header(skb, reserve);
+
        if (unlikely(extra_len == 4))
                skb->no_fcs = 1;