shared: add NMIPAddr struct
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
@@ -22,6 +22,25 @@
|
||||
#ifndef __NM_SHARED_UTILS_H__
|
||||
#define __NM_SHARED_UTILS_H__
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
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) \
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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]);
|
||||
|
Reference in New Issue
Block a user