summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2021-09-10 13:43:34 +0200
committerThomas Haller <thaller@redhat.com>2021-09-10 13:43:34 +0200
commit9ec9a92f1724b0a92c65bc4740c9b91953a23dd5 (patch)
tree4ed9727e184913ecc568b695cffd800ae0352278
parent3a6b3e35da3551d70f8094872d79527760210db7 (diff)
downloadNetworkManager-9ec9a92f1724b0a92c65bc4740c9b91953a23dd5.tar.gz
platform: avoid bitfield at end of __NMPlatformIPAddress_COMMON macro
NMPlatformIPAddress, NMPlatformIP4Address and NMPlatformIP6Address are supposed to have a common first part, which is address family agnostic. For that, the is the macro __NMPlatformIPAddress_COMMON which defines the first fields. Something similar is also done for routes and object types that have an ifindex. Anyway, __NMPlatformIPAddress_COMMON used to have a bitfield as last element. In particular NMPlatformIP4Address then has a bitfield as first IPv4 specific field. With this it's not clear to me that the alignment is guaranteed to be the same for all structs. Avoid the trailing bitfield at __NMPlatformIPAddress_COMMON to workaround this potential problem.
-rw-r--r--src/libnm-platform/nm-platform.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/libnm-platform/nm-platform.h b/src/libnm-platform/nm-platform.h
index e3f6d0433e..8634f2e243 100644
--- a/src/libnm-platform/nm-platform.h
+++ b/src/libnm-platform/nm-platform.h
@@ -317,8 +317,6 @@ typedef enum {
* IFA_FLAGS attribute. */ \
guint32 n_ifa_flags; \
\
- guint8 plen; \
- \
/* FIXME(l3cfg): the external marker won't be necessary anymore, because we only
* merge addresses we care about, and ignore (don't remove) external addresses. */ \
bool external : 1; \
@@ -329,6 +327,8 @@ typedef enum {
* that is not honored by NMPlatform (netlink code). Instead, it can be used by the upper
* layers which use NMPlatformIPAddress to track addresses that should be configured. */ \
bool a_assume_config_once : 1; \
+ \
+ guint8 plen; \
;
/**
@@ -531,8 +531,7 @@ typedef union {
* it means RTN_UNSPEC otherwise the type value is preserved.
* */ \
guint8 type_coerced; \
- \
- /*end*/
+ ;
typedef struct {
__NMPlatformIPRoute_COMMON;