diff options
author | Lennart Poettering <lennart@poettering.net> | 2017-03-31 11:30:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-31 11:30:33 +0200 |
commit | 510cb1ce89d8ce3310e7ca514dd35986964d6f01 (patch) | |
tree | de3f366a982fb82000f8c5d96a982ad99bacb607 | |
parent | networkd: fix route_new_static assert when IPv4LLRoute=true (#5676) (diff) | |
parent | networkd: vxlan support setting IPv6 flow labe (diff) | |
download | systemd-510cb1ce89d8ce3310e7ca514dd35986964d6f01.tar.xz systemd-510cb1ce89d8ce3310e7ca514dd35986964d6f01.zip |
Merge pull request #5534 from ssahani/vxlan-label
networkd: vxlan support setting IPv6 flow label
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | man/systemd.netdev.xml | 8 | ||||
-rw-r--r-- | src/basic/missing.h | 8 | ||||
-rw-r--r-- | src/libsystemd/sd-netlink/netlink-types.c | 3 | ||||
-rw-r--r-- | src/network/netdev/netdev-gperf.gperf | 1 | ||||
-rw-r--r-- | src/network/netdev/vxlan.c | 40 | ||||
-rw-r--r-- | src/network/netdev/vxlan.h | 13 |
7 files changed, 72 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac index 06fa908d43..cf37ca6493 100644 --- a/configure.ac +++ b/configure.ac @@ -360,7 +360,7 @@ AC_CHECK_DECLS([IFLA_INET6_ADDR_GEN_MODE, IFLA_PHYS_PORT_ID, IFLA_BOND_AD_INFO, IFLA_VLAN_PROTOCOL, - IFLA_VXLAN_REMCSUM_NOPARTIAL, + IFLA_VXLAN_GPE, IFLA_IPTUN_ENCAP_DPORT, IFLA_GRE_ENCAP_DPORT, IFLA_BRIDGE_VLAN_INFO, diff --git a/man/systemd.netdev.xml b/man/systemd.netdev.xml index 39e69480ec..de22a6d49e 100644 --- a/man/systemd.netdev.xml +++ b/man/systemd.netdev.xml @@ -604,6 +604,14 @@ ports, and allows overriding via configuration.</para> </listitem> </varlistentry> + <varlistentry> + <term><varname>FlowLabel=</varname></term> + <listitem> + <para>Specifies the flow label to use in outgoing packets. + The valid range is 0-1048575. + </para> + </listitem> + </varlistentry> </variablelist> </refsect1> <refsect1> diff --git a/src/basic/missing.h b/src/basic/missing.h index 480462357d..284cbaffc0 100644 --- a/src/basic/missing.h +++ b/src/basic/missing.h @@ -726,7 +726,7 @@ struct btrfs_ioctl_quota_ctl_args { #define IFLA_VLAN_MAX (__IFLA_VLAN_MAX - 1) #endif -#if !HAVE_DECL_IFLA_VXLAN_REMCSUM_NOPARTIAL +#if !HAVE_DECL_IFLA_VXLAN_GPE #define IFLA_VXLAN_UNSPEC 0 #define IFLA_VXLAN_ID 1 #define IFLA_VXLAN_GROUP 2 @@ -752,7 +752,11 @@ struct btrfs_ioctl_quota_ctl_args { #define IFLA_VXLAN_REMCSUM_RX 22 #define IFLA_VXLAN_GBP 23 #define IFLA_VXLAN_REMCSUM_NOPARTIAL 24 -#define __IFLA_VXLAN_MAX 25 +#define IFLA_VXLAN_COLLECT_METADATA 25 +#define IFLA_VXLAN_LABEL 26 +#define IFLA_VXLAN_GPE 27 + +#define __IFLA_VXLAN_MAX 28 #define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1) #endif diff --git a/src/libsystemd/sd-netlink/netlink-types.c b/src/libsystemd/sd-netlink/netlink-types.c index ff0e99558e..fc13a4ce14 100644 --- a/src/libsystemd/sd-netlink/netlink-types.c +++ b/src/libsystemd/sd-netlink/netlink-types.c @@ -170,6 +170,9 @@ static const NLType rtnl_link_info_data_vxlan_types[] = { [IFLA_VXLAN_REMCSUM_RX] = { .type = NETLINK_TYPE_U8 }, [IFLA_VXLAN_GBP] = { .type = NETLINK_TYPE_FLAG }, [IFLA_VXLAN_REMCSUM_NOPARTIAL] = { .type = NETLINK_TYPE_FLAG }, + [IFLA_VXLAN_COLLECT_METADATA] = { .type = NETLINK_TYPE_U8 }, + [IFLA_VXLAN_LABEL] = { .type = NETLINK_TYPE_U32 }, + [IFLA_VXLAN_GPE] = { .type = NETLINK_TYPE_FLAG }, }; static const NLType rtnl_bond_arp_target_types[] = { 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); |