[ovs-dev] [PATCH 1/2] dhcp: Mark dhcp_header as packed.

Ben Pfaff blp at ovn.org
Wed Dec 12 18:46:10 UTC 2018


This structure isn't performance-sensitive and making it packed simplifies
thinking about access to it.

CC: Gregory Smith <gasmith at nutanix.com>
Signed-off-by: Ben Pfaff <blp at ovn.org>
---
 lib/dhcp.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/dhcp.h b/lib/dhcp.h
index 271e0a55b320..2feb2f4478f9 100644
--- a/lib/dhcp.h
+++ b/lib/dhcp.h
@@ -28,6 +28,7 @@
 #define DHCP_MAGIC_COOKIE 0x63825363
 
 #define DHCP_HEADER_LEN 236
+OVS_PACKED(
 struct dhcp_header {
     uint8_t op;                 /* DHCP_BOOTREQUEST or DHCP_BOOTREPLY. */
     uint8_t htype;              /* ARP_HRD_ETHERNET (typically). */
@@ -44,7 +45,7 @@ struct dhcp_header {
     char sname[64];             /* Optional server host name. */
     char file[128];             /* Boot file name. */
     /* Followed by variable-length options field. */
-};
+});
 BUILD_ASSERT_DECL(DHCP_HEADER_LEN == sizeof(struct dhcp_header));
 
 #define DHCP_OP_REQUEST    1
-- 
2.16.1



More information about the dev mailing list