summaryrefslogtreecommitdiff
path: root/src/basic
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-02-28 12:32:18 +0100
committerGitHub <noreply@github.com>2017-02-28 12:32:18 +0100
commitc3988e728c119369248c890c030bc863ac07bec1 (patch)
tree9f1373217a4dbf9bde4d29496023c48c7a0db591 /src/basic
parentcaf49b95b3a6efe9455078098c729d83b08e5206 (diff)
parentd820ef04ab251e8935282e9fe3c379eb7c5b09cc (diff)
Merge pull request #5438 from ssahani/vxlan-address
networkd: add symlinks for Makefile (netdev and wait-online) , vxlan enhancements.
Diffstat (limited to 'src/basic')
-rw-r--r--src/basic/in-addr-util.c12
-rw-r--r--src/basic/in-addr-util.h2
2 files changed, 14 insertions, 0 deletions
diff --git a/src/basic/in-addr-util.c b/src/basic/in-addr-util.c
index 3b06cb00ad..3927df2955 100644
--- a/src/basic/in-addr-util.c
+++ b/src/basic/in-addr-util.c
@@ -66,6 +66,18 @@ int in_addr_is_link_local(int family, const union in_addr_union *u) {
return -EAFNOSUPPORT;
}
+int in_addr_is_multicast(int family, const union in_addr_union *u) {
+ assert(u);
+
+ if (family == AF_INET)
+ return IN_MULTICAST(be32toh(u->in.s_addr));
+
+ if (family == AF_INET6)
+ return IN6_IS_ADDR_MULTICAST(&u->in6);
+
+ return -EAFNOSUPPORT;
+}
+
bool in4_addr_is_localhost(const struct in_addr *a) {
assert(a);
diff --git a/src/basic/in-addr-util.h b/src/basic/in-addr-util.h
index 64a812c322..51a5aa67e4 100644
--- a/src/basic/in-addr-util.h
+++ b/src/basic/in-addr-util.h
@@ -39,6 +39,8 @@ struct in_addr_data {
bool in4_addr_is_null(const struct in_addr *a);
int in_addr_is_null(int family, const union in_addr_union *u);
+int in_addr_is_multicast(int family, const union in_addr_union *u);
+
bool in4_addr_is_link_local(const struct in_addr *a);
int in_addr_is_link_local(int family, const union in_addr_union *u);