diff options
author | Thomas Haller <thaller@redhat.com> | 2021-03-04 09:48:33 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2021-03-04 12:49:33 +0100 |
commit | 4f626972a4b6e386147dfa197f9d599c2e82fec0 (patch) | |
tree | c889c39f922cd6e5e6b88abc1a4111bce2ec7743 | |
parent | ee78434afb9a8a4c338d0745c92d0b505bc2a0e9 (diff) | |
download | NetworkManager-4f626972a4b6e386147dfa197f9d599c2e82fec0.tar.gz |
glib-aux: move nm_utils_ip4_address_is_{zeronet,link_local}()
-rw-r--r-- | src/core/nm-core-utils.h | 18 | ||||
-rw-r--r-- | src/libnm-glib-aux/nm-shared-utils.h | 18 |
2 files changed, 18 insertions, 18 deletions
diff --git a/src/core/nm-core-utils.h b/src/core/nm-core-utils.h index aeb28a5393..92ccb341fe 100644 --- a/src/core/nm-core-utils.h +++ b/src/core/nm-core-utils.h @@ -400,24 +400,6 @@ guint32 nm_utils_lifetime_get(guint32 timestamp, /*****************************************************************************/ -#define NM_IPV4LL_NETWORK ((in_addr_t)(htonl(0xA9FE0000lu))) -#define NM_IPV4LL_NETMASK ((in_addr_t)(htonl(0xFFFF0000lu))) - -static inline gboolean -nm_utils_ip4_address_is_link_local(in_addr_t addr) -{ - return (addr & NM_IPV4LL_NETMASK) == NM_IPV4LL_NETWORK; -} - -static inline gboolean -nm_utils_ip4_address_is_zeronet(in_addr_t network) -{ - /* Same as ipv4_is_zeronet() from kernel's include/linux/in.h. */ - return (network & htonl(0xFF000000u)) == htonl(0x00000000u); -} - -/*****************************************************************************/ - const char *nm_utils_dnsmasq_status_to_string(int status, char *dest, gsize size); void nm_utils_get_reverse_dns_domains_ip_4(guint32 ip, guint8 plen, GPtrArray *domains); diff --git a/src/libnm-glib-aux/nm-shared-utils.h b/src/libnm-glib-aux/nm-shared-utils.h index ced3e6e08c..2c4381fd32 100644 --- a/src/libnm-glib-aux/nm-shared-utils.h +++ b/src/libnm-glib-aux/nm-shared-utils.h @@ -422,6 +422,24 @@ nm_utils_ip_address_same_prefix(int addr_family, /*****************************************************************************/ +#define NM_IPV4LL_NETWORK ((in_addr_t)(htonl(0xA9FE0000lu))) +#define NM_IPV4LL_NETMASK ((in_addr_t)(htonl(0xFFFF0000lu))) + +static inline gboolean +nm_utils_ip4_address_is_link_local(in_addr_t addr) +{ + return (addr & NM_IPV4LL_NETMASK) == NM_IPV4LL_NETWORK; +} + +static inline gboolean +nm_utils_ip4_address_is_zeronet(in_addr_t network) +{ + /* Same as ipv4_is_zeronet() from kernel's include/linux/in.h. */ + return (network & htonl(0xFF000000u)) == htonl(0x00000000u); +} + +/*****************************************************************************/ + #define NM_UTILS_INET_ADDRSTRLEN INET6_ADDRSTRLEN static inline const char * |