From: Ben Pfaff Date: Sun, 2 Mar 2014 01:11:02 +0000 (-0800) Subject: odp-util: Include tun_id when nonzero even if "key" flag not set. X-Git-Tag: v2.0.2~25 X-Git-Url: http://git.cascardo.eti.br/?a=commitdiff_plain;h=c092fa4ec0c8fc59bd4258d3e74572d59fd7f3dc;hp=e8ac8c3940535fb439eba980afa6c61bdd428003;p=cascardo%2Fovs.git odp-util: Include tun_id when nonzero even if "key" flag not set. When a flow_tnl is being translated to Netlink attributes, the tun_id field was included only if the FLOW_TNL_F_KEY flag was set. This meant that for a mask, where one would not necessarily expect that flag to be set even if there were a key, the tun_id could be omitted even if it were nonzero. This led to kernel flows that did not match on a field that was required to be matched (possibly causing incorrect treatment of packets) and premature deletion of kernel flows due to mask mismatch. This commit fixes the problem. Bug #1192516. Reported-by: Krishna Miriyala Signed-off-by: Ben Pfaff Acked-by: Ethan Jackson --- diff --git a/lib/odp-util.c b/lib/odp-util.c index e2ac23e27..7444ccf5c 100644 --- a/lib/odp-util.c +++ b/lib/odp-util.c @@ -877,7 +877,8 @@ tun_key_to_attr(struct ofpbuf *a, const struct flow_tnl *tun_key) tun_key_ofs = nl_msg_start_nested(a, OVS_KEY_ATTR_TUNNEL); - if (tun_key->flags & FLOW_TNL_F_KEY) { + /* tun_id != 0 without FLOW_TNL_F_KEY is valid if tun_key is a mask. */ + if (tun_key->tun_id || tun_key->flags & FLOW_TNL_F_KEY) { nl_msg_put_be64(a, OVS_TUNNEL_KEY_ATTR_ID, tun_key->tun_id); } if (tun_key->ip_src) {