.. | .. |
---|
626 | 626 | return __vlan_get_protocol(skb, skb->protocol, NULL); |
---|
627 | 627 | } |
---|
628 | 628 | |
---|
| 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 | + |
---|
629 | 646 | /* A getter for the SKB protocol field which will handle VLAN tags consistently |
---|
630 | 647 | * whether VLAN acceleration is enabled or not. |
---|
631 | 648 | */ |
---|