summaryrefslogtreecommitdiff
path: root/libnm-util
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-09-05 15:25:34 +0200
committerThomas Haller <thaller@redhat.com>2017-09-05 18:44:04 +0200
commit5c42cdb287c3aa3f48b7ddeefb578a4557c1252b (patch)
treec1d010ff58731c06315d5789f84f4f4fcba8a6d8 /libnm-util
parent7319fdd74a8d4d2a5ee6f097a956509dfa6c0c96 (diff)
downloadNetworkManager-5c42cdb287c3aa3f48b7ddeefb578a4557c1252b.tar.gz
all: use _nm_utils_ip4_*() utils functions
Diffstat (limited to 'libnm-util')
-rw-r--r--libnm-util/nm-utils.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/libnm-util/nm-utils.c b/libnm-util/nm-utils.c
index 04deecf986..fba87c5a79 100644
--- a/libnm-util/nm-utils.c
+++ b/libnm-util/nm-utils.c
@@ -1102,7 +1102,7 @@ nm_utils_ip4_netmask_to_prefix (guint32 netmask)
guint32
nm_utils_ip4_prefix_to_netmask (guint32 prefix)
{
- return prefix < 32 ? ~htonl(0xFFFFFFFF >> prefix) : 0xFFFFFFFF;
+ return _nm_utils_ip4_prefix_to_netmask (prefix);
}
@@ -1121,12 +1121,7 @@ nm_utils_ip4_prefix_to_netmask (guint32 prefix)
guint32
nm_utils_ip4_get_default_prefix (guint32 ip)
{
- if (((ntohl (ip) & 0xFF000000) >> 24) <= 127)
- return 8; /* Class A - 255.0.0.0 */
- else if (((ntohl (ip) & 0xFF000000) >> 24) <= 191)
- return 16; /* Class B - 255.255.0.0 */
-
- return 24; /* Class C - 255.255.255.0 */
+ return _nm_utils_ip4_get_default_prefix (ip);
}
/**