[ovs-dev] [PATCH] tunnel: fix tnl_find() after packet_type changed

Zoltan Balogh zoltan.balogh at ericsson.com
Fri Dec 8 09:56:28 UTC 2017


During xlate, it can happen that tnl_find() is invoked when flow
packet_type has been already changed. For instance, pop_mpls and
resubmit actions should be applied to the packet in overlay bridge after
packet was received on a legacy_l3 tunnel port.
In this case, packet is recirculated after pop_mpls, a new tunnel lookup
is performed in order to find the proper ofproto, however packet_type of
flow is already PT_ETHERNET while the tunnel port mode is
NETDEV_PT_LEGACY_L3. So, no tunnel port is found and the packet is
dropped.

This fix does an additional tnl_find() if no port is found. It looks for
L3 tunnel port in case of L2 packet and vice versa.

Signed-off-by: Zoltan Balogh <zoltan.balogh at ericsson.com>
CC: Jan Scheurich <jan.scheurich at ericsson.com>
CC: Ben Pfaff <blp at ovn.org>
Fixes: 875ab13020b1 ("userspace: Handling of versatile tunnel ports")
---
 ofproto/tunnel.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/ofproto/tunnel.c b/ofproto/tunnel.c
index 1676f4d46..d497f026b 100644
--- a/ofproto/tunnel.c
+++ b/ofproto/tunnel.c
@@ -585,6 +585,19 @@ tnl_find(const struct flow *flow) OVS_REQ_RDLOCK(rwlock)
                     if (tnl_port) {
                         return tnl_port;
                     }
+
+                    /* Maybe flow->packet_type has been already changed during
+                     * xlate, so let's try to find L2 port for L3 packet or
+                     * L3 port for L2 packet. */
+                    if (pt_ns(flow->packet_type) == OFPHTN_ETHERTYPE) {
+                        match.pt_mode = NETDEV_PT_LEGACY_L2;
+                    } else {
+                        match.pt_mode = NETDEV_PT_LEGACY_L3;
+                    }
+                    tnl_port = tnl_find_exact(&match, map);
+                    if (tnl_port) {
+                        return tnl_port;
+                    }
                 }
 
                 i++;
-- 
2.14.1



More information about the dev mailing list