diff --git a/man/systemd.netdev.xml b/man/systemd.netdev.xml index 0bbfc611f8..7fddedf6e8 100644 --- a/man/systemd.netdev.xml +++ b/man/systemd.netdev.xml @@ -527,9 +527,9 @@ - Id= + VNI= - The VXLAN ID to use. + The VXLAN Network Identifier (or VXLAN Segment ID). Takes a number in the range 1-16777215. @@ -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= @@ -649,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 16636601a0..fe5e53f2a8 100644 --- a/src/network/netdev/netdev-gperf.gperf +++ b/src/network/netdev/netdev-gperf.gperf @@ -96,8 +96,9 @@ 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.Group, config_parse_vxlan_address, 0, offsetof(VxLan, remote) +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) VXLAN.TOS, config_parse_unsigned, 0, offsetof(VxLan, tos) @@ -118,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 4b855ae1e1..86403696a0 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"); } @@ -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; } @@ -180,7 +186,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); @@ -273,10 +279,15 @@ 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); - 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; } @@ -290,7 +301,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..ad72a10b2f 100644 --- a/src/network/netdev/vxlan.h +++ b/src/network/netdev/vxlan.h @@ -12,13 +12,15 @@ typedef struct VxLan VxLan; struct VxLan { NetDev meta; - uint64_t id; + uint32_t vni; 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; @@ -40,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 ab7d9f6fc9..56d4183472 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= @@ -100,6 +101,7 @@ UDP6ZeroChecksumTx= UDP6ZeroCheckSumRx= UDPCheckSum= GroupPolicyExtension= +GenericProtocolExtension= MaximumFDBEntries= TTL= DestinationPort= @@ -175,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 17f21b4258..9296c16c49 100644 --- a/test/fuzz/fuzz-network-parser/directives.network +++ b/test/fuzz/fuzz-network-parser/directives.network @@ -178,7 +178,7 @@ Managed= OtherInformation= [Neighbor] Address= -MacAddress= +MACAddress= [IPv6AddressLabel] Label= Prefix= 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 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