[ovs-dev] [PATCH] v2: Add ODP level handling of OVS_KEY_ATTR_IPV4_TUNNEL.

Jesse Gross jesse at nicira.com
Thu Dec 20 23:17:37 UTC 2012


On Wed, Dec 19, 2012 at 3:39 AM, Jarno Rajahalme
<jarno.rajahalme at nsn.com> wrote:
> On a second thought, shouldn't the FLOW_TNL_F_KEY tell if the tun_id is valid? However, based on the following code in lib/match.c, it appears that the semantics of tun_id has changed. Maybe the FLOW_TNL_F_KEY should be set also when setting the tun_id only, so that also the zero tun_id could be used as a valid key value?
>
>     if (flow->tunnel.ip_dst) {
>         if (flow->tunnel.flags & FLOW_TNL_F_KEY) {
>             memset(&wc->masks.tunnel.tun_id, 0xff, sizeof wc->masks.tunnel.tun_id);
>         }
>         memset(&wc->masks.tunnel.ip_src, 0xff, sizeof wc->masks.tunnel.ip_src);
>         memset(&wc->masks.tunnel.ip_dst, 0xff, sizeof wc->masks.tunnel.ip_dst);
>         memset(&wc->masks.tunnel.flags, 0xff, sizeof wc->masks.tunnel.flags);
>         memset(&wc->masks.tunnel.ip_tos, 0xff, sizeof wc->masks.tunnel.ip_tos);
>         memset(&wc->masks.tunnel.ip_ttl, 0xff, sizeof wc->masks.tunnel.ip_ttl);
>     } else if (flow->tunnel.tun_id) {
>         memset(&wc->masks.tunnel.tun_id, 0xff, sizeof wc->masks.tunnel.tun_id);
>     }

The semantics have changed for this exact reason.  Everything that
deals with only with tun_id is legacy code and assumes that no key and
zero are the same.  This is going away so there's no point in changing
it but the new version that uses ip_dst doesn't have this problem.



More information about the dev mailing list