From: Ansis Atteka Date: Thu, 22 Nov 2012 21:00:05 +0000 (-0800) Subject: vswitchd: fix 32-bit builds X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3b21e3871731d30714890671164d491ebeef459d;p=openvswitch vswitchd: fix 32-bit builds My previous 72e8bf28bb38e8816435c64859fb350215b6a9e6 (datapath: add skb mark matching and set action) commit broke 32-bit builds. This patch assures that size of struct flow is equal on both 32-bit and 64-bit architectures so that build asserts would not fire anymore. Acked-by: Ben Pfaff Signed-off-by: Ansis Atteka --- diff --git a/lib/flow.c b/lib/flow.c index 57eddba2..c2e99b78 100644 --- a/lib/flow.c +++ b/lib/flow.c @@ -555,6 +555,7 @@ void flow_wildcards_init_exact(struct flow_wildcards *wc) { memset(&wc->masks, 0xff, sizeof wc->masks); + memset(wc->masks.zeros, 0, sizeof wc->masks.zeros); } /* Returns true if 'wc' matches every packet, false if 'wc' fixes any bits or diff --git a/lib/flow.h b/lib/flow.h index fa7410e2..ca414391 100644 --- a/lib/flow.h +++ b/lib/flow.h @@ -103,6 +103,7 @@ struct flow { uint8_t arp_tha[6]; /* ARP/ND target hardware address. */ uint8_t nw_ttl; /* IP TTL/Hop Limit. */ uint8_t nw_frag; /* FLOW_FRAG_* flags. */ + uint8_t zeros[4]; }; BUILD_ASSERT_DECL(sizeof(struct flow) % 4 == 0); diff --git a/tests/test-bundle.c b/tests/test-bundle.c index f2d9b824..aa8b6f0f 100644 --- a/tests/test-bundle.c +++ b/tests/test-bundle.c @@ -136,6 +136,7 @@ main(int argc, char *argv[]) flows = xmalloc(N_FLOWS * sizeof *flows); for (i = 0; i < N_FLOWS; i++) { random_bytes(&flows[i], sizeof flows[i]); + memset(flows[i].zeros, 0, sizeof flows[i].zeros); flows[i].regs[0] = OFPP_NONE; } diff --git a/tests/test-multipath.c b/tests/test-multipath.c index 8a355677..b990c133 100644 --- a/tests/test-multipath.c +++ b/tests/test-multipath.c @@ -60,6 +60,7 @@ main(int argc, char *argv[]) struct flow flow; random_bytes(&flow, sizeof flow); + memset(flow.zeros, 0, sizeof flow.zeros); mp.max_link = n - 1; multipath_execute(&mp, &flow);