Upstream commit:
    commit f7d49bce8e741e1e6aa14ce4db1b6cea7e4be4e8
    Author: Jiri Benc <jb...@redhat.com>
    Date:   Fri Sep 30 19:08:05 2016 +0200

    openvswitch: mpls: set network header correctly on key extract

    After the 48d2ab609b6b ("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: 48d2ab609b6b ("net: mpls: Fixups for GSO")
    Signed-off-by: Jiri Benc <jb...@redhat.com>
    Acked-by: Pravin B Shelar <pshe...@ovn.org>
    Signed-off-by: David S. Miller <da...@davemloft.net>

Signed-off-by: Yi-Hung Wei <yihung....@gmail.com>
---
 datapath/flow.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/datapath/flow.c b/datapath/flow.c
index 2bc1ad0d5304..1d40b2400406 100644
--- a/datapath/flow.c
+++ b/datapath/flow.c
@@ -666,12 +666,7 @@ static int key_extract(struct sk_buff *skb, struct 
sw_flow_key *key)
        } else if (eth_p_mpls(key->eth.type)) {
                size_t stack_len = MPLS_HLEN;
 
-               /* In the presence of an MPLS label stack the end of the L2
-                * header and the beginning of the L3 header differ.
-                *
-                * Advance network_header to the beginning of the L3
-                * header. mac_len corresponds to the end of the L2 header.
-                */
+               skb_set_inner_network_header(skb, skb->mac_len);
                while (1) {
                        __be32 lse;
 
@@ -679,12 +674,12 @@ static int key_extract(struct sk_buff *skb, struct 
sw_flow_key *key)
                        if (unlikely(error))
                                return 0;
 
-                       memcpy(&lse, skb_network_header(skb), MPLS_HLEN);
+                       memcpy(&lse, skb_inner_network_header(skb), MPLS_HLEN);
 
                        if (stack_len == MPLS_HLEN)
                                memcpy(&key->mpls.top_lse, &lse, MPLS_HLEN);
 
-                       skb_set_network_header(skb, skb->mac_len + stack_len);
+                       skb_set_inner_network_header(skb, skb->mac_len + 
stack_len);
                        if (lse & htonl(MPLS_LS_S_MASK))
                                break;
 
-- 
2.7.4

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to