Skip to content

Commit f7d49bc

Browse files
Jiri Bencdavem330
authored andcommitted
openvswitch: mpls: set network header correctly on key extract
After the 48d2ab6 ("net: mpls: Fixups for GSO"), MPLS handling in openvswitch was changed to have network header pointing to the start of the MPLS headers and inner_network_header pointing after the MPLS headers. However, key_extract was missed by the mentioned commit, causing incorrect headers to be set when a MPLS packet just enters the bridge or after it is recirculated. Fixes: 48d2ab6 ("net: mpls: Fixups for GSO") Signed-off-by: Jiri Benc <jbenc@redhat.com> Acked-by: Pravin B Shelar <pshelar@ovn.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent ab58070 commit f7d49bc

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

‎net/openvswitch/flow.c‎

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -633,25 +633,20 @@ static int key_extract(struct sk_buff *skb, struct sw_flow_key *key)
633633
} else if (eth_p_mpls(key->eth.type)) {
634634
size_t stack_len = MPLS_HLEN;
635635

636-
/* In the presence of an MPLS label stack the end of the L2
637-
* header and the beginning of the L3 header differ.
638-
*
639-
* Advance network_header to the beginning of the L3
640-
* header. mac_len corresponds to the end of the L2 header.
641-
*/
636+
skb_set_inner_network_header(skb, skb->mac_len);
642637
while (1) {
643638
__be32 lse;
644639

645640
error = check_header(skb, skb->mac_len + stack_len);
646641
if (unlikely(error))
647642
return 0;
648643

649-
memcpy(&lse, skb_network_header(skb), MPLS_HLEN);
644+
memcpy(&lse, skb_inner_network_header(skb), MPLS_HLEN);
650645

651646
if (stack_len == MPLS_HLEN)
652647
memcpy(&key->mpls.top_lse, &lse, MPLS_HLEN);
653648

654-
skb_set_network_header(skb, skb->mac_len + stack_len);
649+
skb_set_inner_network_header(skb, skb->mac_len + stack_len);
655650
if (lse & htonl(MPLS_LS_S_MASK))
656651
break;
657652

0 commit comments

Comments
 (0)