Skip to content

Commit 796f2da

Browse files
Toshiaki Makitadavem330
authored andcommitted
net: Fix stacked vlan offload features computation
When vlan tags are stacked, it is very likely that the outer tag is stored in skb->vlan_tci and skb->protocol shows the inner tag's vlan_proto. Currently netif_skb_features() first looks at skb->protocol even if there is the outer tag in vlan_tci, thus it incorrectly retrieves the protocol encapsulated by the inner vlan instead of the inner vlan protocol. This allows GSO packets to be passed to HW and they end up being corrupted. Fixes: 58e998c ("offloading: Force software GSO for multiple vlan tags.") Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent e51a08b commit 796f2da

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

‎net/core/dev.c‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2570,11 +2570,14 @@ netdev_features_t netif_skb_features(struct sk_buff *skb)
25702570
if (gso_segs > dev->gso_max_segs || gso_segs < dev->gso_min_segs)
25712571
features &= ~NETIF_F_GSO_MASK;
25722572

2573-
if (protocol == htons(ETH_P_8021Q) || protocol == htons(ETH_P_8021AD)) {
2574-
struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data;
2575-
protocol = veh->h_vlan_encapsulated_proto;
2576-
} else if (!vlan_tx_tag_present(skb)) {
2577-
return harmonize_features(skb, features);
2573+
if (!vlan_tx_tag_present(skb)) {
2574+
if (unlikely(protocol == htons(ETH_P_8021Q) ||
2575+
protocol == htons(ETH_P_8021AD))) {
2576+
struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data;
2577+
protocol = veh->h_vlan_encapsulated_proto;
2578+
} else {
2579+
return harmonize_features(skb, features);
2580+
}
25782581
}
25792582

25802583
features = netdev_intersect_features(features,

0 commit comments

Comments
 (0)