@@ -585,13 +585,16 @@ static inline int vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci)
585
585
* vlan_get_protocol - get protocol EtherType.
586
586
* @skb: skbuff to query
587
587
* @type: first vlan protocol
588
+ * @mac_offset: MAC offset
588
589
* @depth: buffer to store length of eth and vlan tags in bytes
589
590
*
590
591
* Returns the EtherType of the packet, regardless of whether it is
591
592
* vlan encapsulated (normal or hardware accelerated) or not.
592
593
*/
593
- static inline __be16 __vlan_get_protocol (const struct sk_buff * skb , __be16 type ,
594
- int * depth )
594
+ static inline __be16 __vlan_get_protocol_offset (const struct sk_buff * skb ,
595
+ __be16 type ,
596
+ int mac_offset ,
597
+ int * depth )
595
598
{
596
599
unsigned int vlan_depth = skb -> mac_len , parse_depth = VLAN_MAX_DEPTH ;
597
600
@@ -610,7 +613,8 @@ static inline __be16 __vlan_get_protocol(const struct sk_buff *skb, __be16 type,
610
613
do {
611
614
struct vlan_hdr vhdr , * vh ;
612
615
613
- vh = skb_header_pointer (skb , vlan_depth , sizeof (vhdr ), & vhdr );
616
+ vh = skb_header_pointer (skb , mac_offset + vlan_depth ,
617
+ sizeof (vhdr ), & vhdr );
614
618
if (unlikely (!vh || !-- parse_depth ))
615
619
return 0 ;
616
620
@@ -625,6 +629,12 @@ static inline __be16 __vlan_get_protocol(const struct sk_buff *skb, __be16 type,
625
629
return type ;
626
630
}
627
631
632
+ static inline __be16 __vlan_get_protocol (const struct sk_buff * skb , __be16 type ,
633
+ int * depth )
634
+ {
635
+ return __vlan_get_protocol_offset (skb , type , 0 , depth );
636
+ }
637
+
628
638
/**
629
639
* vlan_get_protocol - get protocol EtherType.
630
640
* @skb: skbuff to query
0 commit comments