mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 00:14:32 +09:00
networkd: add support for setting vlan_tunnel on bridge ports
This commit is contained in:
committed by
Yu Watanabe
parent
2e3efb1884
commit
c88adbc01d
@@ -4644,6 +4644,15 @@ ServerAddress=192.168.0.1/24</programlisting>
|
||||
clearing the locked flag. Requires Learning to be enabled. When unset, the kernel's default will be
|
||||
used.</para>
|
||||
|
||||
<xi:include href="version-info.xml" xpointer="v258"/>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>VLANTunnel=</varname></term>
|
||||
<listitem>
|
||||
<para>Takes a boolean. Configures whether vlan tunnel mode is to be enabled on this port.
|
||||
When unset, the kernel's default will be used.</para>
|
||||
|
||||
<xi:include href="version-info.xml" xpointer="v258"/>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
@@ -386,6 +386,7 @@ Bridge.Priority, config_parse_bridge_port_priority,
|
||||
Bridge.MulticastRouter, config_parse_multicast_router, 0, offsetof(Network, multicast_router)
|
||||
Bridge.Locked, config_parse_tristate, 0, offsetof(Network, bridge_locked)
|
||||
Bridge.MACAuthenticationBypass, config_parse_tristate, 0, offsetof(Network, bridge_mac_authentication_bypass)
|
||||
Bridge.VLANTunnel, config_parse_tristate, 0, offsetof(Network, bridge_vlan_tunnel)
|
||||
BridgeFDB.MACAddress, config_parse_fdb_hwaddr, 0, 0
|
||||
BridgeFDB.VLANId, config_parse_fdb_vlan_id, 0, 0
|
||||
BridgeFDB.Destination, config_parse_fdb_destination, 0, 0
|
||||
|
||||
@@ -458,6 +458,7 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi
|
||||
.multicast_router = _MULTICAST_ROUTER_INVALID,
|
||||
.bridge_locked = -1,
|
||||
.bridge_mac_authentication_bypass = -1,
|
||||
.bridge_vlan_tunnel = -1,
|
||||
|
||||
.bridge_vlan_pvid = BRIDGE_VLAN_KEEP_PVID,
|
||||
|
||||
|
||||
@@ -299,6 +299,7 @@ struct Network {
|
||||
MulticastRouter multicast_router;
|
||||
int bridge_locked;
|
||||
int bridge_mac_authentication_bypass;
|
||||
int bridge_vlan_tunnel;
|
||||
|
||||
/* Bridge VLAN */
|
||||
uint16_t bridge_vlan_pvid;
|
||||
|
||||
@@ -332,6 +332,12 @@ static int link_configure_fill_message(
|
||||
return r;
|
||||
}
|
||||
|
||||
if (link->network->bridge_vlan_tunnel >= 0) {
|
||||
r = sd_netlink_message_append_u8(req, IFLA_BRPORT_VLAN_TUNNEL, link->network->bridge_vlan_tunnel);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
r = sd_netlink_message_close_container(req);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
4
test/test-network/conf/14-dummy.netdev
Normal file
4
test/test-network/conf/14-dummy.netdev
Normal file
@@ -0,0 +1,4 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
[NetDev]
|
||||
Name=dummy97
|
||||
Kind=dummy
|
||||
11
test/test-network/conf/26-bridge-vlan-tunnel.network
Normal file
11
test/test-network/conf/26-bridge-vlan-tunnel.network
Normal file
@@ -0,0 +1,11 @@
|
||||
[Match]
|
||||
Name=dummy97
|
||||
|
||||
[Link]
|
||||
MTUBytes=9000
|
||||
|
||||
[Network]
|
||||
Bridge=bridge99
|
||||
|
||||
[Bridge]
|
||||
VLANTunnel=true
|
||||
@@ -6027,7 +6027,7 @@ class NetworkdBridgeTests(unittest.TestCase, Utilities):
|
||||
def test_bridge_property(self):
|
||||
copy_network_unit('11-dummy.netdev', '12-dummy.netdev', '26-bridge.netdev',
|
||||
'26-bridge-slave-interface-1.network', '26-bridge-slave-interface-2.network',
|
||||
'25-bridge99.network')
|
||||
'25-bridge99.network', '14-dummy.netdev', '26-bridge-vlan-tunnel.network')
|
||||
start_networkd()
|
||||
self.check_bridge_property()
|
||||
|
||||
@@ -6038,6 +6038,7 @@ class NetworkdBridgeTests(unittest.TestCase, Utilities):
|
||||
'26-bridge.netdev',
|
||||
'26-bridge-slave-interface-1.network',
|
||||
'26-bridge-slave-interface-2.network',
|
||||
'26-bridge-vlan-tunnel.network',
|
||||
'25-bridge99.network')
|
||||
networkctl_reload()
|
||||
self.check_bridge_property()
|
||||
@@ -6066,7 +6067,11 @@ class NetworkdBridgeTests(unittest.TestCase, Utilities):
|
||||
self.assertIn('bridge_slave', output)
|
||||
self.assertIn('mtu 9000 ', output)
|
||||
|
||||
output = check_output('ip -d link show dummy97')
|
||||
self.assertIn('vlan_tunnel on ', output)
|
||||
|
||||
remove_link('dummy98')
|
||||
remove_link('dummy97')
|
||||
self.wait_operstate('bridge99', 'no-carrier')
|
||||
|
||||
output = check_output('ip -d link show bridge99')
|
||||
|
||||
Reference in New Issue
Block a user