1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-22 13:33:56 +03:00

network/bridge: fix UseBPDU= and AllowPortToBeRoot=

Fixes bugs caused by 7f9915f0de.

Fixes #24268.

(cherry picked from commit 3f504b892b)
This commit is contained in:
Yu Watanabe 2022-08-13 05:08:38 +09:00 committed by Zbigniew Jędrzejewski-Szmek
parent b0972e4df0
commit 06dc900efa
3 changed files with 8 additions and 8 deletions

View File

@ -230,7 +230,7 @@ static int link_configure_fill_message(
return r;
if (link->network->use_bpdu >= 0) {
r = sd_netlink_message_append_u8(req, IFLA_BRPORT_GUARD, link->network->use_bpdu);
r = sd_netlink_message_append_u8(req, IFLA_BRPORT_GUARD, !link->network->use_bpdu);
if (r < 0)
return r;
}
@ -254,7 +254,7 @@ static int link_configure_fill_message(
}
if (link->network->allow_port_to_be_root >= 0) {
r = sd_netlink_message_append_u8(req, IFLA_BRPORT_PROTECT, link->network->allow_port_to_be_root);
r = sd_netlink_message_append_u8(req, IFLA_BRPORT_PROTECT, !link->network->allow_port_to_be_root);
if (r < 0)
return r;
}

View File

@ -291,8 +291,8 @@ Priority=23
self.assertEqual(self.read_attr('port2', 'brport/path_cost'), '555')
self.assertEqual(self.read_attr('port2', 'brport/multicast_fast_leave'), '1')
self.assertEqual(self.read_attr('port2', 'brport/unicast_flood'), '1')
self.assertEqual(self.read_attr('port2', 'brport/bpdu_guard'), '1')
self.assertEqual(self.read_attr('port2', 'brport/root_block'), '1')
self.assertEqual(self.read_attr('port2', 'brport/bpdu_guard'), '0')
self.assertEqual(self.read_attr('port2', 'brport/root_block'), '0')
class ClientTestBase(NetworkdTestingUtilities):
"""Provide common methods for testing networkd against servers."""

View File

@ -3892,8 +3892,8 @@ class NetworkdBridgeTests(unittest.TestCase, Utilities):
self.assertEqual(read_bridge_port_attr('bridge99', 'dummy98', 'neigh_suppress'), '1')
self.assertEqual(read_bridge_port_attr('bridge99', 'dummy98', 'learning'), '0')
self.assertEqual(read_bridge_port_attr('bridge99', 'dummy98', 'priority'), '23')
self.assertEqual(read_bridge_port_attr('bridge99', 'dummy98', 'bpdu_guard'), '1')
self.assertEqual(read_bridge_port_attr('bridge99', 'dummy98', 'root_block'), '1')
self.assertEqual(read_bridge_port_attr('bridge99', 'dummy98', 'bpdu_guard'), '0')
self.assertEqual(read_bridge_port_attr('bridge99', 'dummy98', 'root_block'), '0')
def test_bridge_property(self):
copy_unit_to_networkd_unit_path('11-dummy.netdev', '12-dummy.netdev', '26-bridge.netdev',
@ -3931,8 +3931,8 @@ class NetworkdBridgeTests(unittest.TestCase, Utilities):
self.assertEqual(read_bridge_port_attr('bridge99', 'dummy98', 'neigh_suppress'), '1')
self.assertEqual(read_bridge_port_attr('bridge99', 'dummy98', 'learning'), '0')
self.assertEqual(read_bridge_port_attr('bridge99', 'dummy98', 'priority'), '23')
self.assertEqual(read_bridge_port_attr('bridge99', 'dummy98', 'bpdu_guard'), '1')
self.assertEqual(read_bridge_port_attr('bridge99', 'dummy98', 'root_block'), '1')
self.assertEqual(read_bridge_port_attr('bridge99', 'dummy98', 'bpdu_guard'), '0')
self.assertEqual(read_bridge_port_attr('bridge99', 'dummy98', 'root_block'), '0')
output = check_output('bridge -d link show test1')
print(output)