tunnel: Do not set padding bits in tunnel mask.
authorBen Pfaff <blp@nicira.com>
Sun, 2 Mar 2014 01:15:00 +0000 (17:15 -0800)
committerBen Pfaff <blp@nicira.com>
Sun, 2 Mar 2014 01:39:24 +0000 (17:39 -0800)
On most architectures other than 32-bit x86, struct flow_tnl ends with 4
padding bytes.  Until now, tnl_xlate_init() set those bytes to nonzero
values in the wildcard mask.  When the wildcard mask passed through Netlink
attributes and back to userspace, the padding bytes of course became zero
again, which caused a wildcard mask mismatch and premature deletion of the
flow in revalidation.  This commit fixes the problem.

Bug #1192516.
Reported-by: Krishna Miriyala <miriyalak@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
ofproto/tunnel.c

index 09497a3..46e1adb 100644 (file)
@@ -272,10 +272,15 @@ tnl_xlate_init(const struct flow *base_flow, struct flow *flow,
                struct flow_wildcards *wc)
 {
     if (tnl_port_should_receive(flow)) {
-        memset(&wc->masks.tunnel, 0xff, sizeof wc->masks.tunnel);
+        wc->masks.tunnel.tun_id = OVS_BE64_MAX;
+        wc->masks.tunnel.ip_src = OVS_BE32_MAX;
+        wc->masks.tunnel.ip_dst = OVS_BE32_MAX;
         wc->masks.tunnel.flags = (FLOW_TNL_F_DONT_FRAGMENT |
                                   FLOW_TNL_F_CSUM |
                                   FLOW_TNL_F_KEY);
+        wc->masks.tunnel.ip_tos = UINT8_MAX;
+        wc->masks.tunnel.ip_ttl = UINT8_MAX;
+
         memset(&wc->masks.pkt_mark, 0xff, sizeof wc->masks.pkt_mark);
 
         if (!tnl_ecn_ok(base_flow, flow)) {