summaryrefslogtreecommitdiff
path: root/src/shared/in-addr-util.h
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-10-27 17:38:03 +0100
committerTom Gundersen <teg@jklm.no>2014-10-27 17:40:24 +0100
commitdf40eee8edccb6bf09a57c2b96f69d233032ce52 (patch)
tree3b2c4fbf001cba0b9a5ea0bb6b152899525c25bd /src/shared/in-addr-util.h
parent1dfcee5985e8097fdbe0a77ca31fa23f683fadc2 (diff)
shared: in-addr-utils - add default_subnet_mask and default_prefixlen methods
These use the (deprecated) IPv4 address classes to deduce the corresponding subnet masks. This is useful when addresses without subnet masks and prefix lengths are given. Make use of these new functions from sd-dhcp-lease.
Diffstat (limited to 'src/shared/in-addr-util.h')
-rw-r--r--src/shared/in-addr-util.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/shared/in-addr-util.h b/src/shared/in-addr-util.h
index 0036acee22..8da030ceb6 100644
--- a/src/shared/in-addr-util.h
+++ b/src/shared/in-addr-util.h
@@ -40,6 +40,8 @@ int in_addr_to_string(int family, const union in_addr_union *u, char **ret);
int in_addr_from_string(int family, const char *s, union in_addr_union *ret);
int in_addr_from_string_auto(const char *s, int *family, union in_addr_union *ret);
unsigned in_addr_netmask_to_prefixlen(const struct in_addr *addr);
+int in_addr_default_prefixlen(const struct in_addr *addr, unsigned char *prefixlen);
+int in_addr_default_subnet_mask(const struct in_addr *addr, struct in_addr *mask);
static inline size_t FAMILY_ADDRESS_SIZE(int family) {
assert(family == AF_INET || family == AF_INET6);