summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-07-10 21:01:25 +0200
committerLennart Poettering <lennart@poettering.net>2014-07-10 21:01:25 +0200
commite80af1bdddbc7a51191e29b0c841e8dcafe7b1cc (patch)
tree5d5a8fdf839a667a3c2e5f0862341e41bb455135 /src/shared
parent947127ff6230b44623afec3e6aacc85f54168db2 (diff)
nss-myhostname: move local address listing logic into shared, so that we can make use of it from machined
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/socket-util.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/shared/socket-util.h b/src/shared/socket-util.h
index 25c4a7e4f9..8d521ae1a0 100644
--- a/src/shared/socket-util.h
+++ b/src/shared/socket-util.h
@@ -118,3 +118,8 @@ int in_addr_prefix_intersect(unsigned family, const union in_addr_union *a, unsi
int in_addr_prefix_next(unsigned family, union in_addr_union *u, unsigned prefixlen);
int in_addr_to_string(unsigned family, const union in_addr_union *u, char **ret);
int in_addr_from_string(unsigned family, const char *s, union in_addr_union *ret);
+
+static inline size_t PROTO_ADDRESS_SIZE(int proto) {
+ assert(proto == AF_INET || proto == AF_INET6);
+ return proto == AF_INET6 ? 16 : 4;
+}