* vlan missing with AF_PACKET and auxdata
@ 2018-09-24 12:01 Michael Walle
2018-09-24 12:22 ` Jan Grashöfer
2018-10-02 8:13 ` Michael Walle
0 siblings, 2 replies; 4+ messages in thread
From: Michael Walle @ 2018-09-24 12:01 UTC (permalink / raw)
To: netdev; +Cc: David S. Miller, Eric Dumazet, Steinar H. Gunderson, heiko.thiery
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.
Thanks,
-michael
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: vlan missing with AF_PACKET and auxdata
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
1 sibling, 1 reply; 4+ messages in thread
From: Jan Grashöfer @ 2018-09-24 12:22 UTC (permalink / raw)
To: Michael Walle, netdev
Cc: David S. Miller, Eric Dumazet, Steinar H. Gunderson, heiko.thiery
Hi Michael,
On 24/09/2018 14:01, Michael Walle wrote:
> 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.
although the documentation says "SOCK_RAW packets are passed to and from
the device driver without any changes in the packet data." [1] that's
correct and was discussed here:
https://www.spinics.net/lists/netdev/msg440313.html
Result of the discussion: Won't fix, too complicated.
Jan
[1] http://man7.org/linux/man-pages/man7/packet.7.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: vlan missing with AF_PACKET and auxdata
2018-09-24 12:22 ` Jan Grashöfer
@ 2018-09-24 14:25 ` Michael Walle
0 siblings, 0 replies; 4+ messages in thread
From: Michael Walle @ 2018-09-24 14:25 UTC (permalink / raw)
To: Jan Grashöfer
Cc: netdev, David S. Miller, Eric Dumazet, Steinar H. Gunderson,
heiko.thiery
Am 2018-09-24 14:22, schrieb Jan Grashöfer:
> Hi Michael,
>
> On 24/09/2018 14:01, Michael Walle wrote:
>> 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.
>
> although the documentation says "SOCK_RAW packets are passed to and
> from the device driver without any changes in the packet data." [1]
> that's correct and was discussed here:
> https://www.spinics.net/lists/netdev/msg440313.html
>
> Result of the discussion: Won't fix, too complicated.
Hi Jan,
thanks for the pointer. I'm fine with this decision, because the VLAN
tag should be available through metadata. And this was my original
question, because the metadata is only available in case of proto ==
ETH_P_ALL, but not for proto != ETH_P_ALL because of the commit in
question.
-michael
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: vlan missing with AF_PACKET and auxdata
2018-09-24 12:01 vlan missing with AF_PACKET and auxdata Michael Walle
2018-09-24 12:22 ` Jan Grashöfer
@ 2018-10-02 8:13 ` Michael Walle
1 sibling, 0 replies; 4+ messages in thread
From: Michael Walle @ 2018-10-02 8:13 UTC (permalink / raw)
To: netdev; +Cc: David S. Miller, Eric Dumazet, Steinar H. Gunderson, heiko.thiery
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-10-02 14:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).