From: Michael Walle <michael@walle.cc>
To: netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
"Steinar H. Gunderson" <sesse@google.com>,
heiko.thiery@gmail.com
Subject: Re: vlan missing with AF_PACKET and auxdata
Date: Tue, 02 Oct 2018 10:13:31 +0200 [thread overview]
Message-ID: <98a0509d2c75e9b6ccfbe5990f193dc3@walle.cc> (raw)
In-Reply-To: <9a284a4d29bb3301f50d7993c6bebb04@walle.cc>
Am 2018-09-24 14:01, schrieb Michael Walle:
> Hi,
>
> I'm using the AF_PACKET socket with setsockopt(PACKET_AUXDATA) to get
> the incoming VLAN tag. Correct me if I'm wrong, but as far as I see
> the first VLAN tag is always stripped - either in hardware or in
> net/core/dev.c in __netif_receive_skb_core() - and stored in
> skb->vlan_tci. Therefore, it won't be in the packet data anymore.
>
> If I use the socket with ETH_P_ALL as protocol, everything works as
> expected. But if I'm using an actual protocol number, instead of the
> catch all, the tp_vlan_tci field inside the auxdata will be zero. I've
> traced this to commit d4b812dea4a236f729526facf97df1a9d18e191c (vlan:
> mask vlan prio bits):
>
> + if (unlikely(vlan_tx_tag_present(skb))) {
> + if (vlan_tx_tag_get_id(skb))
> + skb->pkt_type = PACKET_OTHERHOST;
> + /* Note: we might in the future use prio bits
> + * and set skb->priority like in vlan_do_receive()
> + * For the time being, just ignore Priority Code Point
> + */
> + skb->vlan_tci = 0;
> + }
>
> The ptype_all callbacks (which are working as expected) are before
> this code and the ptype_specific callbacks (which are not working) are
> after this piece of code. I don't know it this is a bug or not, I
> guess it is one, at least from the AF_PACKET socket point of view. If
> not, how I'm supposed to get the original VLAN tag with
> socket(AF_PACKET, my_protocol)?
>
> I also don't understand the commit (message) as the subject suggesets
> only the prio bits should be masked, but with "skb->vlan_tci = 0"
> everything is masked. Therefore, I've put the original (hopefully the
> mail addresses are still valid) authors in CC.
>
ping? :)
-michael
prev parent reply other threads:[~2018-10-02 14:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-24 12:01 vlan missing with AF_PACKET and auxdata Michael Walle
2018-09-24 12:22 ` Jan Grashöfer
2018-09-24 14:25 ` Michael Walle
2018-10-02 8:13 ` Michael Walle [this message]
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=98a0509d2c75e9b6ccfbe5990f193dc3@walle.cc \
--to=michael@walle.cc \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=heiko.thiery@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=sesse@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 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).