diff options
author | Lennart Poettering <lennart@poettering.net> | 2017-02-28 12:32:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-28 12:32:18 +0100 |
commit | c3988e728c119369248c890c030bc863ac07bec1 (patch) | |
tree | 9f1373217a4dbf9bde4d29496023c48c7a0db591 /src/test | |
parent | caf49b95b3a6efe9455078098c729d83b08e5206 (diff) | |
parent | d820ef04ab251e8935282e9fe3c379eb7c5b09cc (diff) |
Merge pull request #5438 from ssahani/vxlan-address
networkd: add symlinks for Makefile (netdev and wait-online) , vxlan enhancements.
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test-socket-util.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/test-socket-util.c b/src/test/test-socket-util.c index d80613dc84..8ac1d7989f 100644 --- a/src/test/test-socket-util.c +++ b/src/test/test-socket-util.c @@ -456,6 +456,23 @@ static void test_sockaddr_un_len(void) { assert_se(SOCKADDR_UN_LEN(abstract) == offsetof(struct sockaddr_un, sun_path) + 1 + strlen(abstract.sun_path + 1)); } +static void test_in_addr_is_multicast(void) { + union in_addr_union a, b; + int f; + + assert_se(in_addr_from_string_auto("192.168.3.11", &f, &a) >= 0); + assert_se(in_addr_is_multicast(f, &a) == 0); + + assert_se(in_addr_from_string_auto("224.0.0.1", &f, &a) >= 0); + assert_se(in_addr_is_multicast(f, &a) == 1); + + assert_se(in_addr_from_string_auto("FF01:0:0:0:0:0:0:1", &f, &b) >= 0); + assert_se(in_addr_is_multicast(f, &b) == 1); + + assert_se(in_addr_from_string_auto("2001:db8::c:69b:aeff:fe53:743e", &f, &b) >= 0); + assert_se(in_addr_is_multicast(f, &b) == 0); +} + int main(int argc, char *argv[]) { log_set_max_level(LOG_DEBUG); @@ -482,5 +499,7 @@ int main(int argc, char *argv[]) { test_sockaddr_un_len(); + test_in_addr_is_multicast(); + return 0; } |