Skip to content

Commit 4d9c46a

Browse files
Fernando Luis Vazquez Caogregkh
authored andcommitted
tun: remove bogus hardware vlan acceleration flags from vlan_features
[ Upstream commit 6671b22 ] Even though only the outer vlan tag can be HW accelerated in the transmission path, in the TUN/TAP driver vlan_features mirrors hw_features, which happens to have the NETIF_F_HW_VLAN_?TAG_TX flags set. Because of this, during packet tranmisssion through a stacked vlan device dev_hard_start_xmit, (incorrectly) assuming that the vlan device supports hardware vlan acceleration, does not add the vlan header to the skb payload and the inner vlan tags are lost (vlan_tci contains the outer vlan tag when userspace reads the packet from the tap device). Signed-off-by: Fernando Luis Vazquez Cao <fernando@oss.ntt.co.jp> Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 9ed7806 commit 4d9c46a

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎drivers/net/tun.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1651,7 +1651,9 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
16511651
TUN_USER_FEATURES | NETIF_F_HW_VLAN_CTAG_TX |
16521652
NETIF_F_HW_VLAN_STAG_TX;
16531653
dev->features = dev->hw_features;
1654-
dev->vlan_features = dev->features;
1654+
dev->vlan_features = dev->features &
1655+
~(NETIF_F_HW_VLAN_CTAG_TX |
1656+
NETIF_F_HW_VLAN_STAG_TX);
16551657

16561658
INIT_LIST_HEAD(&tun->disabled);
16571659
err = tun_attach(tun, file, false);

0 commit comments

Comments
 (0)