Skip to content

Commit

Permalink
packet: always probe for transport header
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Jason Wang <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
borkmann authored and davem330 committed Nov 15, 2015
1 parent efdfa2f commit 8fd6c80
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions net/packet/af_packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 8fd6c80

Please sign in to comment.