mirror of
https://github.com/systemd/systemd.git
synced 2024-12-23 21:35:11 +03:00
networkd: bridge add support to configure multicast_to_unicast
closes #10649
This commit is contained in:
parent
a365325e04
commit
d3aa8b49e5
@ -1723,6 +1723,15 @@
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>MulticastToUnicast=</varname></term>
|
||||
<listitem>
|
||||
<para>Takes a boolean. Multicast to unicast works on top of the multicast snooping feature of
|
||||
the bridge. Which means unicast copies are only delivered to hosts which are interested in it.
|
||||
When unset, the kernel's default will be used.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>HairPin=</varname></term>
|
||||
<listitem>
|
||||
|
@ -412,17 +412,40 @@ static const NLTypeSystem rtnl_link_info_type_system = {
|
||||
};
|
||||
|
||||
static const struct NLType rtnl_prot_info_bridge_port_types[] = {
|
||||
[IFLA_BRPORT_STATE] = { .type = NETLINK_TYPE_U8 },
|
||||
[IFLA_BRPORT_COST] = { .type = NETLINK_TYPE_U32 },
|
||||
[IFLA_BRPORT_PRIORITY] = { .type = NETLINK_TYPE_U16 },
|
||||
[IFLA_BRPORT_MODE] = { .type = NETLINK_TYPE_U8 },
|
||||
[IFLA_BRPORT_GUARD] = { .type = NETLINK_TYPE_U8 },
|
||||
[IFLA_BRPORT_PROTECT] = { .type = NETLINK_TYPE_U8 },
|
||||
[IFLA_BRPORT_FAST_LEAVE] = { .type = NETLINK_TYPE_U8 },
|
||||
[IFLA_BRPORT_LEARNING] = { .type = NETLINK_TYPE_U8 },
|
||||
[IFLA_BRPORT_UNICAST_FLOOD] = { .type = NETLINK_TYPE_U8 },
|
||||
[IFLA_BRPORT_PROXYARP] = { .type = NETLINK_TYPE_U8 },
|
||||
[IFLA_BRPORT_LEARNING_SYNC] = { .type = NETLINK_TYPE_U8 },
|
||||
[IFLA_BRPORT_STATE] = { .type = NETLINK_TYPE_U8 },
|
||||
[IFLA_BRPORT_COST] = { .type = NETLINK_TYPE_U32 },
|
||||
[IFLA_BRPORT_PRIORITY] = { .type = NETLINK_TYPE_U16 },
|
||||
[IFLA_BRPORT_MODE] = { .type = NETLINK_TYPE_U8 },
|
||||
[IFLA_BRPORT_GUARD] = { .type = NETLINK_TYPE_U8 },
|
||||
[IFLA_BRPORT_PROTECT] = { .type = NETLINK_TYPE_U8 },
|
||||
[IFLA_BRPORT_FAST_LEAVE] = { .type = NETLINK_TYPE_U8 },
|
||||
[IFLA_BRPORT_LEARNING] = { .type = NETLINK_TYPE_U8 },
|
||||
[IFLA_BRPORT_UNICAST_FLOOD] = { .type = NETLINK_TYPE_U8 },
|
||||
[IFLA_BRPORT_PROXYARP] = { .type = NETLINK_TYPE_U8 },
|
||||
[IFLA_BRPORT_LEARNING_SYNC] = { .type = NETLINK_TYPE_U8 },
|
||||
[IFLA_BRPORT_PROXYARP_WIFI] = { .type = NETLINK_TYPE_U8 },
|
||||
[IFLA_BRPORT_ROOT_ID] = { .type = NETLINK_TYPE_U8 },
|
||||
[IFLA_BRPORT_BRIDGE_ID] = { .type = NETLINK_TYPE_U8 },
|
||||
[IFLA_BRPORT_DESIGNATED_PORT] = { .type = NETLINK_TYPE_U16 },
|
||||
[IFLA_BRPORT_DESIGNATED_COST] = { .type = NETLINK_TYPE_U16 },
|
||||
[IFLA_BRPORT_ID] = { .type = NETLINK_TYPE_U16 },
|
||||
[IFLA_BRPORT_NO] = { .type = NETLINK_TYPE_U16 },
|
||||
[IFLA_BRPORT_TOPOLOGY_CHANGE_ACK] = { .type = NETLINK_TYPE_U8 },
|
||||
[IFLA_BRPORT_CONFIG_PENDING] = { .type = NETLINK_TYPE_U8 },
|
||||
[IFLA_BRPORT_MESSAGE_AGE_TIMER] = { .type = NETLINK_TYPE_U64 },
|
||||
[IFLA_BRPORT_FORWARD_DELAY_TIMER] = { .type = NETLINK_TYPE_U64 },
|
||||
[IFLA_BRPORT_HOLD_TIMER] = { .type = NETLINK_TYPE_U64 },
|
||||
[IFLA_BRPORT_FLUSH] = { .type = NETLINK_TYPE_U8 },
|
||||
[IFLA_BRPORT_MULTICAST_ROUTER] = { .type = NETLINK_TYPE_U8 },
|
||||
[IFLA_BRPORT_PAD] = { .type = NETLINK_TYPE_U8 },
|
||||
[IFLA_BRPORT_MCAST_FLOOD] = { .type = NETLINK_TYPE_U8 },
|
||||
[IFLA_BRPORT_MCAST_TO_UCAST] = { .type = NETLINK_TYPE_U8 },
|
||||
[IFLA_BRPORT_VLAN_TUNNEL] = { .type = NETLINK_TYPE_U8 },
|
||||
[IFLA_BRPORT_BCAST_FLOOD] = { .type = NETLINK_TYPE_U8 },
|
||||
[IFLA_BRPORT_GROUP_FWD_MASK] = { .type = NETLINK_TYPE_U16 },
|
||||
[IFLA_BRPORT_NEIGH_SUPPRESS] = { .type = NETLINK_TYPE_U8 },
|
||||
[IFLA_BRPORT_ISOLATED] = { .type = NETLINK_TYPE_U8 },
|
||||
[IFLA_BRPORT_BACKUP_PORT] = { .type = NETLINK_TYPE_U32 },
|
||||
};
|
||||
|
||||
static const NLTypeSystem rtnl_prot_info_type_systems[] = {
|
||||
|
@ -1421,7 +1421,12 @@ static int link_set_bridge(Link *link) {
|
||||
r = sd_netlink_message_append_u8(req, IFLA_BRPORT_UNICAST_FLOOD, link->network->unicast_flood);
|
||||
if (r < 0)
|
||||
return log_link_error_errno(link, r, "Could not append IFLA_BRPORT_UNICAST_FLOOD attribute: %m");
|
||||
}
|
||||
|
||||
if (link->network->multicast_to_unicast >= 0) {
|
||||
r = sd_netlink_message_append_u8(req, IFLA_BRPORT_MCAST_TO_UCAST, link->network->multicast_to_unicast);
|
||||
if (r < 0)
|
||||
return log_link_error_errno(link, r, "Could not append IFLA_BRPORT_MCAST_TO_UCAST attribute: %m");
|
||||
}
|
||||
|
||||
if (link->network->cost != 0) {
|
||||
@ -1429,6 +1434,7 @@ static int link_set_bridge(Link *link) {
|
||||
if (r < 0)
|
||||
return log_link_error_errno(link, r, "Could not append IFLA_BRPORT_COST attribute: %m");
|
||||
}
|
||||
|
||||
if (link->network->priority != LINK_BRIDGE_PORT_PRIORITY_INVALID) {
|
||||
r = sd_netlink_message_append_u16(req, IFLA_BRPORT_PRIORITY, link->network->priority);
|
||||
if (r < 0)
|
||||
|
@ -162,6 +162,7 @@ Bridge.HairPin, config_parse_tristate,
|
||||
Bridge.FastLeave, config_parse_tristate, 0, offsetof(Network, fast_leave)
|
||||
Bridge.AllowPortToBeRoot, config_parse_tristate, 0, offsetof(Network, allow_port_to_be_root)
|
||||
Bridge.UnicastFlood, config_parse_tristate, 0, offsetof(Network, unicast_flood)
|
||||
Bridge.MulticastToUnicast, config_parse_tristate, 0, offsetof(Network, multicast_to_unicast)
|
||||
Bridge.Priority, config_parse_bridge_port_priority, 0, offsetof(Network, priority)
|
||||
BridgeFDB.MACAddress, config_parse_fdb_hwaddr, 0, 0
|
||||
BridgeFDB.VLANId, config_parse_fdb_vlan_id, 0, 0
|
||||
|
@ -162,6 +162,7 @@ int network_load_one(Manager *manager, const char *filename) {
|
||||
.fast_leave = -1,
|
||||
.allow_port_to_be_root = -1,
|
||||
.unicast_flood = -1,
|
||||
.multicast_to_unicast = -1,
|
||||
.priority = LINK_BRIDGE_PORT_PRIORITY_INVALID,
|
||||
|
||||
.lldp_mode = LLDP_MODE_ROUTERS_ONLY,
|
||||
|
@ -183,6 +183,7 @@ struct Network {
|
||||
int fast_leave;
|
||||
int allow_port_to_be_root;
|
||||
int unicast_flood;
|
||||
int multicast_to_unicast;
|
||||
uint32_t cost;
|
||||
uint16_t priority;
|
||||
|
||||
|
@ -9,3 +9,4 @@ Cost=400
|
||||
HairPin = true
|
||||
FastLeave = true
|
||||
UnicastFlood = true
|
||||
MulticastToUnicast = true
|
||||
|
@ -6,6 +6,7 @@ UnicastFlood=
|
||||
FastLeave=
|
||||
Priority=
|
||||
AllowPortToBeRoot=
|
||||
MulticastToUnicast=
|
||||
[Match]
|
||||
KernelVersion=
|
||||
Type=
|
||||
|
@ -417,6 +417,7 @@ Group=
|
||||
GroupForwardMask=
|
||||
GroupPolicyExtension=
|
||||
HairPin=
|
||||
MulticastToUnicast=
|
||||
HelloTimeSec=
|
||||
HomeAddress=
|
||||
Host=
|
||||
|
Loading…
Reference in New Issue
Block a user