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.
This commit is contained in:
Thomas Haller 2021-09-10 13:43:34 +02:00
parent 3a6b3e35da
commit 9ec9a92f17
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -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;