Merge pull request #12489 from ssahani/vxlan

networkd: VXLAN rename Id to VNI
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2019-05-08 12:02:54 +02:00
committed by GitHub
8 changed files with 58 additions and 19 deletions
+17 -2
View File
@@ -527,9 +527,9 @@
<variablelist class='network-directives'>
<varlistentry>
<term><varname>Id=</varname></term>
<term><varname>VNI=</varname></term>
<listitem>
<para>The VXLAN ID to use.</para>
<para>The VXLAN Network Identifier (or VXLAN Segment ID). Takes a number in the range 1-16777215.</para>
</listitem>
</varlistentry>
<varlistentry>
@@ -543,6 +543,12 @@
<listitem>
<para>Configures local IP address.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>Group=</varname></term>
<listitem>
<para>Configures VXLAN multicast group IP address. All members of a VXLAN must use the same multicast group address.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>TOS=</varname></term>
@@ -649,6 +655,15 @@
VXLAN Group Policy </ulink> document. Defaults to false.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>GenericProtocolExtension=</varname></term>
<listitem>
<para>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 <ulink url="https://tools.ietf.org/html/draft-ietf-nvo3-vxlan-gpe-07">
Generic Protocol Extension for VXLAN </ulink> document. Defaults to false.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>DestinationPort=</varname></term>
<listitem>
+4 -2
View File
@@ -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)
+19 -8
View File
@@ -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;
+4 -1
View File
@@ -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;
};
@@ -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]
@@ -178,7 +178,7 @@ Managed=
OtherInformation=
[Neighbor]
Address=
MacAddress=
MACAddress=
[IPv6AddressLabel]
Label=
Prefix=
+1 -1
View File
@@ -3,7 +3,7 @@ Name=vxlan99
Kind=vxlan
[VXLAN]
Id=999
VNI=999
L2MissNotification=true
L3MissNotification=true
RouteShortCircuit=true
+9 -3
View File
@@ -10,17 +10,23 @@ function generate_directives() {
}
ret=0
if [[ $(generate_directives src/network/networkd-network-gperf.gperf | wc -l) -ne $(wc -l <test/fuzz/fuzz-network-parser/directives.network) ]]; then
if ! diff \
<(generate_directives src/network/networkd-network-gperf.gperf | sort) \
<(cat test/fuzz/fuzz-network-parser/directives.network | sort); then
echo "Looks like test/fuzz/fuzz-network-parser/directives.network hasn't been updated"
ret=1
fi
if [[ $(generate_directives src/network/netdev/netdev-gperf.gperf | wc -l) -ne $(wc -l <test/fuzz/fuzz-netdev-parser/directives.netdev) ]]; then
if ! diff \
<(generate_directives src/network/netdev/netdev-gperf.gperf | sort) \
<(cat test/fuzz/fuzz-netdev-parser/directives.netdev | sort); then
echo "Looks like test/fuzz/fuzz-netdev-parser/directives.netdev hasn't been updated"
ret=1
fi
if [[ $(generate_directives src/udev/net/link-config-gperf.gperf | wc -l) -ne $(wc -l <test/fuzz/fuzz-link-parser/directives.link) ]]; then
if ! diff \
<(generate_directives src/udev/net/link-config-gperf.gperf | sort) \
<(cat test/fuzz/fuzz-link-parser/directives.link | sort) ; then
echo "Looks like test/fuzz/fuzz-link-parser/directives.link hasn't been updated"
ret=1
fi