2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-21 14:49:41 +00:00

Add build checks for portable OpenFlow structure padding and alignment.

This causes the build to fail with an error message if openflow.h contains
a structure whose members are not aligned in a portable way.
This commit is contained in:
Ben Pfaff
2010-01-25 10:49:31 -08:00
parent 84a0ee89e2
commit 05b3c97be6
12 changed files with 347 additions and 7 deletions

1
include/openflow/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/openflow.h.stamp

View File

@@ -2,3 +2,19 @@ noinst_HEADERS += \
include/openflow/openflow-mgmt.h \
include/openflow/nicira-ext.h \
include/openflow/openflow.h
if HAVE_PYTHON
all-local: include/openflow/openflow.h.stamp
include/openflow/openflow.h.stamp: \
include/openflow/openflow.h build-aux/check-structs
$(PYTHON) $(srcdir)/build-aux/check-structs $(srcdir)/include/openflow/openflow.h
touch $@
all-local: include/openflow/nicira-ext.h.stamp
include/openflow/nicira-ext.h.stamp: include/openflow/openflow.h include/openflow/nicira-ext.h build-aux/check-structs
$(PYTHON) $(srcdir)/build-aux/check-structs $(srcdir)/include/openflow/openflow.h $(srcdir)/include/openflow/nicira-ext.h
touch $@
endif
EXTRA_DIST += build-aux/check-structs
DISTCLEANFILES += include/openflow/openflow.h.stamp

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2009 Nicira Networks
* Copyright (c) 2008, 2009, 2010 Nicira Networks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -65,7 +65,7 @@ struct nicira_header {
uint32_t vendor; /* NX_VENDOR_ID. */
uint32_t subtype; /* One of NXT_* above. */
};
OFP_ASSERT(sizeof(struct nicira_header) == sizeof(struct ofp_vendor_header) + 4);
OFP_ASSERT(sizeof(struct nicira_header) == 16);
enum nx_action_subtype {