All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Daniel Borkmann <daniel@iogearbox.net>, davem@davemloft.net
Cc: edumazet@google.com, willemb@google.com, tklauser@distanz.ch,
	netdev@vger.kernel.org
Subject: Re: [PATCH net v2 1/3] packet: do skb_probe_transport_header when we actually have data
Date: Wed, 11 Nov 2015 13:07:46 +0800	[thread overview]
Message-ID: <5642CD22.5050600@redhat.com> (raw)
In-Reply-To: <a81140c47ff908cfe86c51e6355876ebeda479c5.1447191361.git.daniel@iogearbox.net>



On 11/11/2015 06:03 AM, Daniel Borkmann wrote:
> In tpacket_fill_skb() commit c1aad275b029 ("packet: set transport
> header before doing xmit") and later on 40893fd0fd4e ("net: switch
> to use skb_probe_transport_header()") was probing for a transport
> header on the skb from a ring buffer slot, but at a time, where
> the skb has _not even_ been filled with data yet. So that call into
> the flow dissector is pretty useless. Lets do it after we've set
> up the skb frags.
>
> Fixes: c1aad275b029 ("packet: set transport header before doing xmit")
> Reported-by: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
> Cc: Jason Wang <jasowang@redhat.com>
> ---
>  net/packet/af_packet.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
> index af399ca..80c36c0 100644
> --- a/net/packet/af_packet.c
> +++ b/net/packet/af_packet.c
> @@ -2368,8 +2368,6 @@ static int tpacket_fill_skb(struct packet_sock *po, struct sk_buff *skb,
>  	skb_reserve(skb, hlen);
>  	skb_reset_network_header(skb);
>  
> -	if (!packet_use_direct_xmit(po))
> -		skb_probe_transport_header(skb, 0);
>  	if (unlikely(po->tp_tx_has_off)) {
>  		int off_min, off_max, off;
>  		off_min = po->tp_hdrlen - sizeof(struct sockaddr_ll);
> @@ -2449,6 +2447,9 @@ 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);
> +
>  	return tp_len;
>  }
>  

Acked-by: Jason Wang <jasowang@redhat.com>

  reply	other threads:[~2015-11-11  5:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-10 22:03 [PATCH net v2 0/3] packet fixes Daniel Borkmann
2015-11-10 22:03 ` [PATCH net v2 1/3] packet: do skb_probe_transport_header when we actually have data Daniel Borkmann
2015-11-11  5:07   ` Jason Wang [this message]
2015-11-10 22:03 ` [PATCH net v2 2/3] packet: always probe for transport header Daniel Borkmann
2015-11-11  5:08   ` Jason Wang
2015-11-10 22:03 ` [PATCH net v2 3/3] packet: fix tpacket_snd max frame and vlan handling Daniel Borkmann
2015-11-10 22:52   ` Willem de Bruijn
2015-11-10 23:12     ` Daniel Borkmann
2015-11-10 23:24       ` Willem de Bruijn
2015-11-10 23:51         ` Daniel Borkmann
2015-11-11 14:56           ` Willem de Bruijn
2015-11-11 22:39             ` Daniel Borkmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5642CD22.5050600@redhat.com \
    --to=jasowang@redhat.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=tklauser@distanz.ch \
    --cc=willemb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.