commit d276038

Michael Forney  ·  2026-04-02 05:12:43 +0000 UTC
parent 775b66a
libnl: Fix some portability issues
2 files changed,  +68, -1
+67, -0
 1@@ -0,0 +1,67 @@
 2+From dcc5033eb17003d078525e146e2a4fec29f71f84 Mon Sep 17 00:00:00 2001
 3+From: Michael Forney <mforney@mforney.org>
 4+Date: Wed, 1 Apr 2026 21:37:21 -0700
 5+Subject: [PATCH] Use C23 syntax for packed attribute and alignment
 6+
 7+---
 8+ include/linux-private/linux/gen_stats.h | 4 ++--
 9+ include/linux-private/linux/if_ether.h  | 4 ++--
10+ include/linux-private/linux/socket.h    | 3 ++-
11+ 3 files changed, 6 insertions(+), 5 deletions(-)
12+
13+diff --git a/include/linux-private/linux/gen_stats.h b/include/linux-private/linux/gen_stats.h
14+index 24a861c0..f2e3d45e 100644
15+--- a/include/linux-private/linux/gen_stats.h
16++++ b/include/linux-private/linux/gen_stats.h
17+@@ -25,10 +25,10 @@ struct gnet_stats_basic {
18+ 	__u64	bytes;
19+ 	__u32	packets;
20+ };
21+-struct gnet_stats_basic_packed {
22++struct [[gnu::packed]] gnet_stats_basic_packed {
23+ 	__u64	bytes;
24+ 	__u32	packets;
25+-} __attribute__ ((packed));
26++};
27+ 
28+ /**
29+  * struct gnet_stats_rate_est - rate estimator
30+diff --git a/include/linux-private/linux/if_ether.h b/include/linux-private/linux/if_ether.h
31+index 8c36f63e..8887d042 100644
32+--- a/include/linux-private/linux/if_ether.h
33++++ b/include/linux-private/linux/if_ether.h
34+@@ -158,11 +158,11 @@
35+ #endif
36+ 
37+ #if __UAPI_DEF_ETHHDR
38+-struct ethhdr {
39++struct [[gnu::packed]] ethhdr {
40+ 	unsigned char	h_dest[ETH_ALEN];	/* destination eth addr	*/
41+ 	unsigned char	h_source[ETH_ALEN];	/* source ether addr	*/
42+ 	__be16		h_proto;		/* packet type ID field	*/
43+-} __attribute__((packed));
44++};
45+ #endif
46+ 
47+ 
48+diff --git a/include/linux-private/linux/socket.h b/include/linux-private/linux/socket.h
49+index 268b9482..93a7b713 100644
50+--- a/include/linux-private/linux/socket.h
51++++ b/include/linux-private/linux/socket.h
52+@@ -12,11 +12,12 @@
53+ typedef unsigned short __kernel_sa_family_t;
54+ 
55+ struct __kernel_sockaddr_storage {
56++	_Alignas(_K_SS_ALIGNSIZE)   /* force desired alignment */
57+ 	__kernel_sa_family_t	ss_family;		/* address family */
58+ 	/* Following field(s) are implementation specific */
59+ 	char		__data[_K_SS_MAXSIZE - sizeof(unsigned short)];
60+ 				/* space to achieve desired size, */
61+ 				/* _SS_MAXSIZE value minus size of ss_family */
62+-} __attribute__ ((aligned(_K_SS_ALIGNSIZE)));	/* force desired alignment */
63++};
64+ 
65+ #endif /* _LINUX_SOCKET_H */
66+-- 
67+2.49.0
68+
+1, -1
1@@ -1 +1 @@
2-3.5.0 r1
3+3.5.0 r2