blob: 4d0594cb6c6740000d0ccc673223f1dc4309bd61 [file] [log] [blame]
Andrew Geisslerbffdb3e2020-08-21 16:13:29 -05001From 702dd20f43d9ca7e0bcb917e8acfec3f1acdcb5c Mon Sep 17 00:00:00 2001
2From: Aaron Conole <aconole@redhat.com>
3Date: Mon, 3 Aug 2020 15:14:50 -0400
4Subject: [PATCH 3/9] lldp: add packed struct definition
5
6Signed-off-by: Aaron Conole <aconole@redhat.com>
7---
8 include/lldp.h | 6 ++++++
9 lldp/l2_packet.h | 5 ++---
10 2 files changed, 8 insertions(+), 3 deletions(-)
11
12diff --git a/include/lldp.h b/include/lldp.h
13index fb5ee93..de6a4ad 100644
14--- a/include/lldp.h
15+++ b/include/lldp.h
16@@ -255,5 +255,11 @@ enum {
17 #define LLDP_EVB_DEFAULT_RTE 15
18 #define LLDP_EVB_DEFAULT_MAX_RTE 31
19
20+#ifndef _MSC_VER
21+#define STRUCT_PACKED(STRUCT) STRUCT __attribute__((__packed__))
22+#else
23+#define STRUCT_PACKED(STRUCT) __pragma(pack(push, 1)) STRUCT __pragma(pack(pop))
24+#endif
25+
26 void somethingChangedLocal(const char *ifname, int type);
27 #endif /* _LLDP_H */
28diff --git a/lldp/l2_packet.h b/lldp/l2_packet.h
29index 607b8a3..831958c 100644
30--- a/lldp/l2_packet.h
31+++ b/lldp/l2_packet.h
32@@ -58,12 +58,11 @@
33 */
34 struct l2_packet_data;
35
36-
37-struct l2_ethhdr {
38+STRUCT_PACKED(struct l2_ethhdr {
39 u8 h_dest[ETH_ALEN];
40 u8 h_source[ETH_ALEN];
41 u16 h_proto;
42-} STRUCT_PACKED;
43+});
44
45 /**
46 * l2_packet_init - Initialize l2_packet interface
47--
482.28.0
49