[systemd-commits] 8 commits - .gitignore Makefile.am src/libsystemd src/network src/test
Tom Gundersen
tomegun at kemper.freedesktop.org
Mon Jun 16 11:38:28 PDT 2014
.gitignore | 2
Makefile.am | 17 +++
src/libsystemd/sd-rtnl/rtnl-types.c | 21 ++++
src/network/networkd-link.c | 26 ++++
src/network/networkd-netdev-gperf.gperf | 13 +-
src/network/networkd-netdev.c | 36 +++++-
src/network/networkd-network-gperf.gperf | 1
src/network/networkd-network.c | 19 +++
src/network/networkd-tunnel.c | 24 ++--
src/network/networkd-vxlan.c | 162 +++++++++++++++++++++++++++++++
src/network/networkd.h | 15 ++
src/test/test-fdset.c | 114 +++++++++++++++++++++
src/test/test-hashmap.c | 88 ++++++++++++++++
src/test/test-socket-util.c | 145 +++++++++++++++++++++++++++
src/test/test-util.c | 2
15 files changed, 655 insertions(+), 30 deletions(-)
New commits:
commit 40edd23670f977f9a7f12b372733a3668ec174d0
Author: Ronny Chevalier <chevalier.ronny at gmail.com>
Date: Sun Jun 15 22:47:49 2014 +0200
tests: unlink temp file used in test
diff --git a/src/test/test-util.c b/src/test/test-util.c
index 2b46699..35dd63f 100644
--- a/src/test/test-util.c
+++ b/src/test/test-util.c
@@ -654,6 +654,8 @@ static void test_writing_tmpfile(void) {
assert(r == 0);
printf("contents: %s", contents);
assert(streq(contents, "abc\n" ALPHANUMERICAL "\n"));
+
+ unlink(name);
}
static void test_hexdump(void) {
commit d06b3a9d70c6dee3371818931328e19876cc3259
Author: Ronny Chevalier <chevalier.ronny at gmail.com>
Date: Sun Jun 15 22:46:05 2014 +0200
tests: add tests to test-hashmap
add tests for:
- hashmap_remove_and_put
- hashmap_first_key
- hashmap_last
- hashmap_steal_first_key
- hashmap_clear_free_free
diff --git a/src/test/test-hashmap.c b/src/test/test-hashmap.c
index 56a9b58..ccef61f 100644
--- a/src/test/test-hashmap.c
+++ b/src/test/test-hashmap.c
@@ -231,6 +231,32 @@ static void test_hashmap_put(void) {
hashmap_free(m);
}
+static void test_hashmap_remove_and_put(void) {
+ _cleanup_hashmap_free_ Hashmap *m = NULL;
+ int valid;
+ char *r;
+
+ m = hashmap_new(string_hash_func, string_compare_func);
+ assert_se(m);
+
+ valid = hashmap_remove_and_put(m, "unvalid key", "new key", NULL);
+ assert_se(valid < 0);
+
+ valid = hashmap_put(m, "key 1", (void*) (const char *) "val 1");
+ assert_se(valid == 1);
+ valid = hashmap_remove_and_put(m, "key 1", "key 2", (void*) (const char *) "val 2");
+ assert_se(valid == 0);
+
+ r = hashmap_get(m, "key 2");
+ assert_se(streq(r, "val 2"));
+ assert_se(!hashmap_get(m, "key 1"));
+
+ valid = hashmap_put(m, "key 3", (void*) (const char *) "val 3");
+ assert_se(valid == 1);
+ valid = hashmap_remove_and_put(m, "key 3", "key 2", (void*) (const char *) "val 2");
+ assert_se(valid < 0);
+}
+
static void test_hashmap_ensure_allocated(void) {
Hashmap *m;
int valid_hashmap;
@@ -491,6 +517,63 @@ static void test_hashmap_many(void) {
hashmap_free(h);
}
+static void test_hashmap_first_key(void) {
+ _cleanup_hashmap_free_ Hashmap *m = NULL;
+
+ m = hashmap_new(string_hash_func, string_compare_func);
+ assert_se(m);
+
+ assert_se(!hashmap_first_key(m));
+ assert_se(hashmap_put(m, "key 1", NULL) == 1);
+ assert_se(streq(hashmap_first_key(m), "key 1"));
+ assert_se(hashmap_put(m, "key 2", NULL) == 1);
+ assert_se(streq(hashmap_first_key(m), "key 1"));
+ assert_se(hashmap_remove(m, "key 1") == NULL);
+ assert_se(streq(hashmap_first_key(m), "key 2"));
+}
+
+static void test_hashmap_last(void) {
+ _cleanup_hashmap_free_ Hashmap *m = NULL;
+
+ m = hashmap_new(string_hash_func, string_compare_func);
+ assert_se(m);
+
+ assert_se(!hashmap_last(m));
+ assert_se(hashmap_put(m, "key 1", (void *) (const char *) "val 1") == 1);
+ assert_se(streq(hashmap_last(m), "val 1"));
+ assert_se(hashmap_put(m, "key 2", (void *) (const char *) "bar") == 1);
+ assert_se(streq(hashmap_last(m), "bar"));
+ assert_se(hashmap_remove(m, "key 2"));
+ assert_se(streq(hashmap_last(m), "val 1"));
+}
+
+static void test_hashmap_steal_first_key(void) {
+ _cleanup_hashmap_free_ Hashmap *m = NULL;
+
+ m = hashmap_new(string_hash_func, string_compare_func);
+ assert_se(m);
+
+ assert_se(!hashmap_steal_first_key(m));
+ assert_se(hashmap_put(m, "key 1", NULL) == 1);
+ assert_se(streq(hashmap_steal_first_key(m), "key 1"));
+
+ assert_se(hashmap_isempty(m));
+}
+
+static void test_hashmap_clear_free_free(void) {
+ _cleanup_hashmap_free_ Hashmap *m = NULL;
+
+ m = hashmap_new(string_hash_func, string_compare_func);
+ assert_se(m);
+
+ assert_se(hashmap_put(m, strdup("key 1"), NULL) == 1);
+ assert_se(hashmap_put(m, strdup("key 2"), NULL) == 1);
+ assert_se(hashmap_put(m, strdup("key 3"), NULL) == 1);
+
+ hashmap_clear_free_free(m);
+ assert_se(hashmap_isempty(m));
+}
+
static void test_uint64_compare_func(void) {
const uint64_t a = 0x100, b = 0x101;
@@ -518,6 +601,7 @@ int main(int argc, const char *argv[]) {
test_hashmap_replace();
test_hashmap_update();
test_hashmap_put();
+ test_hashmap_remove_and_put();
test_hashmap_ensure_allocated();
test_hashmap_foreach();
test_hashmap_foreach_backwards();
@@ -528,6 +612,10 @@ int main(int argc, const char *argv[]) {
test_hashmap_get();
test_hashmap_size();
test_hashmap_many();
+ test_hashmap_first_key();
+ test_hashmap_last();
+ test_hashmap_steal_first_key();
+ test_hashmap_clear_free_free();
test_uint64_compare_func();
test_trivial_compare_func();
test_string_compare_func();
commit 106ecd769d57116ad81efdea2c27557fba062138
Author: Ronny Chevalier <chevalier.ronny at gmail.com>
Date: Sat Jun 14 22:10:45 2014 +0200
tests: add test-fdset
diff --git a/.gitignore b/.gitignore
index f7127bd..97cefb5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -148,6 +148,7 @@
/test-engine
/test-env-replace
/test-event
+/test-fdset
/test-fileio
/test-hashmap
/test-hostname
diff --git a/Makefile.am b/Makefile.am
index cb43ddb..a9e07b4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1234,7 +1234,8 @@ tests += \
test-device-nodes \
test-xml \
test-architecture \
- test-socket-util
+ test-socket-util \
+ test-fdset
EXTRA_DIST += \
test/sched_idle_bad.service \
@@ -1338,6 +1339,12 @@ test_utf8_SOURCES = \
test_utf8_LDADD = \
libsystemd-shared.la
+test_fdset_SOURCES = \
+ src/test/test-fdset.c
+
+test_fdset_LDADD = \
+ libsystemd-core.la
+
test_util_SOURCES = \
src/test/test-util.c
diff --git a/src/test/test-fdset.c b/src/test/test-fdset.c
new file mode 100644
index 0000000..ed83ee1
--- /dev/null
+++ b/src/test/test-fdset.c
@@ -0,0 +1,114 @@
+/***
+ This file is part of systemd
+
+ Copyright 2014 Ronny Chevalier
+
+ systemd is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ systemd is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <fcntl.h>
+#include <unistd.h>
+
+#include "fdset.h"
+#include "util.h"
+#include "macro.h"
+
+static void test_fdset_new_fill(void) {
+ int fd = -1;
+ _cleanup_fdset_free_ FDSet *fdset = NULL;
+ char name[] = "/tmp/test-fdset_new_fill.XXXXXX";
+
+ fd = mkostemp_safe(name, O_RDWR|O_CLOEXEC);
+ assert_se(fd >= 0);
+ assert_se(fdset_new_fill(&fdset) >= 0);
+ assert_se(fdset_contains(fdset, fd));
+
+ unlink(name);
+}
+
+static void test_fdset_put_dup(void) {
+ _cleanup_close_ int fd = -1;
+ int copyfd = -1;
+ _cleanup_fdset_free_ FDSet *fdset = NULL;
+ char name[] = "/tmp/test-fdset_put_dup.XXXXXX";
+
+ fd = mkostemp_safe(name, O_RDWR|O_CLOEXEC);
+ assert_se(fd >= 0);
+
+ fdset = fdset_new();
+ assert_se(fdset);
+ copyfd = fdset_put_dup(fdset, fd);
+ assert_se(copyfd >= 0 && copyfd != fd);
+ assert_se(fdset_contains(fdset, copyfd));
+ assert_se(!fdset_contains(fdset, fd));
+
+ unlink(name);
+}
+
+static void test_fdset_cloexec(void) {
+ int fd = -1;
+ _cleanup_fdset_free_ FDSet *fdset = NULL;
+ int flags = -1;
+ char name[] = "/tmp/test-fdset_cloexec.XXXXXX";
+
+ fd = mkostemp_safe(name, O_RDWR|O_CLOEXEC);
+ assert_se(fd >= 0);
+
+ fdset = fdset_new();
+ assert_se(fdset);
+ assert_se(fdset_put(fdset, fd));
+
+ assert_se(fdset_cloexec(fdset, false) >= 0);
+ flags = fcntl(fd, F_GETFD);
+ assert_se(flags >= 0);
+ assert_se(!(flags & FD_CLOEXEC));
+
+ assert_se(fdset_cloexec(fdset, true) >= 0);
+ flags = fcntl(fd, F_GETFD);
+ assert_se(flags >= 0);
+ assert_se(flags & FD_CLOEXEC);
+
+ unlink(name);
+}
+
+static void test_fdset_close_others(void) {
+ int fd = -1;
+ int copyfd = -1;
+ _cleanup_fdset_free_ FDSet *fdset = NULL;
+ int flags = -1;
+ char name[] = "/tmp/test-fdset_close_others.XXXXXX";
+
+ fd = mkostemp_safe(name, O_RDWR|O_CLOEXEC);
+ assert_se(fd >= 0);
+
+ fdset = fdset_new();
+ assert_se(fdset);
+ copyfd = fdset_put_dup(fdset, fd);
+ assert_se(copyfd >= 0);
+
+ assert_se(fdset_close_others(fdset) >= 0);
+ flags = fcntl(fd, F_GETFD);
+ assert_se(flags < 0);
+ flags = fcntl(copyfd, F_GETFD);
+ assert_se(flags >= 0);
+
+ unlink(name);
+}
+
+int main(int argc, char *argv[]) {
+ test_fdset_new_fill();
+ test_fdset_put_dup();
+ test_fdset_cloexec();
+ test_fdset_close_others();
+}
commit c182135d3af7a662739d16353e3cc630199aac24
Author: Ronny Chevalier <chevalier.ronny at gmail.com>
Date: Sat Jun 14 22:10:44 2014 +0200
tests: add test-socket-util
diff --git a/.gitignore b/.gitignore
index ed29762..f7127bd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -189,6 +189,7 @@
/test-rtnl
/test-sched-prio
/test-sleep
+/test-socket-util
/test-ssd
/test-strbuf
/test-strip-tab-ansi
diff --git a/Makefile.am b/Makefile.am
index 479f7e2..cb43ddb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1233,7 +1233,8 @@ tests += \
test-tables \
test-device-nodes \
test-xml \
- test-architecture
+ test-architecture \
+ test-socket-util
EXTRA_DIST += \
test/sched_idle_bad.service \
@@ -1343,6 +1344,12 @@ test_util_SOURCES = \
test_util_LDADD = \
libsystemd-core.la
+test_socket_util_SOURCES = \
+ src/test/test-socket-util.c
+
+test_socket_util_LDADD = \
+ libsystemd-core.la
+
test_ring_SOURCES = \
src/test/test-ring.c
diff --git a/src/test/test-socket-util.c b/src/test/test-socket-util.c
new file mode 100644
index 0000000..716efd8
--- /dev/null
+++ b/src/test/test-socket-util.c
@@ -0,0 +1,145 @@
+/***
+ This file is part of systemd
+
+ Copyright 2014 Ronny Chevalier
+
+ systemd is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ systemd is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include "socket-util.h"
+#include "util.h"
+#include "macro.h"
+
+static void test_socket_address_parse(void) {
+ SocketAddress a;
+
+ assert_se(socket_address_parse(&a, "junk") < 0);
+ assert_se(socket_address_parse(&a, "192.168.1.1") < 0);
+ assert_se(socket_address_parse(&a, ".168.1.1") < 0);
+ assert_se(socket_address_parse(&a, "989.168.1.1") < 0);
+ assert_se(socket_address_parse(&a, "192.168.1.1:65536") < 0);
+ assert_se(socket_address_parse(&a, "192.168.1.1:0") < 0);
+ assert_se(socket_address_parse(&a, "0") < 0);
+ assert_se(socket_address_parse(&a, "65536") < 0);
+
+ assert_se(socket_address_parse(&a, "65535") >= 0);
+
+ if (socket_ipv6_is_supported()) {
+ assert_se(socket_address_parse(&a, "[::1]") < 0);
+ assert_se(socket_address_parse(&a, "[::1]8888") < 0);
+ assert_se(socket_address_parse(&a, "::1") < 0);
+ assert_se(socket_address_parse(&a, "[::1]:0") < 0);
+ assert_se(socket_address_parse(&a, "[::1]:65536") < 0);
+ assert_se(socket_address_parse(&a, "[a:b:1]:8888") < 0);
+
+ assert_se(socket_address_parse(&a, "8888") >= 0);
+ assert_se(a.sockaddr.sa.sa_family == AF_INET6);
+
+ assert_se(socket_address_parse(&a, "[2001:0db8:0000:85a3:0000:0000:ac1f:8001]:8888") >= 0);
+ assert_se(a.sockaddr.sa.sa_family == AF_INET6);
+
+ assert_se(socket_address_parse(&a, "[::1]:8888") >= 0);
+ assert_se(a.sockaddr.sa.sa_family == AF_INET6);
+ } else {
+ assert_se(socket_address_parse(&a, "[::1]:8888") < 0);
+
+ assert_se(socket_address_parse(&a, "8888") >= 0);
+ assert_se(a.sockaddr.sa.sa_family == AF_INET);
+ }
+
+ assert_se(socket_address_parse(&a, "192.168.1.254:8888") >= 0);
+ assert_se(a.sockaddr.sa.sa_family == AF_INET);
+
+ assert_se(socket_address_parse(&a, "/foo/bar") >= 0);
+ assert_se(a.sockaddr.sa.sa_family == AF_UNIX);
+
+ assert_se(socket_address_parse(&a, "@abstract") >= 0);
+ assert_se(a.sockaddr.sa.sa_family == AF_UNIX);
+}
+
+static void test_socket_address_parse_netlink(void) {
+ SocketAddress a;
+
+ assert_se(socket_address_parse_netlink(&a, "junk") < 0);
+ assert_se(socket_address_parse_netlink(&a, "") < 0);
+
+ assert_se(socket_address_parse_netlink(&a, "route") >= 0);
+ assert_se(socket_address_parse_netlink(&a, "route 10") >= 0);
+ assert_se(a.sockaddr.sa.sa_family == AF_NETLINK);
+ assert_se(a.protocol == NETLINK_ROUTE);
+}
+
+static void test_socket_address_equal(void) {
+ SocketAddress a;
+ SocketAddress b;
+
+ assert_se(socket_address_parse(&a, "192.168.1.1:8888") >= 0);
+ assert_se(socket_address_parse(&b, "192.168.1.1:888") >= 0);
+ assert_se(!socket_address_equal(&a, &b));
+
+ assert_se(socket_address_parse(&a, "192.168.1.1:8888") >= 0);
+ assert_se(socket_address_parse(&b, "192.16.1.1:8888") >= 0);
+ assert_se(!socket_address_equal(&a, &b));
+
+ assert_se(socket_address_parse(&a, "192.168.1.1:8888") >= 0);
+ assert_se(socket_address_parse(&b, "8888") >= 0);
+ assert_se(!socket_address_equal(&a, &b));
+
+ assert_se(socket_address_parse(&a, "192.168.1.1:8888") >= 0);
+ assert_se(socket_address_parse(&b, "/foo/bar/") >= 0);
+ assert_se(!socket_address_equal(&a, &b));
+
+ assert_se(socket_address_parse(&a, "192.168.1.1:8888") >= 0);
+ assert_se(socket_address_parse(&b, "192.168.1.1:8888") >= 0);
+ assert_se(socket_address_equal(&a, &b));
+
+ assert_se(socket_address_parse(&a, "/foo/bar") >= 0);
+ assert_se(socket_address_parse(&b, "/foo/bar") >= 0);
+ assert_se(socket_address_equal(&a, &b));
+
+ assert_se(socket_address_parse(&a, "[::1]:8888") >= 0);
+ assert_se(socket_address_parse(&b, "[::1]:8888") >= 0);
+ assert_se(socket_address_equal(&a, &b));
+
+ assert_se(socket_address_parse(&a, "@abstract") >= 0);
+ assert_se(socket_address_parse(&b, "@abstract") >= 0);
+ assert_se(socket_address_equal(&a, &b));
+
+ assert_se(socket_address_parse_netlink(&a, "firewall") >= 0);
+ assert_se(socket_address_parse_netlink(&b, "firewall") >= 0);
+ assert_se(socket_address_equal(&a, &b));
+}
+
+static void test_socket_address_get_path(void) {
+ SocketAddress a;
+
+ assert_se(socket_address_parse(&a, "192.168.1.1:8888") >= 0);
+ assert_se(!socket_address_get_path(&a));
+
+ assert_se(socket_address_parse(&a, "@abstract") >= 0);
+ assert_se(!socket_address_get_path(&a));
+
+ assert_se(socket_address_parse(&a, "[::1]:8888") >= 0);
+ assert_se(!socket_address_get_path(&a));
+
+ assert_se(socket_address_parse(&a, "/foo/bar") >= 0);
+ assert_se(streq(socket_address_get_path(&a), "/foo/bar"));
+}
+
+int main(int argc, char *argv[]) {
+ test_socket_address_parse();
+ test_socket_address_parse_netlink();
+ test_socket_address_equal();
+ test_socket_address_get_path();
+}
commit 889a044ddc554882923a3c05870c050e010b50dc
Author: Susant Sahani <susant at redhat.com>
Date: Mon Jun 16 11:54:34 2014 +0530
networkd: unref tunnel
Unref tunnel while shutting down
diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c
index 45c1ab0..8e7cdf6 100644
--- a/src/network/networkd-network.c
+++ b/src/network/networkd-network.c
@@ -179,6 +179,8 @@ void network_free(Network *network) {
netdev_unref(network->bond);
+ netdev_unref(network->tunnel);
+
HASHMAP_FOREACH(netdev, network->vlans, i)
netdev_unref(netdev);
hashmap_free(network->vlans);
commit 326cb4061a7d6ec4107f298b6f947d645512ad76
Author: Susant Sahani <susant at redhat.com>
Date: Mon Jun 16 11:54:33 2014 +0530
networkd: introduce vxlan
This patch enables netwokd to create vxlan
Changes:
Added:
1. File networkd networkd-vxlan.c
2. to netdev
bool learning
struct in_addr group
uint64_t vxlanid;
3. VXLAN subsection and config
parameters
diff --git a/Makefile.am b/Makefile.am
index ec5f04d..479f7e2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4358,6 +4358,7 @@ libsystemd_networkd_core_la_SOURCES = \
src/network/networkd-netdev.c \
src/network/networkd-tunnel.c \
src/network/networkd-veth.c \
+ src/network/networkd-vxlan.c \
src/network/networkd-network.c \
src/network/networkd-address.c \
src/network/networkd-route.c \
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index f496978..7c738fe 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -1492,7 +1492,7 @@ static int enslave_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
}
static int link_enter_enslave(Link *link) {
- NetDev *vlan, *macvlan;
+ NetDev *vlan, *macvlan, *vxlan;
Iterator i;
int r;
@@ -1508,7 +1508,8 @@ static int link_enter_enslave(Link *link) {
!link->network->bond &&
!link->network->tunnel &&
hashmap_isempty(link->network->vlans) &&
- hashmap_isempty(link->network->macvlans))
+ hashmap_isempty(link->network->macvlans) &&
+ hashmap_isempty(link->network->vxlans))
return link_enslaved(link);
if (link->network->bond) {
@@ -1625,6 +1626,27 @@ static int link_enter_enslave(Link *link) {
link->enslaving ++;
}
+ HASHMAP_FOREACH(vxlan, link->network->vxlans, i) {
+ log_struct_link(LOG_DEBUG, link,
+ "MESSAGE=%*s: enslaving by '%s'",
+ IFNAMSIZ,
+ link->ifname, vxlan->ifname, NETDEV(vxlan), NULL);
+
+ r = netdev_enslave(vxlan, link, &enslave_handler);
+ if (r < 0) {
+ log_struct_link(LOG_WARNING, link,
+ "MESSAGE=%*s: could not enslave by '%s': %s",
+ IFNAMSIZ,
+ link->ifname, vxlan->ifname, strerror(-r),
+ NETDEV(vxlan), NULL);
+ link_enter_failed(link);
+ return r;
+ }
+
+ link_ref(link);
+ link->enslaving ++;
+ }
+
return 0;
}
diff --git a/src/network/networkd-netdev-gperf.gperf b/src/network/networkd-netdev-gperf.gperf
index 784f0f4..9125e1d 100644
--- a/src/network/networkd-netdev-gperf.gperf
+++ b/src/network/networkd-netdev-gperf.gperf
@@ -33,3 +33,8 @@ Tunnel.TTL, config_parse_unsigned, 0,
Tunnel.DiscoverPathMTU, config_parse_bool, 0, offsetof(NetDev, tunnel_pmtudisc)
Peer.Name, config_parse_ifname, 0, offsetof(NetDev, ifname_peer)
Peer.MACAddress, config_parse_hwaddr, 0, offsetof(NetDev, mac_peer)
+VXLAN.Id, config_parse_uint64, 0, offsetof(NetDev, vxlanid)
+VXLAN.Group, config_parse_tunnel_address, 0, offsetof(NetDev, group)
+VXLAN.TOS, config_parse_unsigned, 0, offsetof(NetDev, tos)
+VXLAN.TTL, config_parse_unsigned, 0, offsetof(NetDev, ttl)
+VXLAN.MacLearning, config_parse_bool, 0, offsetof(NetDev, learning)
diff --git a/src/network/networkd-netdev.c b/src/network/networkd-netdev.c
index 5f8a82c..5359eb1 100644
--- a/src/network/networkd-netdev.c
+++ b/src/network/networkd-netdev.c
@@ -36,6 +36,7 @@ static const char* const netdev_kind_table[_NETDEV_KIND_MAX] = {
[NETDEV_KIND_BOND] = "bond",
[NETDEV_KIND_VLAN] = "vlan",
[NETDEV_KIND_MACVLAN] = "macvlan",
+ [NETDEV_KIND_VXLAN] = "vxlan",
[NETDEV_KIND_IPIP] = "ipip",
[NETDEV_KIND_GRE] = "gre",
[NETDEV_KIND_SIT] = "sit",
@@ -402,14 +403,20 @@ static int netdev_create(NetDev *netdev, Link *link, sd_rtnl_message_handler_t c
int netdev_enslave(NetDev *netdev, Link *link, sd_rtnl_message_handler_t callback) {
int r;
- if (netdev->kind == NETDEV_KIND_VLAN || netdev->kind == NETDEV_KIND_MACVLAN)
+ switch(netdev->kind) {
+ case NETDEV_KIND_VLAN:
+ case NETDEV_KIND_MACVLAN:
return netdev_create(netdev, link, callback);
-
- if(netdev->kind == NETDEV_KIND_IPIP ||
- netdev->kind == NETDEV_KIND_GRE ||
- netdev->kind == NETDEV_KIND_SIT ||
- netdev->kind == NETDEV_KIND_VTI)
+ case NETDEV_KIND_VXLAN:
+ return netdev_create_vxlan(netdev, link, callback);
+ case NETDEV_KIND_IPIP:
+ case NETDEV_KIND_GRE:
+ case NETDEV_KIND_SIT:
+ case NETDEV_KIND_VTI:
return netdev_create_tunnel(link, netdev_create_handler);
+ default:
+ break;
+ }
if (netdev->state == NETDEV_STATE_READY) {
r = netdev_enslave_ready(netdev, link, callback);
@@ -606,9 +613,12 @@ static int netdev_load_one(Manager *manager, const char *filename) {
netdev->kind = _NETDEV_KIND_INVALID;
netdev->macvlan_mode = _NETDEV_MACVLAN_MODE_INVALID;
netdev->vlanid = VLANID_MAX + 1;
+ netdev->vxlanid = VXLAN_VID_MAX + 1;
netdev->tunnel_pmtudisc = true;
+ netdev->learning = true;
- r = config_parse(NULL, filename, file, "Match\0NetDev\0VLAN\0MACVLAN\0Tunnel\0Peer\0",
+ r = config_parse(NULL, filename, file,
+ "Match\0NetDev\0VLAN\0MACVLAN\0VXLAN\0Tunnel\0Peer\0",
config_item_perf_lookup, (void*) network_netdev_gperf_lookup,
false, false, netdev);
if (r < 0) {
@@ -631,12 +641,23 @@ static int netdev_load_one(Manager *manager, const char *filename) {
return 0;
}
+ if (netdev->kind == NETDEV_KIND_VXLAN && netdev->vxlanid > VXLAN_VID_MAX) {
+ log_warning("VXLAN without valid Id configured in %s. Ignoring", filename);
+ return 0;
+ }
+
if (netdev->kind != NETDEV_KIND_VLAN && netdev->vlanid <= VLANID_MAX) {
log_warning("VLAN Id configured for a %s in %s. Ignoring",
netdev_kind_to_string(netdev->kind), filename);
return 0;
}
+ if (netdev->kind != NETDEV_KIND_VXLAN && netdev->vlanid <= VXLAN_VID_MAX) {
+ log_warning("VLAN Id configured for a %s in %s. Ignoring",
+ netdev_kind_to_string(netdev->kind), filename);
+ return 0;
+ }
+
if (netdev->kind != NETDEV_KIND_MACVLAN &&
netdev->macvlan_mode != _NETDEV_MACVLAN_MODE_INVALID) {
log_warning("MACVLAN Mode configured for a %s in %s. Ignoring",
@@ -690,6 +711,7 @@ static int netdev_load_one(Manager *manager, const char *filename) {
if (netdev->kind != NETDEV_KIND_VLAN &&
netdev->kind != NETDEV_KIND_MACVLAN &&
+ netdev->kind != NETDEV_KIND_VXLAN &&
netdev->kind != NETDEV_KIND_IPIP &&
netdev->kind != NETDEV_KIND_GRE &&
netdev->kind != NETDEV_KIND_SIT &&
diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf
index 7ef467e..5e21805 100644
--- a/src/network/networkd-network-gperf.gperf
+++ b/src/network/networkd-network-gperf.gperf
@@ -29,6 +29,7 @@ Network.Bridge, config_parse_netdev, 0,
Network.Bond, config_parse_netdev, 0, offsetof(Network, bond)
Network.VLAN, config_parse_netdev, 0, offsetof(Network, vlans)
Network.MACVLAN, config_parse_netdev, 0, offsetof(Network, macvlans)
+Network.VXLAN, config_parse_netdev, 0, offsetof(Network, vxlans)
Network.DHCP, config_parse_bool, 0, offsetof(Network, dhcp)
Network.DHCPServer, config_parse_bool, 0, offsetof(Network, dhcp_server)
Network.IPv4LL, config_parse_bool, 0, offsetof(Network, ipv4ll)
diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c
index 4e38173..45c1ab0 100644
--- a/src/network/networkd-network.c
+++ b/src/network/networkd-network.c
@@ -69,6 +69,10 @@ static int network_load_one(Manager *manager, const char *filename) {
if (!network->macvlans)
return log_oom();
+ network->vxlans = hashmap_new(uint64_hash_func, uint64_compare_func);
+ if (!network->vxlans)
+ return log_oom();
+
network->addresses_by_section = hashmap_new(uint64_hash_func, uint64_compare_func);
if (!network->addresses_by_section)
return log_oom();
@@ -183,6 +187,10 @@ void network_free(Network *network) {
netdev_unref(netdev);
hashmap_free(network->macvlans);
+ HASHMAP_FOREACH(netdev, network->vxlans, i)
+ netdev_unref(netdev);
+ hashmap_free(network->vxlans);
+
while ((route = network->static_routes))
route_free(route);
@@ -326,6 +334,15 @@ int config_parse_netdev(const char *unit,
}
break;
+ case NETDEV_KIND_VXLAN:
+ r = hashmap_put(network->vxlans, netdev->ifname, netdev);
+ if (r < 0) {
+ log_syntax(unit, LOG_ERR, filename, line, EINVAL,
+ "Can not add VXLAN to network: %s", rvalue);
+ return 0;
+ }
+
+ break;
default:
assert_not_reached("Can not parse NetDev");
}
diff --git a/src/network/networkd-vxlan.c b/src/network/networkd-vxlan.c
new file mode 100644
index 0000000..d672122
--- /dev/null
+++ b/src/network/networkd-vxlan.c
@@ -0,0 +1,162 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+/***
+ This file is part of systemd.
+
+ Copyright 2014 Susant Sahani <susant at redhat.com>
+
+ systemd is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ systemd is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <netinet/ether.h>
+#include <arpa/inet.h>
+#include <net/if.h>
+
+#include "sd-rtnl.h"
+#include "networkd.h"
+
+
+static int netdev_fill_vxlan_rtnl_message(NetDev *netdev, Link *link, sd_rtnl_message *m) {
+ int r;
+
+ assert(link);
+ assert(link->network);
+ assert(m);
+
+ r = sd_rtnl_message_append_string(m, IFLA_IFNAME, netdev->ifname);
+ if (r < 0) {
+ log_error_netdev(netdev,
+ "Could not append IFLA_IFNAME, attribute: %s",
+ strerror(-r));
+ return r;
+ }
+
+ r = sd_rtnl_message_open_container(m, IFLA_LINKINFO);
+ if (r < 0) {
+ log_error_netdev(netdev,
+ "Could not append IFLA_LINKINFO attribute: %s",
+ strerror(-r));
+ return r;
+ }
+
+ r = sd_rtnl_message_open_container_union(m, IFLA_INFO_DATA,
+ netdev_kind_to_string(netdev->kind));
+ if (r < 0) {
+ log_error_netdev(netdev,
+ "Could not append IFLA_INFO_DATA attribute: %s",
+ strerror(-r));
+ return r;
+ }
+
+ if (netdev->vlanid <= VXLAN_VID_MAX) {
+ r = sd_rtnl_message_append_u32(m, IFLA_VXLAN_ID, netdev->vxlanid);
+ if (r < 0) {
+ log_error_netdev(netdev,
+ "Could not append IFLA_VXLAN_ID attribute: %s",
+ strerror(-r));
+ return r;
+ }
+ }
+
+ r = sd_rtnl_message_append_in_addr(m, IFLA_VXLAN_GROUP, &netdev->group);
+ if (r < 0) {
+ log_error_netdev(netdev,
+ "Could not append IFLA_VXLAN_GROUP attribute: %s",
+ strerror(-r));
+ return r;
+ }
+
+ r = sd_rtnl_message_append_u32(m, IFLA_VXLAN_LINK, link->ifindex);
+ if (r < 0) {
+ log_error_netdev(netdev,
+ "Could not append IFLA_VXLAN_LINK attribute: %s",
+ strerror(-r));
+ return r;
+ }
+
+ if(netdev->ttl) {
+ r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_TTL, netdev->ttl);
+ if (r < 0) {
+ log_error_netdev(netdev,
+ "Could not append IFLA_VXLAN_TTL attribute: %s",
+ strerror(-r));
+ return r;
+ }
+ }
+
+ if(netdev->tos) {
+ r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_TOS, netdev->tos);
+ if (r < 0) {
+ log_error_netdev(netdev,
+ "Could not append IFLA_VXLAN_TOS attribute: %s",
+ strerror(-r));
+ return r;
+ }
+ }
+
+ r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_LEARNING, netdev->learning);
+ if (r < 0) {
+ log_error_netdev(netdev,
+ "Could not append IFLA_VXLAN_LEARNING attribute: %s",
+ strerror(-r));
+ return r;
+ }
+
+ r = sd_rtnl_message_close_container(m);
+ if (r < 0) {
+ log_error_netdev(netdev,
+ "Could not append IFLA_LINKINFO attribute: %s",
+ strerror(-r));
+ return r;
+ }
+
+ return r;
+}
+
+int netdev_create_vxlan(NetDev *netdev, Link *link, sd_rtnl_message_handler_t callback) {
+ _cleanup_rtnl_message_unref_ sd_rtnl_message *m = NULL;
+ int r;
+
+ assert(netdev);
+ assert(!(netdev->kind == NETDEV_KIND_VXLAN) || (link && callback));
+ assert(netdev->ifname);
+ assert(netdev->manager);
+ assert(netdev->manager->rtnl);
+
+ r = sd_rtnl_message_new_link(netdev->manager->rtnl, &m, RTM_NEWLINK, 0);
+ if (r < 0) {
+ log_error_netdev(netdev,
+ "Could not allocate RTM_NEWLINK message: %s",
+ strerror(-r));
+ return r;
+ }
+
+ r = netdev_fill_vxlan_rtnl_message(netdev, link, m);
+ if(r < 0)
+ return r;
+
+ r = sd_rtnl_call_async(netdev->manager->rtnl, m, callback, link, 0, NULL);
+ if (r < 0) {
+ log_error_netdev(netdev,
+ "Could not send rtnetlink message: %s", strerror(-r));
+ return r;
+ }
+
+ log_debug_netdev(netdev, "Creating vxlan netdev: %s",
+ netdev_kind_to_string(netdev->kind));
+
+ netdev->state = NETDEV_STATE_CREATING;
+
+ return 0;
+}
diff --git a/src/network/networkd.h b/src/network/networkd.h
index 799fd59..3b081d5 100644
--- a/src/network/networkd.h
+++ b/src/network/networkd.h
@@ -38,6 +38,7 @@
#include "condition-util.h"
#define CACHE_INFO_INFINITY_LIFE_TIME 0xFFFFFFFFU
+#define VXLAN_VID_MAX (1u << 24) - 1
typedef struct NetDev NetDev;
typedef struct Network Network;
@@ -69,6 +70,7 @@ typedef enum NetDevKind {
NETDEV_KIND_BOND,
NETDEV_KIND_VLAN,
NETDEV_KIND_MACVLAN,
+ NETDEV_KIND_VXLAN,
NETDEV_KIND_IPIP,
NETDEV_KIND_GRE,
NETDEV_KIND_SIT,
@@ -108,16 +110,19 @@ struct NetDev {
NetDevKind kind;
uint64_t vlanid;
+ uint64_t vxlanid;
int32_t macvlan_mode;
int ifindex;
NetDevState state;
bool tunnel_pmtudisc;
+ bool learning;
unsigned ttl;
unsigned tos;
struct in_addr local;
struct in_addr remote;
+ struct in_addr group;
LIST_HEAD(netdev_enslave_callback, callbacks);
};
@@ -143,6 +148,7 @@ struct Network {
NetDev *tunnel;
Hashmap *vlans;
Hashmap *macvlans;
+ Hashmap *vxlans;
bool dhcp;
bool dhcp_dns;
bool dhcp_ntp;
@@ -321,6 +327,7 @@ int netdev_set_ifindex(NetDev *netdev, sd_rtnl_message *newlink);
int netdev_enslave(NetDev *netdev, Link *link, sd_rtnl_message_handler_t cb);
int netdev_create_tunnel(Link *link, sd_rtnl_message_handler_t callback);
int netdev_create_veth(NetDev *netdev, sd_rtnl_message_handler_t callback);
+int netdev_create_vxlan(NetDev *netdev, Link *link, sd_rtnl_message_handler_t callback);
const char *netdev_kind_to_string(NetDevKind d) _const_;
NetDevKind netdev_kind_from_string(const char *d) _pure_;
commit 1324e3ae515719a93a94a8d8316644af6c780909
Author: Susant Sahani <susant at redhat.com>
Date: Mon Jun 16 11:54:32 2014 +0530
networkd: rename netdev variables
Rename the netdev variables. Remove tunnel_
so that it can be reused .
diff --git a/src/network/networkd-netdev-gperf.gperf b/src/network/networkd-netdev-gperf.gperf
index 82cc858..784f0f4 100644
--- a/src/network/networkd-netdev-gperf.gperf
+++ b/src/network/networkd-netdev-gperf.gperf
@@ -26,10 +26,10 @@ NetDev.MTUBytes, config_parse_iec_size, 0,
NetDev.MACAddress, config_parse_hwaddr, 0, offsetof(NetDev, mac)
VLAN.Id, config_parse_uint64, 0, offsetof(NetDev, vlanid)
MACVLAN.Mode, config_parse_macvlan_mode, 0, offsetof(NetDev, macvlan_mode)
-Tunnel.Local, config_parse_tunnel_address, 0, offsetof(NetDev, tunnel_local)
-Tunnel.Remote, config_parse_tunnel_address, 0, offsetof(NetDev, tunnel_remote)
-Tunnel.TOS, config_parse_unsigned, 0, offsetof(NetDev, tunnel_tos)
-Tunnel.TTL, config_parse_unsigned, 0, offsetof(NetDev, tunnel_ttl)
+Tunnel.Local, config_parse_tunnel_address, 0, offsetof(NetDev, local)
+Tunnel.Remote, config_parse_tunnel_address, 0, offsetof(NetDev, remote)
+Tunnel.TOS, config_parse_unsigned, 0, offsetof(NetDev, tos)
+Tunnel.TTL, config_parse_unsigned, 0, offsetof(NetDev, ttl)
Tunnel.DiscoverPathMTU, config_parse_bool, 0, offsetof(NetDev, tunnel_pmtudisc)
Peer.Name, config_parse_ifname, 0, offsetof(NetDev, ifname_peer)
Peer.MACAddress, config_parse_hwaddr, 0, offsetof(NetDev, mac_peer)
diff --git a/src/network/networkd-tunnel.c b/src/network/networkd-tunnel.c
index 885347a..202c089 100644
--- a/src/network/networkd-tunnel.c
+++ b/src/network/networkd-tunnel.c
@@ -95,7 +95,7 @@ static int netdev_fill_ipip_rtnl_message(Link *link, sd_rtnl_message *m) {
return r;
}
- r = sd_rtnl_message_append_in_addr(m, IFLA_IPTUN_LOCAL, &netdev->tunnel_local);
+ r = sd_rtnl_message_append_in_addr(m, IFLA_IPTUN_LOCAL, &netdev->local);
if (r < 0) {
log_error_netdev(netdev,
"Could not append IFLA_IPTUN_LOCAL attribute: %s",
@@ -103,7 +103,7 @@ static int netdev_fill_ipip_rtnl_message(Link *link, sd_rtnl_message *m) {
return r;
}
- r = sd_rtnl_message_append_in_addr(m, IFLA_IPTUN_REMOTE, &netdev->tunnel_remote);
+ r = sd_rtnl_message_append_in_addr(m, IFLA_IPTUN_REMOTE, &netdev->remote);
if (r < 0) {
log_error_netdev(netdev,
"Could not append IFLA_IPTUN_REMOTE attribute: %s",
@@ -111,7 +111,7 @@ static int netdev_fill_ipip_rtnl_message(Link *link, sd_rtnl_message *m) {
return r;
}
- r = sd_rtnl_message_append_u8(m, IFLA_IPTUN_TTL, netdev->tunnel_ttl);
+ r = sd_rtnl_message_append_u8(m, IFLA_IPTUN_TTL, netdev->ttl);
if (r < 0) {
log_error_netdev(netdev,
"Could not append IFLA_IPTUN_TTL attribute: %s",
@@ -202,7 +202,7 @@ static int netdev_fill_sit_rtnl_message(Link *link, sd_rtnl_message *m) {
return r;
}
- r = sd_rtnl_message_append_in_addr(m, IFLA_IPTUN_LOCAL, &netdev->tunnel_local);
+ r = sd_rtnl_message_append_in_addr(m, IFLA_IPTUN_LOCAL, &netdev->local);
if (r < 0) {
log_error_netdev(netdev,
"Could not append IFLA_IPTUN_LOCAL attribute: %s",
@@ -210,7 +210,7 @@ static int netdev_fill_sit_rtnl_message(Link *link, sd_rtnl_message *m) {
return r;
}
- r = sd_rtnl_message_append_in_addr(m, IFLA_IPTUN_REMOTE, &netdev->tunnel_remote);
+ r = sd_rtnl_message_append_in_addr(m, IFLA_IPTUN_REMOTE, &netdev->remote);
if (r < 0) {
log_error_netdev(netdev,
"Could not append IFLA_IPTUN_REMOTE attribute: %s",
@@ -218,7 +218,7 @@ static int netdev_fill_sit_rtnl_message(Link *link, sd_rtnl_message *m) {
return r;
}
- r = sd_rtnl_message_append_u8(m, IFLA_IPTUN_TOS, netdev->tunnel_tos);
+ r = sd_rtnl_message_append_u8(m, IFLA_IPTUN_TOS, netdev->tos);
if (r < 0) {
log_error_netdev(netdev,
"Could not append IFLA_IPTUN_TOS attribute: %s",
@@ -317,7 +317,7 @@ static int netdev_fill_ipgre_rtnl_message(Link *link, sd_rtnl_message *m) {
return r;
}
- r = sd_rtnl_message_append_in_addr(m, IFLA_GRE_LOCAL, &netdev->tunnel_local);
+ r = sd_rtnl_message_append_in_addr(m, IFLA_GRE_LOCAL, &netdev->local);
if (r < 0) {
log_error_netdev(netdev,
"Could not append IFLA_GRE_LOCAL attribute: %s",
@@ -325,7 +325,7 @@ static int netdev_fill_ipgre_rtnl_message(Link *link, sd_rtnl_message *m) {
return r;
}
- r = sd_rtnl_message_append_in_addr(m, IFLA_GRE_REMOTE, &netdev->tunnel_remote);
+ r = sd_rtnl_message_append_in_addr(m, IFLA_GRE_REMOTE, &netdev->remote);
if (r < 0) {
log_error_netdev(netdev,
"Could not append IFLA_GRE_REMOTE attribute: %s",
@@ -333,7 +333,7 @@ static int netdev_fill_ipgre_rtnl_message(Link *link, sd_rtnl_message *m) {
return r;
}
- r = sd_rtnl_message_append_u8(m, IFLA_GRE_TTL, netdev->tunnel_ttl);
+ r = sd_rtnl_message_append_u8(m, IFLA_GRE_TTL, netdev->ttl);
if (r < 0) {
log_error_netdev(netdev,
"Could not append IFLA_GRE_TTL attribute: %s",
@@ -341,7 +341,7 @@ static int netdev_fill_ipgre_rtnl_message(Link *link, sd_rtnl_message *m) {
return r;
}
- r = sd_rtnl_message_append_u8(m, IFLA_GRE_TOS, netdev->tunnel_tos);
+ r = sd_rtnl_message_append_u8(m, IFLA_GRE_TOS, netdev->tos);
if (r < 0) {
log_error_netdev(netdev,
"Could not append IFLA_GRE_TOS attribute: %s",
@@ -432,7 +432,7 @@ static int netdev_fill_vti_rtnl_message(Link *link, sd_rtnl_message *m) {
return r;
}
- r = sd_rtnl_message_append_in_addr(m, IFLA_VTI_LOCAL, &netdev->tunnel_local);
+ r = sd_rtnl_message_append_in_addr(m, IFLA_VTI_LOCAL, &netdev->local);
if (r < 0) {
log_error_netdev(netdev,
"Could not append IFLA_IPTUN_LOCAL attribute: %s",
@@ -440,7 +440,7 @@ static int netdev_fill_vti_rtnl_message(Link *link, sd_rtnl_message *m) {
return r;
}
- r = sd_rtnl_message_append_in_addr(m, IFLA_VTI_REMOTE, &netdev->tunnel_remote);
+ r = sd_rtnl_message_append_in_addr(m, IFLA_VTI_REMOTE, &netdev->remote);
if (r < 0) {
log_error_netdev(netdev,
"Could not append IFLA_IPTUN_REMOTE attribute: %s",
diff --git a/src/network/networkd.h b/src/network/networkd.h
index f079473..799fd59 100644
--- a/src/network/networkd.h
+++ b/src/network/networkd.h
@@ -114,10 +114,10 @@ struct NetDev {
NetDevState state;
bool tunnel_pmtudisc;
- unsigned tunnel_ttl;
- unsigned tunnel_tos;
- struct in_addr tunnel_local;
- struct in_addr tunnel_remote;
+ unsigned ttl;
+ unsigned tos;
+ struct in_addr local;
+ struct in_addr remote;
LIST_HEAD(netdev_enslave_callback, callbacks);
};
commit 6ef81477003056e1cbc72c4b0f8fe44905509c6a
Author: Susant Sahani <susant at redhat.com>
Date: Mon Jun 16 11:54:31 2014 +0530
sd-rtnl: add support for vxlan rtnl attributes
This patch adds vxlan rtnl attributes to sd-rtnl
diff --git a/src/libsystemd/sd-rtnl/rtnl-types.c b/src/libsystemd/sd-rtnl/rtnl-types.c
index 2218afd..d3349b2 100644
--- a/src/libsystemd/sd-rtnl/rtnl-types.c
+++ b/src/libsystemd/sd-rtnl/rtnl-types.c
@@ -70,6 +70,23 @@ static const NLType rtnl_link_info_data_vlan_types[IFLA_VLAN_MAX + 1] = {
[IFLA_VLAN_PROTOCOL] = { .type = NLA_U16 },
};
+static const NLType rtnl_link_info_data_vxlan_types[IFLA_VXLAN_MAX+1] = {
+ [IFLA_VXLAN_ID] = { .type = NLA_U32 },
+ [IFLA_VXLAN_GROUP] = {.type = NLA_IN_ADDR },
+ [IFLA_VXLAN_LINK] = { .type = NLA_U32 },
+ [IFLA_VXLAN_LOCAL] = { .type = NLA_U32},
+ [IFLA_VXLAN_TTL] = { .type = NLA_U8 },
+ [IFLA_VXLAN_TOS] = { .type = NLA_U8 },
+ [IFLA_VXLAN_LEARNING] = { .type = NLA_U8 },
+ [IFLA_VXLAN_AGEING] = { .type = NLA_U32 },
+ [IFLA_VXLAN_LIMIT] = { .type = NLA_U32 },
+ [IFLA_VXLAN_PORT_RANGE] = { .type = NLA_U32},
+ [IFLA_VXLAN_PROXY] = { .type = NLA_U8 },
+ [IFLA_VXLAN_RSC] = { .type = NLA_U8 },
+ [IFLA_VXLAN_L2MISS] = { .type = NLA_U8 },
+ [IFLA_VXLAN_L3MISS] = { .type = NLA_U8 },
+};
+
static const NLType rtnl_link_info_data_bond_types[IFLA_BOND_MAX + 1] = {
[IFLA_BOND_MODE] = { .type = NLA_U8 },
[IFLA_BOND_ACTIVE_SLAVE] = { .type = NLA_U32 },
@@ -144,6 +161,7 @@ typedef enum NLUnionLinkInfoData {
NL_UNION_LINK_INFO_DATA_VLAN,
NL_UNION_LINK_INFO_DATA_VETH,
NL_UNION_LINK_INFO_DATA_MACVLAN,
+ NL_UNION_LINK_INFO_DATA_VXLAN,
NL_UNION_LINK_INFO_DATA_IPIP_TUNNEL,
NL_UNION_LINK_INFO_DATA_IPGRE_TUNNEL,
NL_UNION_LINK_INFO_DATA_SIT_TUNNEL,
@@ -162,6 +180,7 @@ static const char* const nl_union_link_info_data_table[_NL_UNION_LINK_INFO_DATA_
[NL_UNION_LINK_INFO_DATA_VLAN] = "vlan",
[NL_UNION_LINK_INFO_DATA_VETH] = "veth",
[NL_UNION_LINK_INFO_DATA_MACVLAN] = "macvlan",
+ [NL_UNION_LINK_INFO_DATA_VXLAN] = "vxlan",
[NL_UNION_LINK_INFO_DATA_IPIP_TUNNEL] = "ipip",
[NL_UNION_LINK_INFO_DATA_IPGRE_TUNNEL] = "gre",
[NL_UNION_LINK_INFO_DATA_SIT_TUNNEL] = "sit",
@@ -181,6 +200,8 @@ static const NLTypeSystem rtnl_link_info_data_type_systems[_NL_UNION_LINK_INFO_D
.types = rtnl_link_info_data_veth_types },
[NL_UNION_LINK_INFO_DATA_MACVLAN] = { .max = ELEMENTSOF(rtnl_link_info_data_macvlan_types) - 1,
.types = rtnl_link_info_data_macvlan_types },
+ [NL_UNION_LINK_INFO_DATA_VXLAN] = { .max = ELEMENTSOF(rtnl_link_info_data_vxlan_types) - 1,
+ .types = rtnl_link_info_data_vxlan_types },
[NL_UNION_LINK_INFO_DATA_IPIP_TUNNEL] = { .max = ELEMENTSOF(rtnl_link_info_data_iptun_types) - 1,
.types = rtnl_link_info_data_iptun_types },
[NL_UNION_LINK_INFO_DATA_IPGRE_TUNNEL] = { .max = ELEMENTSOF(rtnl_link_info_data_ipgre_types) - 1,
More information about the systemd-commits
mailing list