summaryrefslogtreecommitdiff
path: root/src/network/networkd-netdev-vxlan.c
diff options
context:
space:
mode:
authorSusant Sahani <susant@redhat.com>2014-11-15 08:24:59 +0530
committerTom Gundersen <teg@jklm.no>2014-12-04 11:13:32 +0100
commit85a8eeee36b57c1ab382b0225fa9a87525bbeee9 (patch)
tree53a0fdbb5842e052dd74138957b3d0a4136215b5 /src/network/networkd-netdev-vxlan.c
parent0a86c1a9d8066267b878dfeddc5e0087dda6a37b (diff)
networkd: support vxlan parameters
V3: fix copy paste error V4: Make manual and config more readable Add vxlan paramertes to config.
Diffstat (limited to 'src/network/networkd-netdev-vxlan.c')
-rw-r--r--src/network/networkd-netdev-vxlan.c81
1 files changed, 81 insertions, 0 deletions
diff --git a/src/network/networkd-netdev-vxlan.c b/src/network/networkd-netdev-vxlan.c
index 7dec69d0f6..b19240e311 100644
--- a/src/network/networkd-netdev-vxlan.c
+++ b/src/network/networkd-netdev-vxlan.c
@@ -26,6 +26,7 @@
#include "sd-rtnl.h"
#include "networkd-netdev-vxlan.h"
#include "networkd-link.h"
+#include "conf-parser.h"
#include "missing.h"
static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_message *m) {
@@ -92,9 +93,89 @@ static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_
return r;
}
+ r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_RSC, v->route_short_circuit);
+ if (r < 0) {
+ log_error_netdev(netdev,
+ "Could not append IFLA_VXLAN_RSC attribute: %s",
+ strerror(-r));
+ return r;
+ }
+
+ r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_PROXY, v->arp_proxy);
+ if (r < 0) {
+ log_error_netdev(netdev,
+ "Could not append IFLA_VXLAN_PROXY attribute: %s",
+ strerror(-r));
+ return r;
+ }
+
+ r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_L2MISS, v->l2miss);
+ if (r < 0) {
+ log_error_netdev(netdev,
+ "Could not append IFLA_VXLAN_L2MISS attribute: %s",
+ strerror(-r));
+ return r;
+ }
+
+ r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_L3MISS, v->l3miss);
+ if (r < 0) {
+ log_error_netdev(netdev,
+ "Could not append IFLA_VXLAN_L3MISS attribute: %s",
+ strerror(-r));
+ return r;
+ }
+
+ if(v->fdb_ageing) {
+ r = sd_rtnl_message_append_u32(m, IFLA_VXLAN_AGEING, v->fdb_ageing / USEC_PER_SEC);
+ if (r < 0) {
+ log_error_netdev(netdev,
+ "Could not append IFLA_VXLAN_AGEING attribute: %s",
+ strerror(-r));
+ return r;
+ }
+ }
+
return r;
}
+int config_parse_vxlan_group_address(const char *unit,
+ const char *filename,
+ unsigned line,
+ const char *section,
+ unsigned section_line,
+ const char *lvalue,
+ int ltype,
+ const char *rvalue,
+ void *data,
+ void *userdata) {
+ VxLan *v = userdata;
+ union in_addr_union *addr = data, buffer;
+ int r, f;
+
+ assert(filename);
+ assert(lvalue);
+ assert(rvalue);
+ assert(data);
+
+ r = in_addr_from_string_auto(rvalue, &f, &buffer);
+ if (r < 0) {
+ log_syntax(unit, LOG_ERR, filename, line, EINVAL,
+ "vxlan multicast group address is invalid, ignoring assignment: %s", rvalue);
+ return 0;
+ }
+
+ if(v->family != AF_UNSPEC && v->family != f) {
+ log_syntax(unit, LOG_ERR, filename, line, EINVAL,
+ "vxlan multicast group incompatible, ignoring assignment: %s", rvalue);
+ return 0;
+ }
+
+ v->family = f;
+ *addr = buffer;
+
+ return 0;
+}
+
static int netdev_vxlan_verify(NetDev *netdev, const char *filename) {
VxLan *v = VXLAN(netdev);