From: Jarno Rajahalme <[email protected]> Do not clear tunnel metadata on tunnel input.
This is a backport of 4110a57 (Keep all of tunnel metadata in flow.) to branch-1.10. This fixes an issue with received tunnel traffic and megaflows. xlate_actions() calls tnl_port_should_receive() to determine whether it should un-wildcard the tunnel fields. Without this commit, the original flow's tunnel information is zeroed and is unavailable for tnl_port_should_receive()'s use to determine whether it's a tunnel flow or not. This resulted in some tunnel traffic being wildcarded inappropriately. Bug #18277. Signed-off-by: Justin Pettit <[email protected]> Signed-off-by: Jarno Rajahalme <[email protected]> Signed-off-by: Ben Pfaff <[email protected]> --- ofproto/ofproto-dpif.c | 12 ++++++------ ofproto/tunnel.c | 3 +-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 93b0579..c1a85b6 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -7096,12 +7096,12 @@ xlate_actions(struct xlate_in *xin, struct xlate_out *xout) * to another device without any modifications this will cause us to * insert a new tag since the original one was stripped off by the * VLAN device. - * - Tunnel 'flow' is largely cleared when transitioning between - * the input and output stages since it does not make sense to output - * a packet with the exact headers that it was received with (i.e. - * the destination IP is us). The one exception is the tun_id, which - * is preserved to allow use in later resubmit lookups and loads into - * registers. + * - Tunnel metadata as received is retained in 'flow'. This allows + * tunnel metadata matching also in later tables. + * Since a kernel action for setting the tunnel metadata will only be + * generated with actual tunnel output, changing the tunnel metadata + * values in 'flow' (such as tun_id) will only have effect with a later + * tunnel output action. * - Tunnel 'base_flow' is completely cleared since that is what the * kernel does. If we wish to maintain the original values an action * needs to be generated. */ diff --git a/ofproto/tunnel.c b/ofproto/tunnel.c index ce9def1..9a34d8b 100644 --- a/ofproto/tunnel.c +++ b/ofproto/tunnel.c @@ -197,8 +197,7 @@ tnl_port_receive(struct flow *flow) } flow->in_port = tnl_port->ofport->ofp_port; - memset(&flow->tunnel, 0, sizeof flow->tunnel); - flow->tunnel.tun_id = match.in_key; + /* Keep flow->tunnel to allow matching on tunnel metadata */ if (pre_flow_str) { char *post_flow_str = flow_to_string(flow); -- 1.7.9.5 _______________________________________________ dev mailing list [email protected] http://openvswitch.org/mailman/listinfo/dev
