mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-10 08:10:22 +01:00
glib-aux: move nm_utils_ip4_address_is_{zeronet,link_local}()
This commit is contained in:
parent
57735e1e8e
commit
2ce9cf3e20
2 changed files with 18 additions and 18 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 *
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue