diff --git a/shared/nm-utils/nm-shared-utils.c b/shared/nm-utils/nm-shared-utils.c index 0109818a19..71b5f96897 100644 --- a/shared/nm-utils/nm-shared-utils.c +++ b/shared/nm-utils/nm-shared-utils.c @@ -32,6 +32,10 @@ const void *const _NM_PTRARRAY_EMPTY[1] = { NULL }; /*****************************************************************************/ +const NMIPAddr nm_ip_addr_zero = { 0 }; + +/*****************************************************************************/ + void nm_utils_strbuf_append_c (char **buf, gsize *len, char c) { diff --git a/shared/nm-utils/nm-shared-utils.h b/shared/nm-utils/nm-shared-utils.h index 065e629b4e..e99127ccf3 100644 --- a/shared/nm-utils/nm-shared-utils.h +++ b/shared/nm-utils/nm-shared-utils.h @@ -22,6 +22,25 @@ #ifndef __NM_SHARED_UTILS_H__ #define __NM_SHARED_UTILS_H__ +#include + +/*****************************************************************************/ + +typedef struct { + union { + guint8 addr_ptr[1]; + in_addr_t addr4; + struct in6_addr addr6; + + /* NMIPAddr is really a union for IP addresses. + * However, as ethernet addresses fit in here nicely, use + * it also for an ethernet MAC address. */ + guint8 addr_eth[6 /*ETH_ALEN*/]; + }; +} NMIPAddr; + +extern const NMIPAddr nm_ip_addr_zero; + /*****************************************************************************/ #define NM_CMP_RETURN(c) \ diff --git a/src/nm-core-utils.c b/src/nm-core-utils.c index 5cb53982e0..88614278f1 100644 --- a/src/nm-core-utils.c +++ b/src/nm-core-utils.c @@ -110,10 +110,6 @@ _nm_utils_set_testing (NMUtilsTestFlags flags) /*****************************************************************************/ -const NMIPAddr nm_ip_addr_zero = NMIPAddrInit; - -/*****************************************************************************/ - static GSList *_singletons = NULL; static gboolean _singletons_shutdown = FALSE; diff --git a/src/nm-core-utils.h b/src/nm-core-utils.h index 9956d96ac3..2561b6ec6b 100644 --- a/src/nm-core-utils.h +++ b/src/nm-core-utils.h @@ -90,25 +90,6 @@ GETTER (void) \ /*****************************************************************************/ -typedef struct { - union { - guint8 addr_ptr[1]; - in_addr_t addr4; - struct in6_addr addr6; - - /* NMIPAddr is really a union for IP addresses. - * However, as ethernet addresses fit in here nicely, use - * it also for an ethernet MAC address. */ - guint8 addr_eth[6 /*ETH_ALEN*/]; - }; -} NMIPAddr; - -extern const NMIPAddr nm_ip_addr_zero; - -#define NMIPAddrInit { .addr6 = IN6ADDR_ANY_INIT } - -/*****************************************************************************/ - guint nm_utils_in6_addr_hash (const struct in6_addr *addr); gboolean nm_ethernet_address_is_valid (gconstpointer addr, gssize len); diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c index 5c952a0b23..003df4e950 100644 --- a/src/platform/nm-linux-platform.c +++ b/src/platform/nm-linux-platform.c @@ -2087,7 +2087,7 @@ _new_from_nl_route (struct nlmsghdr *nlh, gboolean id_only) || tb[RTA_GATEWAY] || tb[RTA_FLOW]) { int ifindex = 0; - NMIPAddr gateway = NMIPAddrInit; + NMIPAddr gateway = { }; if (tb[RTA_OIF]) ifindex = nla_get_u32 (tb[RTA_OIF]);