summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2022-05-09 15:22:45 +0200
committerThomas Haller <thaller@redhat.com>2022-05-11 17:06:12 +0200
commitfd4ddd8d40fade2c3b87e4e617c593afc0bffae0 (patch)
tree599cd10c0e4c08c15330a7ece5300e5663c4e28b
parenta34bad8b520d85281e583e81be74129b08e20d77 (diff)
platform: reorder fields in __NMPlatformIPRoute_COMMON for tight packing
-rw-r--r--src/libnm-platform/nm-platform.h89
1 files changed, 44 insertions, 45 deletions
diff --git a/src/libnm-platform/nm-platform.h b/src/libnm-platform/nm-platform.h
index b19b933f2a..a4cba9ced8 100644
--- a/src/libnm-platform/nm-platform.h
+++ b/src/libnm-platform/nm-platform.h
@@ -430,6 +430,47 @@ typedef union {
#define __NMPlatformIPRoute_COMMON \
__NMPlatformObjWithIfindex_COMMON; \
\
+ /* rtnh_flags
+ *
+ * Routes with rtm_flags RTM_F_CLONED are hidden by platform and
+ * do not exist from the point-of-view of platform users.
+ * Such a route is not alive, according to nmp_object_is_alive().
+ *
+ * NOTE: currently we ignore all flags except RTM_F_CLONED
+ * and RTNH_F_ONLINK.
+ * We also may not properly consider the flags as part of the ID
+ * in route-cmp. */ \
+ unsigned r_rtm_flags; \
+ \
+ /* RTA_METRICS.RTAX_ADVMSS (iproute2: advmss) */ \
+ guint32 mss; \
+ \
+ /* RTA_METRICS.RTAX_WINDOW (iproute2: window) */ \
+ guint32 window; \
+ \
+ /* RTA_METRICS.RTAX_CWND (iproute2: cwnd) */ \
+ guint32 cwnd; \
+ \
+ /* RTA_METRICS.RTAX_INITCWND (iproute2: initcwnd) */ \
+ guint32 initcwnd; \
+ \
+ /* RTA_METRICS.RTAX_INITRWND (iproute2: initrwnd) */ \
+ guint32 initrwnd; \
+ \
+ /* RTA_METRICS.RTAX_MTU (iproute2: mtu) */ \
+ guint32 mtu; \
+ \
+ /* RTA_PRIORITY (iproute2: metric)
+ * If "metric_any" is %TRUE, then this is interpreted as an offset that will be
+ * added to a default base metric. In such cases, the offset is usually zero. */ \
+ guint32 metric; \
+ \
+ /* rtm_table, RTA_TABLE.
+ *
+ * This is not the original table ID. Instead, 254 (RT_TABLE_MAIN) and
+ * zero (RT_TABLE_UNSPEC) are swapped, so that the default is the main
+ * table. Use nm_platform_route_table_coerce()/nm_platform_route_table_uncoerce(). */ \
+ guint32 table_coerced; \
/* The NMIPConfigSource. For routes that we receive from cache this corresponds
* to the rtm_protocol field (and is one of the NM_IP_CONFIG_SOURCE_RTPROT_* values).
* When adding a route, the source will be coerced to the protocol using
@@ -444,8 +485,6 @@ typedef union {
* to zero, in which case the first matching route (with proto ignored) is deleted. */ \
NMIPConfigSource rt_source; \
\
- guint8 plen; \
- \
/* RTA_METRICS:
*
* For IPv4 routes, these properties are part of their
@@ -484,57 +523,17 @@ typedef union {
/* Whether the route should be committed even if it was removed externally. */ \
bool r_force_commit : 1; \
\
- /* rtnh_flags
- *
- * Routes with rtm_flags RTM_F_CLONED are hidden by platform and
- * do not exist from the point-of-view of platform users.
- * Such a route is not alive, according to nmp_object_is_alive().
- *
- * NOTE: currently we ignore all flags except RTM_F_CLONED
- * and RTNH_F_ONLINK.
- * We also may not properly consider the flags as part of the ID
- * in route-cmp. */ \
- unsigned r_rtm_flags; \
- \
- /* RTA_METRICS.RTAX_ADVMSS (iproute2: advmss) */ \
- guint32 mss; \
- \
- /* RTA_METRICS.RTAX_WINDOW (iproute2: window) */ \
- guint32 window; \
- \
- /* RTA_METRICS.RTAX_CWND (iproute2: cwnd) */ \
- guint32 cwnd; \
- \
- /* RTA_METRICS.RTAX_INITCWND (iproute2: initcwnd) */ \
- guint32 initcwnd; \
- \
- /* RTA_METRICS.RTAX_INITRWND (iproute2: initrwnd) */ \
- guint32 initrwnd; \
- \
- /* RTA_METRICS.RTAX_MTU (iproute2: mtu) */ \
- guint32 mtu; \
- \
- /* RTA_PRIORITY (iproute2: metric)
- * If "metric_any" is %TRUE, then this is interpreted as an offset that will be
- * added to a default base metric. In such cases, the offset is usually zero. */ \
- guint32 metric; \
- \
- /* rtm_table, RTA_TABLE.
- *
- * This is not the original table ID. Instead, 254 (RT_TABLE_MAIN) and
- * zero (RT_TABLE_UNSPEC) are swapped, so that the default is the main
- * table. Use nm_platform_route_table_coerce()/nm_platform_route_table_uncoerce(). */ \
- guint32 table_coerced; \
- \
/* rtm_type.
*
* This is not the original type, if type_coerced is 0 then
* it means RTN_UNSPEC otherwise the type value is preserved.
*/ \
+ guint8 type_coerced; \
+ \
/* Don't have a bitfield as last field in __NMPlatformIPAddress_COMMON. It would then
* be unclear how the following fields get merged. We could also use a zero bitfield,
* but instead we just have there the uint8 field. */ \
- guint8 type_coerced; \
+ guint8 plen; \
;
typedef struct {