From ca49c7f9aa41ebd7380e99a706e0f25a42259448 Mon Sep 17 00:00:00 2001 From: Susant Sahani Date: Mon, 6 May 2019 17:28:48 +0530 Subject: [PATCH 1/8] networkd: VXLAN ID define range in the man --- man/systemd.netdev.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/systemd.netdev.xml b/man/systemd.netdev.xml index 0bbfc611f8..4cb3258c11 100644 --- a/man/systemd.netdev.xml +++ b/man/systemd.netdev.xml @@ -529,7 +529,7 @@ Id= - The VXLAN ID to use. + The VXLAN ID to use. Takes a number in the range 1-16777215. From 6f213e4a3465f7c9c986fff0b701cc0e00fb636b Mon Sep 17 00:00:00 2001 From: Susant Sahani Date: Tue, 7 May 2019 10:31:22 +0530 Subject: [PATCH 2/8] networkd: VXLAN rename Id to VNI It makes more sense to call VXLAN ID as 1. the VXLAN Network Identifier (VNI) (or VXLAN Segment ID) 2. test-network: rename VXLAN Id to VNI 3. fuzzer: Add VXLAN VNI directive to fuzzer --- man/systemd.netdev.xml | 4 ++-- src/network/netdev/netdev-gperf.gperf | 3 ++- src/network/netdev/vxlan.c | 10 +++++----- src/network/netdev/vxlan.h | 2 +- test/fuzz/fuzz-netdev-parser/directives.netdev | 1 + test/test-network/conf/25-vxlan.netdev | 2 +- 6 files changed, 12 insertions(+), 10 deletions(-) diff --git a/man/systemd.netdev.xml b/man/systemd.netdev.xml index 4cb3258c11..3841ad54b7 100644 --- a/man/systemd.netdev.xml +++ b/man/systemd.netdev.xml @@ -527,9 +527,9 @@ - Id= + VNI= - The VXLAN ID to use. Takes a number in the range 1-16777215. + The VXLAN Network Identifier (or VXLAN Segment ID). Takes a number in the range 1-16777215. diff --git a/src/network/netdev/netdev-gperf.gperf b/src/network/netdev/netdev-gperf.gperf index 16636601a0..163d7d01d2 100644 --- a/src/network/netdev/netdev-gperf.gperf +++ b/src/network/netdev/netdev-gperf.gperf @@ -96,7 +96,8 @@ L2TPSession.Name, config_parse_l2tp_session_name, Peer.Name, config_parse_ifname, 0, offsetof(Veth, ifname_peer) Peer.MACAddress, config_parse_hwaddr, 0, offsetof(Veth, mac_peer) VXCAN.Peer, config_parse_ifname, 0, offsetof(VxCan, ifname_peer) -VXLAN.Id, config_parse_uint64, 0, offsetof(VxLan, id) +VXLAN.VNI, config_parse_uint64, 0, offsetof(VxLan, vni) +VXLAN.Id, config_parse_uint64, 0, offsetof(VxLan, vni) /* deprecated */ VXLAN.Group, config_parse_vxlan_address, 0, offsetof(VxLan, remote) VXLAN.Local, config_parse_vxlan_address, 0, offsetof(VxLan, local) VXLAN.Remote, config_parse_vxlan_address, 0, offsetof(VxLan, remote) diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c index 4b855ae1e1..c8d9cd4675 100644 --- a/src/network/netdev/vxlan.c +++ b/src/network/netdev/vxlan.c @@ -27,8 +27,8 @@ static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_netli assert(v); - if (v->id <= VXLAN_VID_MAX) { - r = sd_netlink_message_append_u32(m, IFLA_VXLAN_ID, v->id); + if (v->vni <= VXLAN_VID_MAX) { + r = sd_netlink_message_append_u32(m, IFLA_VXLAN_ID, v->vni); if (r < 0) return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_ID attribute: %m"); } @@ -273,8 +273,8 @@ static int netdev_vxlan_verify(NetDev *netdev, const char *filename) { assert(v); assert(filename); - if (v->id > VXLAN_VID_MAX) { - log_warning("VXLAN without valid Id configured in %s. Ignoring", filename); + if (v->vni > VXLAN_VID_MAX) { + log_warning("VXLAN without valid VNI (or VXLAN Segment ID) configured in %s. Ignoring", filename); return -EINVAL; } @@ -290,7 +290,7 @@ static void vxlan_init(NetDev *netdev) { assert(v); - v->id = VXLAN_VID_MAX + 1; + v->vni = VXLAN_VID_MAX + 1; v->learning = true; v->udpcsum = false; v->udp6zerocsumtx = false; diff --git a/src/network/netdev/vxlan.h b/src/network/netdev/vxlan.h index 3b273e97bd..99d16c1ab9 100644 --- a/src/network/netdev/vxlan.h +++ b/src/network/netdev/vxlan.h @@ -12,7 +12,7 @@ typedef struct VxLan VxLan; struct VxLan { NetDev meta; - uint64_t id; + uint64_t vni; int remote_family; int local_family; diff --git a/test/fuzz/fuzz-netdev-parser/directives.netdev b/test/fuzz/fuzz-netdev-parser/directives.netdev index ab7d9f6fc9..0d0bd2c85b 100644 --- a/test/fuzz/fuzz-netdev-parser/directives.netdev +++ b/test/fuzz/fuzz-netdev-parser/directives.netdev @@ -93,6 +93,7 @@ Group= FDBAgeingSec= MacLearning= Id= +VNI= RemoteChecksumRx= TOS= L2MissNotification= diff --git a/test/test-network/conf/25-vxlan.netdev b/test/test-network/conf/25-vxlan.netdev index 819a58356f..d5acf48da5 100644 --- a/test/test-network/conf/25-vxlan.netdev +++ b/test/test-network/conf/25-vxlan.netdev @@ -3,7 +3,7 @@ Name=vxlan99 Kind=vxlan [VXLAN] -Id=999 +VNI=999 L2MissNotification=true L3MissNotification=true RouteShortCircuit=true From 83cb24ac20baf19f7834931dcf6e03486b4c9c30 Mon Sep 17 00:00:00 2001 From: Susant Sahani Date: Tue, 7 May 2019 10:44:06 +0530 Subject: [PATCH 3/8] networkd: VXLan Make group and remote variable separate VXLAN Document Group= --- man/systemd.netdev.xml | 6 ++++++ src/network/netdev/netdev-gperf.gperf | 2 +- src/network/netdev/vxlan.c | 2 +- src/network/netdev/vxlan.h | 2 ++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/man/systemd.netdev.xml b/man/systemd.netdev.xml index 3841ad54b7..1f2f4bd9c8 100644 --- a/man/systemd.netdev.xml +++ b/man/systemd.netdev.xml @@ -543,6 +543,12 @@ Configures local IP address. + + + Group= + + Configures VXLAN multicast group IP address. All members of a VXLAN must use the same multicast group address. + TOS= diff --git a/src/network/netdev/netdev-gperf.gperf b/src/network/netdev/netdev-gperf.gperf index 163d7d01d2..e71c9d00da 100644 --- a/src/network/netdev/netdev-gperf.gperf +++ b/src/network/netdev/netdev-gperf.gperf @@ -98,7 +98,7 @@ Peer.MACAddress, config_parse_hwaddr, VXCAN.Peer, config_parse_ifname, 0, offsetof(VxCan, ifname_peer) VXLAN.VNI, config_parse_uint64, 0, offsetof(VxLan, vni) VXLAN.Id, config_parse_uint64, 0, offsetof(VxLan, vni) /* deprecated */ -VXLAN.Group, config_parse_vxlan_address, 0, offsetof(VxLan, remote) +VXLAN.Group, config_parse_vxlan_address, 0, offsetof(VxLan, group) VXLAN.Local, config_parse_vxlan_address, 0, offsetof(VxLan, local) VXLAN.Remote, config_parse_vxlan_address, 0, offsetof(VxLan, remote) VXLAN.TOS, config_parse_unsigned, 0, offsetof(VxLan, tos) diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c index c8d9cd4675..6c18debe3d 100644 --- a/src/network/netdev/vxlan.c +++ b/src/network/netdev/vxlan.c @@ -180,7 +180,7 @@ int config_parse_vxlan_address(const char *unit, return 0; } - v->remote_family = f; + v->group_family = f; } else { if (r > 0) { log_syntax(unit, LOG_ERR, filename, line, 0, "vxlan %s cannot be a multicast address, ignoring assignment: %s", lvalue, rvalue); diff --git a/src/network/netdev/vxlan.h b/src/network/netdev/vxlan.h index 99d16c1ab9..03716f6f89 100644 --- a/src/network/netdev/vxlan.h +++ b/src/network/netdev/vxlan.h @@ -16,9 +16,11 @@ struct VxLan { int remote_family; int local_family; + int group_family; union in_addr_union remote; union in_addr_union local; + union in_addr_union group; unsigned tos; unsigned ttl; From 76fbd4d73d8f941a1c9c1a0166dcf3d7eb62fc38 Mon Sep 17 00:00:00 2001 From: Susant Sahani Date: Mon, 6 May 2019 23:07:32 +0530 Subject: [PATCH 4/8] networkd: VXLan TTL must be <= 255 Ignore when TTL > 255 --- src/network/netdev/vxlan.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c index 6c18debe3d..8fa6e87d92 100644 --- a/src/network/netdev/vxlan.c +++ b/src/network/netdev/vxlan.c @@ -273,10 +273,15 @@ static int netdev_vxlan_verify(NetDev *netdev, const char *filename) { assert(v); assert(filename); - if (v->vni > VXLAN_VID_MAX) { - log_warning("VXLAN without valid VNI (or VXLAN Segment ID) configured in %s. Ignoring", filename); - return -EINVAL; - } + if (v->vni > VXLAN_VID_MAX) + return log_netdev_warning_errno(netdev, SYNTHETIC_ERRNO(EINVAL), + "%s: VXLAN without valid VNI (or VXLAN Segment ID) configured. Ignoring.", + filename); + + if (v->ttl > 255) + return log_netdev_warning_errno(netdev, SYNTHETIC_ERRNO(EINVAL), + "%s: VXLAN TTL must be <= 255. Ignoring.", + filename); return 0; } From 4cc0fd7531bd761f5fc4415b95bcc1dcd9d72e6f Mon Sep 17 00:00:00 2001 From: Susant Sahani Date: Tue, 7 May 2019 00:40:57 +0530 Subject: [PATCH 5/8] networkd: VXLAN add support to configure Generic Protocol Extension See https://tools.ietf.org/html/draft-ietf-nvo3-vxlan-gpe-07 --- man/systemd.netdev.xml | 9 +++++++++ src/network/netdev/netdev-gperf.gperf | 1 + src/network/netdev/vxlan.c | 6 ++++++ src/network/netdev/vxlan.h | 1 + test/fuzz/fuzz-netdev-parser/directives.netdev | 1 + 5 files changed, 18 insertions(+) diff --git a/man/systemd.netdev.xml b/man/systemd.netdev.xml index 1f2f4bd9c8..7fddedf6e8 100644 --- a/man/systemd.netdev.xml +++ b/man/systemd.netdev.xml @@ -655,6 +655,15 @@ VXLAN Group Policy document. Defaults to false. + + GenericProtocolExtension= + + Takes a boolean. When true, Generic Protocol Extension extends the existing VXLAN protocol + to provide protocol typing, OAM, and versioning capabilities. For details about the VXLAN GPE + Header, see the + Generic Protocol Extension for VXLAN document. Defaults to false. + + DestinationPort= diff --git a/src/network/netdev/netdev-gperf.gperf b/src/network/netdev/netdev-gperf.gperf index e71c9d00da..10bd334d4b 100644 --- a/src/network/netdev/netdev-gperf.gperf +++ b/src/network/netdev/netdev-gperf.gperf @@ -119,6 +119,7 @@ VXLAN.RemoteChecksumTx, config_parse_bool, VXLAN.RemoteChecksumRx, config_parse_bool, 0, offsetof(VxLan, remote_csum_rx) VXLAN.FDBAgeingSec, config_parse_sec, 0, offsetof(VxLan, fdb_ageing) VXLAN.GroupPolicyExtension, config_parse_bool, 0, offsetof(VxLan, group_policy) +VXLAN.GenericProtocolExtension, config_parse_bool, 0, offsetof(VxLan, generic_protocol_extension) VXLAN.MaximumFDBEntries, config_parse_unsigned, 0, offsetof(VxLan, max_fdb) VXLAN.PortRange, config_parse_port_range, 0, 0 VXLAN.DestinationPort, config_parse_ip_port, 0, offsetof(VxLan, dest_port) diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c index 8fa6e87d92..86403696a0 100644 --- a/src/network/netdev/vxlan.c +++ b/src/network/netdev/vxlan.c @@ -144,6 +144,12 @@ 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_GBP attribute: %m"); } + if (v->generic_protocol_extension) { + r = sd_netlink_message_append_flag(m, IFLA_VXLAN_GPE); + if (r < 0) + return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_GPE attribute: %m"); + } + return r; } diff --git a/src/network/netdev/vxlan.h b/src/network/netdev/vxlan.h index 03716f6f89..c2dbfaf202 100644 --- a/src/network/netdev/vxlan.h +++ b/src/network/netdev/vxlan.h @@ -42,6 +42,7 @@ struct VxLan { bool remote_csum_tx; bool remote_csum_rx; bool group_policy; + bool generic_protocol_extension; struct ifla_vxlan_port_range port_range; }; diff --git a/test/fuzz/fuzz-netdev-parser/directives.netdev b/test/fuzz/fuzz-netdev-parser/directives.netdev index 0d0bd2c85b..5aa5e9283d 100644 --- a/test/fuzz/fuzz-netdev-parser/directives.netdev +++ b/test/fuzz/fuzz-netdev-parser/directives.netdev @@ -101,6 +101,7 @@ UDP6ZeroChecksumTx= UDP6ZeroCheckSumRx= UDPCheckSum= GroupPolicyExtension= +GenericProtocolExtension= MaximumFDBEntries= TTL= DestinationPort= From 8c32c5884d0f1afc6cd8774e21c2841003334706 Mon Sep 17 00:00:00 2001 From: Susant Sahani Date: Tue, 7 May 2019 14:45:30 +0530 Subject: [PATCH 6/8] networkd: VXLAN use correct type for VNI --- src/network/netdev/netdev-gperf.gperf | 4 ++-- src/network/netdev/vxlan.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/network/netdev/netdev-gperf.gperf b/src/network/netdev/netdev-gperf.gperf index 10bd334d4b..fe5e53f2a8 100644 --- a/src/network/netdev/netdev-gperf.gperf +++ b/src/network/netdev/netdev-gperf.gperf @@ -96,8 +96,8 @@ L2TPSession.Name, config_parse_l2tp_session_name, Peer.Name, config_parse_ifname, 0, offsetof(Veth, ifname_peer) Peer.MACAddress, config_parse_hwaddr, 0, offsetof(Veth, mac_peer) VXCAN.Peer, config_parse_ifname, 0, offsetof(VxCan, ifname_peer) -VXLAN.VNI, config_parse_uint64, 0, offsetof(VxLan, vni) -VXLAN.Id, config_parse_uint64, 0, offsetof(VxLan, vni) /* deprecated */ +VXLAN.VNI, config_parse_uint32, 0, offsetof(VxLan, vni) +VXLAN.Id, config_parse_uint32, 0, offsetof(VxLan, vni) /* deprecated */ VXLAN.Group, config_parse_vxlan_address, 0, offsetof(VxLan, group) VXLAN.Local, config_parse_vxlan_address, 0, offsetof(VxLan, local) VXLAN.Remote, config_parse_vxlan_address, 0, offsetof(VxLan, remote) diff --git a/src/network/netdev/vxlan.h b/src/network/netdev/vxlan.h index c2dbfaf202..ad72a10b2f 100644 --- a/src/network/netdev/vxlan.h +++ b/src/network/netdev/vxlan.h @@ -12,7 +12,7 @@ typedef struct VxLan VxLan; struct VxLan { NetDev meta; - uint64_t vni; + uint32_t vni; int remote_family; int local_family; From 291539b75e31754f245022ecf7e536b28955e602 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 7 May 2019 20:31:32 +0200 Subject: [PATCH 7/8] check-directives: use diff to show what the differences really are This also makes the comparison more detailed, since we check spelling, including case. --- tools/check-directives.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/check-directives.sh b/tools/check-directives.sh index e8c6e60040..46f770222f 100755 --- a/tools/check-directives.sh +++ b/tools/check-directives.sh @@ -10,17 +10,23 @@ function generate_directives() { } ret=0 -if [[ $(generate_directives src/network/networkd-network-gperf.gperf | wc -l) -ne $(wc -l Date: Tue, 7 May 2019 20:33:38 +0200 Subject: [PATCH 8/8] fuzz: fix spelling of MACsec and MACAddress in the corpus --- test/fuzz/fuzz-netdev-parser/directives.netdev | 2 +- test/fuzz/fuzz-network-parser/directives.network | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/fuzz/fuzz-netdev-parser/directives.netdev b/test/fuzz/fuzz-netdev-parser/directives.netdev index 5aa5e9283d..56d4183472 100644 --- a/test/fuzz/fuzz-netdev-parser/directives.netdev +++ b/test/fuzz/fuzz-netdev-parser/directives.netdev @@ -177,7 +177,7 @@ SessionId= PeerSessionId= Layer2SpecificHeader= Name= -[MACSEC] +[MACsec] Port= Encrypt= [MACsecReceiveAssociation] diff --git a/test/fuzz/fuzz-network-parser/directives.network b/test/fuzz/fuzz-network-parser/directives.network index fd3256e784..ee49baa955 100644 --- a/test/fuzz/fuzz-network-parser/directives.network +++ b/test/fuzz/fuzz-network-parser/directives.network @@ -177,7 +177,7 @@ Managed= OtherInformation= [Neighbor] Address= -MacAddress= +MACAddress= [IPv6AddressLabel] Label= Prefix=