summaryrefslogtreecommitdiff
path: root/src/libsystemd-dhcp/sd-dhcp-client.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-01-28 23:23:31 +0100
committerTom Gundersen <teg@jklm.no>2014-01-30 14:30:39 +0100
commit377a218f876507fb8be9c21ef4121fa2576ec317 (patch)
treee5da9ac8c900e9150b752cf0b75f027c748424b5 /src/libsystemd-dhcp/sd-dhcp-client.c
parenteb0ea358b688a6f83ff305c6b825c61f12b6dcb8 (diff)
sd-dhcp-client/net-util: make netmask_to_prefixlen generic
This was originally included in the dhcp-client at my request, but it is not really dhcp-specific and useful outside of it, so let's pull it out.
Diffstat (limited to 'src/libsystemd-dhcp/sd-dhcp-client.c')
-rw-r--r--src/libsystemd-dhcp/sd-dhcp-client.c15
1 files changed, 0 insertions, 15 deletions
diff --git a/src/libsystemd-dhcp/sd-dhcp-client.c b/src/libsystemd-dhcp/sd-dhcp-client.c
index 3b7b9f4ccd..7e5c36a857 100644
--- a/src/libsystemd-dhcp/sd-dhcp-client.c
+++ b/src/libsystemd-dhcp/sd-dhcp-client.c
@@ -240,21 +240,6 @@ int sd_dhcp_client_get_hostname(sd_dhcp_client *client, const char **hostname) {
return 0;
}
-int sd_dhcp_client_prefixlen(const struct in_addr *addr) {
- int len = 0;
- uint32_t mask;
-
- assert_return(addr, -EADDRNOTAVAIL);
-
- mask = be32toh(addr->s_addr);
- while (mask) {
- len++;
- mask = mask << 1;
- }
-
- return len;
-}
-
int sd_dhcp_client_get_router(sd_dhcp_client *client, struct in_addr *addr) {
assert_return(client, -EINVAL);
assert_return(addr, -EINVAL);