summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorSusant Sahani <susant@redhat.com>2017-03-08 18:41:03 +0530
committerSusant Sahani <susant@redhat.com>2017-03-14 10:11:49 +0530
commitd8653945f71dc8a6fa27b033fdecb97bba95bf36 (patch)
tree09a1ab08fc4ba9fc13e3bc5d52fed3add169b1a8 /src/network
parent6d21646af8187a5192bd7aa259b098919d11fa99 (diff)
networkd: vxlan support setting IPv6 flow labe
This work adds support for setting the IPv6 flow label for vxlan. vxlan.netdev NetDev] Description=vxlan-test Name=vxlan1 Kind=vxlan [VXLAN] Id=33 Local=2405:204:920b:29ac:7e7a:91ff:fe6d:ffe2 Remote=FF02:0:0:0:0:0:1:9 FlowLabel=104 ip -d link show vxlan1 8: vxlan1: <BROADCAST,MULTICAST> mtu 1430 qdisc noop state DOWN mode DEFAULT group default qlen 1000 link/ether be:83:aa:db:6b:cb brd ff:ff:ff:ff:ff:ff promiscuity 0 vxlan id 33 group ff02::1:9 local 2405:204:920b:29ac:7e7a:91ff:fe6d:ffe2 dev enp0s25 srcport 0 0 dstport 8472 flowlabel 0x68 ageing 300 noudpcsum noudp6zerocsumtx noudp6zerocsumrx addrgenmode eui64 numtxqueues 1 numrxqueues 1
Diffstat (limited to 'src/network')
-rw-r--r--src/network/netdev/netdev-gperf.gperf1
-rw-r--r--src/network/netdev/vxlan.c40
-rw-r--r--src/network/netdev/vxlan.h13
3 files changed, 54 insertions, 0 deletions
diff --git a/src/network/netdev/netdev-gperf.gperf b/src/network/netdev/netdev-gperf.gperf
index e19fa9817e..925af1c579 100644
--- a/src/network/netdev/netdev-gperf.gperf
+++ b/src/network/netdev/netdev-gperf.gperf
@@ -78,6 +78,7 @@ VXLAN.GroupPolicyExtension, config_parse_bool, 0,
VXLAN.MaximumFDBEntries, config_parse_unsigned, 0, offsetof(VxLan, max_fdb)
VXLAN.PortRange, config_parse_port_range, 0, 0
VXLAN.DestinationPort, config_parse_destination_port, 0, offsetof(VxLan, dest_port)
+VXLAN.FlowLabel, config_parse_flow_label, 0, 0
Tun.OneQueue, config_parse_bool, 0, offsetof(TunTap, one_queue)
Tun.MultiQueue, config_parse_bool, 0, offsetof(TunTap, multi_queue)
Tun.PacketInfo, config_parse_bool, 0, offsetof(TunTap, packet_info)
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);
diff --git a/src/network/netdev/vxlan.h b/src/network/netdev/vxlan.h
index dca58e7fe6..7f97a9edc4 100644
--- a/src/network/netdev/vxlan.h
+++ b/src/network/netdev/vxlan.h
@@ -25,6 +25,7 @@ typedef struct VxLan VxLan;
#include "netdev/netdev.h"
#define VXLAN_VID_MAX (1u << 24) - 1
+#define VXLAN_FLOW_LABEL_MAX_MASK 0xFFFFFU
struct VxLan {
NetDev meta;
@@ -40,6 +41,7 @@ struct VxLan {
unsigned tos;
unsigned ttl;
unsigned max_fdb;
+ unsigned flow_label;
uint16_t dest_port;
@@ -94,3 +96,14 @@ int config_parse_destination_port(const char *unit,
const char *rvalue,
void *data,
void *userdata);
+
+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);