summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-07-28 09:16:28 +0200
committerThomas Haller <thaller@redhat.com>2020-07-31 08:53:05 +0200
commit7670899d2c73b8072996e57282cfbf119b3e6022 (patch)
treec570def6e61516ec691d700645e9688781431c1f /src
parent63b788dad2f079118d77ba6bf00a89173026cfed (diff)
core: add nm_utils_ip4_address_is_zeronet() helper
Diffstat (limited to 'src')
-rw-r--r--src/nm-core-utils.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/nm-core-utils.h b/src/nm-core-utils.h
index e7211038de..8b5e69916d 100644
--- a/src/nm-core-utils.h
+++ b/src/nm-core-utils.h
@@ -479,6 +479,13 @@ 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);