netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: phil@nwl.cc
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH 1/3] af_packet: when sending ethernet frames, parse header for skb->protocol
Date: Wed, 31 Jul 2013 17:30:17 -0700 (PDT)	[thread overview]
Message-ID: <20130731.173017.624144247713296239.davem@davemloft.net> (raw)
In-Reply-To: <1375291667-9572-2-git-send-email-phil@nwl.cc>

From: Phil Sutter <phil@nwl.cc>
Date: Wed, 31 Jul 2013 19:27:45 +0200

> @@ -2324,6 +2328,13 @@ static int packet_snd(struct socket *sock,
>  
>  	sock_tx_timestamp(sk, &skb_shinfo(skb)->tx_flags);
>  
> +	if (dev->type == ARPHRD_ETHER) {
> +		skb->protocol = eth_type_trans(skb, dev);
> +	} else {
> +		skb->protocol = proto;
> +		skb->dev = dev;
> +	}
> +
>  	if (!gso_type && (len > dev->mtu + reserve + extra_len)) {
>  		/* Earlier code assumed this would be a VLAN pkt,
>  		 * double-check this now that we have the actual
> @@ -2338,8 +2349,6 @@ static int packet_snd(struct socket *sock,
>  		}
>  	}
>  
> -	skb->protocol = proto;
> -	skb->dev = dev;
>  	skb->priority = sk->sk_priority;
>  	skb->mark = sk->sk_mark;

I don't see anything explaining why you are avoiding setting skb->dev when
you use eth_type_trans() to set the skb->protocol field.

Also, why isn't the user setting the protocol field correctly?  Isn't
that the _real_ source of these problems?

This patch series cannot be applied as is, it's either wrong, or
explanations are missing from the commit messages.

  parent reply	other threads:[~2013-08-01  0:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-29 16:53 packet_mmap, 802.1Q and bridges Phil Sutter
2013-07-31 17:27 ` Parse ethernet headers in af_packet.c Phil Sutter
2013-07-31 17:27   ` [PATCH 1/3] af_packet: when sending ethernet frames, parse header for skb->protocol Phil Sutter
2013-07-31 17:27     ` [PATCH 2/3] af_packet: fix for sending VLAN frames via packet_mmap Phil Sutter
2013-07-31 17:27       ` [PATCH 3/3] af_packet: simplify VLAN frame check in packet_snd Phil Sutter
2013-08-01  0:30     ` David Miller [this message]
2013-08-01 10:35       ` [PATCH 1/3] af_packet: when sending ethernet frames, parse header for skb->protocol Phil Sutter
2013-08-02  1:12         ` David Miller
2013-08-02  9:37           ` [PATCH v2 " Phil Sutter
2013-08-02  9:37             ` [PATCH v2 2/3] af_packet: fix for sending VLAN frames via packet_mmap Phil Sutter
2013-08-02  9:37               ` [PATCH v2 3/3] af_packet: simplify VLAN frame check in packet_snd Phil Sutter
2013-08-02 21:59                 ` David Miller
2013-08-02 21:58               ` [PATCH v2 2/3] af_packet: fix for sending VLAN frames via packet_mmap David Miller
2013-08-02 21:58             ` [PATCH v2 1/3] af_packet: when sending ethernet frames, parse header for skb->protocol David Miller

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=20130731.173017.624144247713296239.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=phil@nwl.cc \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).