summaryrefslogtreecommitdiff
path: root/src/network/netdev/vxlan.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-03-31 11:30:33 +0200
committerGitHub <noreply@github.com>2017-03-31 11:30:33 +0200
commit510cb1ce89d8ce3310e7ca514dd35986964d6f01 (patch)
treede3f366a982fb82000f8c5d96a982ad99bacb607 /src/network/netdev/vxlan.c
parent0b180d754cd9b171f38e39554495841f666060f7 (diff)
parentd8653945f71dc8a6fa27b033fdecb97bba95bf36 (diff)
Merge pull request #5534 from ssahani/vxlan-label
networkd: vxlan support setting IPv6 flow label
Diffstat (limited to 'src/network/netdev/vxlan.c')
-rw-r--r--src/network/netdev/vxlan.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c
index b677b000fd..7f20e6cdfe 100644
--- a/src/network/netdev/vxlan.c
+++ b/src/network/netdev/vxlan.c
@@ -157,6 +157,10 @@ static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_netli
return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_PORT_RANGE attribute: %m");
}
+ r = sd_netlink_message_append_u32(m, IFLA_VXLAN_LABEL, htobe32(v->flow_label));
+ if (r < 0)
+ return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_LABEL attribute: %m");
+
if (v->group_policy) {
r = sd_netlink_message_append_flag(m, IFLA_VXLAN_GBP);
if (r < 0)
@@ -297,6 +301,42 @@ int config_parse_destination_port(const char *unit,
return 0;
}
+int config_parse_flow_label(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;
+ unsigned f;
+ int r;
+
+ assert(filename);
+ assert(lvalue);
+ assert(rvalue);
+ assert(data);
+
+ r = safe_atou(rvalue, &f);
+ if (r < 0) {
+ log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse VXLAN flow label '%s'.", rvalue);
+ return 0;
+ }
+
+ if (f & ~VXLAN_FLOW_LABEL_MAX_MASK) {
+ log_syntax(unit, LOG_ERR, filename, line, r,
+ "VXLAN flow label '%s' not valid. Flow label range should be [0-1048575].", rvalue);
+ return 0;
+ }
+
+ v->flow_label = f;
+
+ return 0;
+}
+
static int netdev_vxlan_verify(NetDev *netdev, const char *filename) {
VxLan *v = VXLAN(netdev);