mirror of
https://github.com/systemd/systemd.git
synced 2024-12-25 01:34:28 +03:00
Merge pull request #17073 from ssahani/vxlan
network: Allow vxlan to be created without .network file
This commit is contained in:
commit
dd3b0e2232
@ -819,6 +819,13 @@
|
||||
<para>Accepts the same key in [VXLAN] section.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>Independent=</varname></term>
|
||||
<listitem>
|
||||
<para>Takes a boolean. When true, the vxlan interface is created without underlying interfaces.
|
||||
Defaults to <literal>false</literal>.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
|
@ -134,6 +134,7 @@ VXLAN.PortRange, config_parse_port_range,
|
||||
VXLAN.DestinationPort, config_parse_ip_port, 0, offsetof(VxLan, dest_port)
|
||||
VXLAN.FlowLabel, config_parse_flow_label, 0, 0
|
||||
VXLAN.IPDoNotFragment, config_parse_df, 0, offsetof(VxLan, df)
|
||||
VXLAN.Independent, config_parse_bool, 0, offsetof(VxLan, independent)
|
||||
GENEVE.Id, config_parse_geneve_vni, 0, offsetof(Geneve, id)
|
||||
GENEVE.Remote, config_parse_geneve_address, 0, offsetof(Geneve, remote)
|
||||
GENEVE.TOS, config_parse_uint8, 0, offsetof(Geneve, tos)
|
||||
|
@ -823,6 +823,9 @@ int netdev_load_one(Manager *manager, const char *filename) {
|
||||
case NETDEV_KIND_XFRM:
|
||||
independent = XFRM(netdev)->independent;
|
||||
break;
|
||||
case NETDEV_KIND_VXLAN:
|
||||
independent = VXLAN(netdev)->independent;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -25,7 +25,6 @@ static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_netli
|
||||
int r;
|
||||
|
||||
assert(netdev);
|
||||
assert(link);
|
||||
assert(m);
|
||||
|
||||
v = VXLAN(netdev);
|
||||
@ -63,7 +62,7 @@ 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_LOCAL attribute: %m");
|
||||
}
|
||||
|
||||
r = sd_netlink_message_append_u32(m, IFLA_VXLAN_LINK, link->ifindex);
|
||||
r = sd_netlink_message_append_u32(m, IFLA_VXLAN_LINK, link ? link->ifindex : 0);
|
||||
if (r < 0)
|
||||
return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_LINK attribute: %m");
|
||||
|
||||
|
@ -56,6 +56,7 @@ struct VxLan {
|
||||
bool group_policy;
|
||||
bool generic_protocol_extension;
|
||||
bool inherit;
|
||||
bool independent;
|
||||
|
||||
struct ifla_vxlan_port_range port_range;
|
||||
};
|
||||
|
@ -116,6 +116,7 @@ PortRange=
|
||||
UDPChecksum=
|
||||
UDP6ZeroCheckSumTx=
|
||||
IPDoNotFragment=
|
||||
Independent=
|
||||
[VXCAN]
|
||||
Peer=
|
||||
[Bond]
|
||||
|
17
test/test-network/conf/25-vxlan-independent.netdev
Normal file
17
test/test-network/conf/25-vxlan-independent.netdev
Normal file
@ -0,0 +1,17 @@
|
||||
[NetDev]
|
||||
Name=vxlan98
|
||||
Kind=vxlan
|
||||
|
||||
[VXLAN]
|
||||
VNI=1000
|
||||
L2MissNotification=true
|
||||
L3MissNotification=true
|
||||
RouteShortCircuit=true
|
||||
UDPChecksum=true
|
||||
UDP6ZeroChecksumTx=true
|
||||
UDP6ZeroChecksumRx=true
|
||||
RemoteChecksumTx=true
|
||||
RemoteChecksumRx=true
|
||||
GroupPolicyExtension=true
|
||||
DestinationPort=5556
|
||||
Independent=yes
|
@ -14,6 +14,7 @@ Name=ifb99
|
||||
Name=ipiptun99
|
||||
Name=nlmon99
|
||||
Name=xfrm99
|
||||
Name=vxlan98
|
||||
Name=hogehogehogehogehogehoge
|
||||
|
||||
[Network]
|
||||
|
@ -785,6 +785,7 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
|
||||
'vtitun98',
|
||||
'vtitun99',
|
||||
'vxcan99',
|
||||
'vxlan98',
|
||||
'vxlan99',
|
||||
'wg97',
|
||||
'wg98',
|
||||
@ -870,6 +871,7 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
|
||||
'25-vti-tunnel-remote-any.netdev',
|
||||
'25-vti-tunnel.netdev',
|
||||
'25-vxcan.netdev',
|
||||
'25-vxlan-independent.netdev',
|
||||
'25-vxlan.netdev',
|
||||
'25-wireguard-23-peers.netdev',
|
||||
'25-wireguard-23-peers.network',
|
||||
@ -1516,10 +1518,11 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
|
||||
|
||||
def test_vxlan(self):
|
||||
copy_unit_to_networkd_unit_path('25-vxlan.netdev', 'vxlan.network',
|
||||
'25-vxlan-independent.netdev', 'netdev-link-local-addressing-yes.network',
|
||||
'11-dummy.netdev', 'vxlan-test1.network')
|
||||
start_networkd()
|
||||
|
||||
self.wait_online(['test1:degraded', 'vxlan99:degraded'])
|
||||
self.wait_online(['test1:degraded', 'vxlan99:degraded', 'vxlan98:degraded'])
|
||||
|
||||
output = check_output('ip -d link show vxlan99')
|
||||
print(output)
|
||||
@ -1546,6 +1549,9 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
|
||||
self.assertRegex(output, 'Destination Port: 5555')
|
||||
self.assertRegex(output, 'Underlying Device: test1')
|
||||
|
||||
output = check_output('ip -d link show vxlan98')
|
||||
print(output)
|
||||
|
||||
def test_macsec(self):
|
||||
copy_unit_to_networkd_unit_path('25-macsec.netdev', '25-macsec.network', '25-macsec.key',
|
||||
'macsec.network', '12-dummy.netdev')
|
||||
|
Loading…
Reference in New Issue
Block a user