summaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-protocols/openlldp/files/0003-lldp-add-packed-struct-definition.patch
blob: 4d0594cb6c6740000d0ccc673223f1dc4309bd61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
From 702dd20f43d9ca7e0bcb917e8acfec3f1acdcb5c Mon Sep 17 00:00:00 2001
From: Aaron Conole <aconole@redhat.com>
Date: Mon, 3 Aug 2020 15:14:50 -0400
Subject: [PATCH 3/9] lldp: add packed struct definition

Signed-off-by: Aaron Conole <aconole@redhat.com>
---
 include/lldp.h   | 6 ++++++
 lldp/l2_packet.h | 5 ++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/include/lldp.h b/include/lldp.h
index fb5ee93..de6a4ad 100644
--- a/include/lldp.h
+++ b/include/lldp.h
@@ -255,5 +255,11 @@ enum {
 #define LLDP_EVB_DEFAULT_RTE				15
 #define LLDP_EVB_DEFAULT_MAX_RTE			31
 
+#ifndef _MSC_VER
+#define STRUCT_PACKED(STRUCT) STRUCT __attribute__((__packed__))
+#else
+#define STRUCT_PACKED(STRUCT) __pragma(pack(push, 1)) STRUCT __pragma(pack(pop))
+#endif
+
 void somethingChangedLocal(const char *ifname, int type);
 #endif /* _LLDP_H */
diff --git a/lldp/l2_packet.h b/lldp/l2_packet.h
index 607b8a3..831958c 100644
--- a/lldp/l2_packet.h
+++ b/lldp/l2_packet.h
@@ -58,12 +58,11 @@
  */
 struct l2_packet_data;
 
-
-struct l2_ethhdr {
+STRUCT_PACKED(struct l2_ethhdr {
 	u8 h_dest[ETH_ALEN];
 	u8 h_source[ETH_ALEN];
 	u16 h_proto;
-} STRUCT_PACKED;
+});
 
 /**
  * l2_packet_init - Initialize l2_packet interface
-- 
2.28.0