[ovs-dev] [PATCHv2] vswitchd: fix 32-bit builds
Ansis Atteka
aatteka at nicira.com
Thu Nov 22 21:29:24 UTC 2012
My previous dcb66daea433cd93593e517c3fac3c898f2c9f70 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.
Signed-off-by: Ansis Atteka <aatteka at nicira.com>
---
lib/flow.c | 1 +
lib/flow.h | 1 +
tests/test-bundle.c | 1 +
tests/test-multipath.c | 1 +
4 files changed, 4 insertions(+)
diff --git a/lib/flow.c b/lib/flow.c
index 57eddba..c2e99b7 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 fa7410e..ca41439 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 f2d9b82..aa8b6f0 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 8a35567..b990c13 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);
--
1.7.9.5
More information about the dev
mailing list