glib-aux: add NM_IN6ADDR_INIT() macro and use it

This commit is contained in:
Thomas Haller 2022-09-08 08:35:41 +02:00
parent 03bf4a3425
commit c413d7c657
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
2 changed files with 26 additions and 1 deletions

View file

@ -25,6 +25,30 @@ typedef struct _NMIPAddr {
.array = { 0 } \
}
#define _NM_IN6ADDR_INIT(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, aa, ab, ac, ad, ae, af) \
{ \
.s6_addr = { \
(a0), \
(a1), \
(a2), \
(a3), \
(a4), \
(a5), \
(a6), \
(a7), \
(a8), \
(a9), \
(aa), \
(ab), \
(ac), \
(ad), \
(ae), \
(af), \
} \
}
#define NM_IN6ADDR_INIT(...) ((struct in6_addr) _NM_IN6ADDR_INIT(__VA_ARGS__))
extern const NMIPAddr nm_ip_addr_zero;
/* This doesn't really belong here, but since it's convenient to re-use nm_ip_addr_zero.ether_addr

View file

@ -4853,7 +4853,8 @@ nm_platform_ip_route_get_prune_list(NMPlatform *self,
.table_coerced = nm_platform_route_table_coerce(local_table),
.rt_pref = NM_ICMPV6_ROUTER_PREF_MEDIUM,
.gateway = IN6ADDR_ANY_INIT,
.network = {{{0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}},
.network =
NM_IN6ADDR_INIT(0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
};
}