[ovs-dev] [PATCH] flow: Fix struct flow size build assertion failure.

Jesse Gross jesse at nicira.com
Wed Oct 3 18:35:30 UTC 2012


The new struct flow_tnl contains an extra four bytes of padding on
64-bit machines but we currently assert that the total struct flow
is a fixed size.  The size difference isn't actually a problem
because both are multiples of 4 and the build assertion is only
intended to remind people to update FLOW_WC_SEQ when new fields are
added.  This changes the assertion to fix just the non-tunnel field
size.

Suggested-by: Ben Pfaff <blp at nicira.com>
Signed-off-by: Jesse Gross <jesse at nicira.com>
---
 lib/flow.h |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/flow.h b/lib/flow.h
index dcd77c2..9388f20 100644
--- a/lib/flow.h
+++ b/lib/flow.h
@@ -96,7 +96,8 @@ BUILD_ASSERT_DECL(sizeof(struct flow) % 4 == 0);
 #define FLOW_U32S (sizeof(struct flow) / 4)
 
 /* Remember to update FLOW_WC_SEQ when changing 'struct flow'. */
-BUILD_ASSERT_DECL(sizeof(struct flow) == 168 && FLOW_WC_SEQ == 17);
+BUILD_ASSERT_DECL(sizeof(struct flow) == sizeof(struct flow_tnl) + 144 &&
+                  FLOW_WC_SEQ == 17);
 
 /* Represents the metadata fields of struct flow. */
 struct flow_metadata {
-- 
1.7.9.5




More information about the dev mailing list