]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
net: vlan: Add parse protocol header ops
authorEran Ben Elisha <eranbe@nvidia.com>
Tue, 12 Jan 2021 19:07:12 +0000 (21:07 +0200)
committerJakub Kicinski <kuba@kernel.org>
Fri, 15 Jan 2021 02:24:53 +0000 (18:24 -0800)
Add parse protocol header ops for vlan device. Before this patch, vlan
tagged packet transmitted by af_packet had skb->protocol unset. Some
kernel methods (like __skb_flow_dissect()) rely on this missing information
for its packet processing.

Signed-off-by: Eran Ben Elisha <eranbe@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/8021q/vlan_dev.c

index ec8408d1638fbdf2742a3c07eaeb8ac0511883f5..dc1a197792e6bdad8add9263d7bfbfd247660c16 100644 (file)
@@ -510,9 +510,17 @@ static void vlan_dev_set_lockdep_class(struct net_device *dev)
        netdev_for_each_tx_queue(dev, vlan_dev_set_lockdep_one, NULL);
 }
 
+static __be16 vlan_parse_protocol(const struct sk_buff *skb)
+{
+       struct vlan_ethhdr *veth = (struct vlan_ethhdr *)(skb->data);
+
+       return __vlan_get_protocol(skb, veth->h_vlan_proto, NULL);
+}
+
 static const struct header_ops vlan_header_ops = {
        .create  = vlan_dev_hard_header,
        .parse   = eth_header_parse,
+       .parse_protocol = vlan_parse_protocol,
 };
 
 static int vlan_passthru_hard_header(struct sk_buff *skb, struct net_device *dev,
@@ -532,6 +540,7 @@ static int vlan_passthru_hard_header(struct sk_buff *skb, struct net_device *dev
 static const struct header_ops vlan_passthru_header_ops = {
        .create  = vlan_passthru_hard_header,
        .parse   = eth_header_parse,
+       .parse_protocol = vlan_parse_protocol,
 };
 
 static struct device_type vlan_type = {