lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <9a284a4d29bb3301f50d7993c6bebb04@walle.cc>
Date:   Mon, 24 Sep 2018 14:01:59 +0200
From:   Michael Walle <michael@...le.cc>
To:     netdev@...r.kernel.org
Cc:     "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        "Steinar H. Gunderson" <sesse@...gle.com>, heiko.thiery@...il.com
Subject: vlan missing with AF_PACKET and auxdata

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ