network: bridge: add support for IFLA_BRPORT_MAB

Since linux commit a35ec8e38cdd1766f29924ca391a01de20163931 ("bridge:
Add MAC Authentication Bypass (MAB) support"), included since v6.2, it
is possible to enable MAC Authentication Bypass for bridge ports. In
this mode the locked port learns again, but the learned fdb entries are
locked, allowing user space to unlock hosts based seen MAC addresses.

This requires learning to be enabled on the port, and link-local
learning disabled for the bridge.

Add support to systemd-network for setting the new attribute for bridge
ports.
This commit is contained in:
Jonas Gorski
2025-01-28 12:22:26 +01:00
parent a434de6056
commit 08a26ecc47
8 changed files with 22 additions and 0 deletions
+1
View File
@@ -384,6 +384,7 @@ Bridge.ProxyARPWiFi, config_parse_tristate,
Bridge.Priority, config_parse_bridge_port_priority, 0, offsetof(Network, 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)
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
+1
View File
@@ -457,6 +457,7 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi
.priority = LINK_BRIDGE_PORT_PRIORITY_INVALID,
.multicast_router = _MULTICAST_ROUTER_INVALID,
.bridge_locked = -1,
.bridge_mac_authentication_bypass = -1,
.bridge_vlan_pvid = BRIDGE_VLAN_KEEP_PVID,
+1
View File
@@ -298,6 +298,7 @@ struct Network {
uint16_t priority;
MulticastRouter multicast_router;
int bridge_locked;
int bridge_mac_authentication_bypass;
/* Bridge VLAN */
uint16_t bridge_vlan_pvid;
+6
View File
@@ -326,6 +326,12 @@ static int link_configure_fill_message(
return r;
}
if (link->network->bridge_mac_authentication_bypass >= 0) {
r = sd_netlink_message_append_u8(req, IFLA_BRPORT_MAB, link->network->bridge_mac_authentication_bypass);
if (r < 0)
return r;
}
r = sd_netlink_message_close_container(req);
if (r < 0)
return r;