forked from Minki/linux
net: skb_mpls_push() modified to allow MPLS header push at start of packet.
The existing skb_mpls_push() implementation always inserts mpls header after the mac header. L2 VPN use cases requires MPLS header to be inserted before the ethernet header as the ethernet packet gets tunnelled inside MPLS header in those cases. Signed-off-by: Martin Varghese <martin.varghese@nokia.com> Acked-by: Pravin B Shelar <pshelar@ovn.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
ac80010fc9
commit
e7dbfed1ad
@ -5472,12 +5472,15 @@ static void skb_mod_eth_type(struct sk_buff *skb, struct ethhdr *hdr,
|
||||
}
|
||||
|
||||
/**
|
||||
* skb_mpls_push() - push a new MPLS header after the mac header
|
||||
* skb_mpls_push() - push a new MPLS header after mac_len bytes from start of
|
||||
* the packet
|
||||
*
|
||||
* @skb: buffer
|
||||
* @mpls_lse: MPLS label stack entry to push
|
||||
* @mpls_proto: ethertype of the new MPLS header (expects 0x8847 or 0x8848)
|
||||
* @mac_len: length of the MAC header
|
||||
* @ethernet: flag to indicate if the resulting packet after skb_mpls_push is
|
||||
* ethernet
|
||||
*
|
||||
* Expects skb->data at mac header.
|
||||
*
|
||||
@ -5501,7 +5504,7 @@ int skb_mpls_push(struct sk_buff *skb, __be32 mpls_lse, __be16 mpls_proto,
|
||||
return err;
|
||||
|
||||
if (!skb->inner_protocol) {
|
||||
skb_set_inner_network_header(skb, mac_len);
|
||||
skb_set_inner_network_header(skb, skb_network_offset(skb));
|
||||
skb_set_inner_protocol(skb, skb->protocol);
|
||||
}
|
||||
|
||||
@ -5510,6 +5513,7 @@ int skb_mpls_push(struct sk_buff *skb, __be32 mpls_lse, __be16 mpls_proto,
|
||||
mac_len);
|
||||
skb_reset_mac_header(skb);
|
||||
skb_set_network_header(skb, mac_len);
|
||||
skb_reset_mac_len(skb);
|
||||
|
||||
lse = mpls_hdr(skb);
|
||||
lse->label_stack_entry = mpls_lse;
|
||||
|
Loading…
Reference in New Issue
Block a user