hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/include/linux/if_vlan.h
....@@ -626,6 +626,23 @@
626626 return __vlan_get_protocol(skb, skb->protocol, NULL);
627627 }
628628
629
+/* This version of __vlan_get_protocol() also pulls mac header in skb->head */
630
+static inline __be16 vlan_get_protocol_and_depth(struct sk_buff *skb,
631
+ __be16 type, int *depth)
632
+{
633
+ int maclen;
634
+
635
+ type = __vlan_get_protocol(skb, type, &maclen);
636
+
637
+ if (type) {
638
+ if (!pskb_may_pull(skb, maclen))
639
+ type = 0;
640
+ else if (depth)
641
+ *depth = maclen;
642
+ }
643
+ return type;
644
+}
645
+
629646 /* A getter for the SKB protocol field which will handle VLAN tags consistently
630647 * whether VLAN acceleration is enabled or not.
631648 */