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

networkd: Bridge Property Use kernel defaults. (#8825)

Rather than choosing to set or unset any of these flag
use kernel defaults. This patch makes following properties to unset.

UseBPDU = unset
HairPin = unset
FastLeave = unset
AllowPortToBeRoot = unset
UnicastFlood = unset
This commit is contained in:
Susant Sahani 2018-04-27 14:02:28 +05:30 committed by Zbigniew Jędrzejewski-Szmek
parent 385f3a0d8d
commit 7f9915f0de
5 changed files with 47 additions and 33 deletions

View File

@ -1634,7 +1634,7 @@
<listitem> <listitem>
<para>A boolean. Controls whether the bridge should flood <para>A boolean. Controls whether the bridge should flood
traffic for which an FDB entry is missing and the destination traffic for which an FDB entry is missing and the destination
is unknown through this port. Defaults to on. is unknown through this port. Defaults to unset.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@ -1642,7 +1642,7 @@
<term><varname>HairPin=</varname></term> <term><varname>HairPin=</varname></term>
<listitem> <listitem>
<para>A boolean. Configures whether traffic may be sent back <para>A boolean. Configures whether traffic may be sent back
out of the port on which it was received. By default, this out of the port on which it was received. Defaults to unset. When this
flag is false, and the bridge will not forward traffic back flag is false, and the bridge will not forward traffic back
out of the receiving port.</para> out of the receiving port.</para>
</listitem> </listitem>
@ -1651,7 +1651,7 @@
<term><varname>UseBPDU=</varname></term> <term><varname>UseBPDU=</varname></term>
<listitem> <listitem>
<para>A boolean. Configures whether STP Bridge Protocol Data Units will be <para>A boolean. Configures whether STP Bridge Protocol Data Units will be
processed by the bridge port. Defaults to yes.</para> processed by the bridge port. Defaults to unset.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
@ -1659,7 +1659,7 @@
<listitem> <listitem>
<para>A boolean. This flag allows the bridge to immediately stop multicast <para>A boolean. This flag allows the bridge to immediately stop multicast
traffic on a port that receives an IGMP Leave message. It is only used with traffic on a port that receives an IGMP Leave message. It is only used with
IGMP snooping if enabled on the bridge. Defaults to off.</para> IGMP snooping if enabled on the bridge. Defaults to unset.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
@ -1667,7 +1667,7 @@
<listitem> <listitem>
<para>A boolean. Configures whether a given port is allowed to <para>A boolean. Configures whether a given port is allowed to
become a root port. Only used when STP is enabled on the bridge. become a root port. Only used when STP is enabled on the bridge.
Defaults to on.</para> Defaults to unset.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>

View File

@ -1401,26 +1401,38 @@ static int link_set_bridge(Link *link) {
if (r < 0) if (r < 0)
return log_link_error_errno(link, r, "Could not append IFLA_PROTINFO attribute: %m"); return log_link_error_errno(link, r, "Could not append IFLA_PROTINFO attribute: %m");
r = sd_netlink_message_append_u8(req, IFLA_BRPORT_GUARD, !link->network->use_bpdu); if (link->network->use_bpdu >= 0) {
r = sd_netlink_message_append_u8(req, IFLA_BRPORT_GUARD, link->network->use_bpdu);
if (r < 0) if (r < 0)
return log_link_error_errno(link, r, "Could not append IFLA_BRPORT_GUARD attribute: %m"); return log_link_error_errno(link, r, "Could not append IFLA_BRPORT_GUARD attribute: %m");
}
if (link->network->hairpin >= 0) {
r = sd_netlink_message_append_u8(req, IFLA_BRPORT_MODE, link->network->hairpin); r = sd_netlink_message_append_u8(req, IFLA_BRPORT_MODE, link->network->hairpin);
if (r < 0) if (r < 0)
return log_link_error_errno(link, r, "Could not append IFLA_BRPORT_MODE attribute: %m"); return log_link_error_errno(link, r, "Could not append IFLA_BRPORT_MODE attribute: %m");
}
if (link->network->fast_leave >= 0) {
r = sd_netlink_message_append_u8(req, IFLA_BRPORT_FAST_LEAVE, link->network->fast_leave); r = sd_netlink_message_append_u8(req, IFLA_BRPORT_FAST_LEAVE, link->network->fast_leave);
if (r < 0) if (r < 0)
return log_link_error_errno(link, r, "Could not append IFLA_BRPORT_FAST_LEAVE attribute: %m"); return log_link_error_errno(link, r, "Could not append IFLA_BRPORT_FAST_LEAVE attribute: %m");
}
r = sd_netlink_message_append_u8(req, IFLA_BRPORT_PROTECT, !link->network->allow_port_to_be_root); 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);
if (r < 0) if (r < 0)
return log_link_error_errno(link, r, "Could not append IFLA_BRPORT_PROTECT attribute: %m"); return log_link_error_errno(link, r, "Could not append IFLA_BRPORT_PROTECT attribute: %m");
}
if (link->network->unicast_flood >= 0) {
r = sd_netlink_message_append_u8(req, IFLA_BRPORT_UNICAST_FLOOD, link->network->unicast_flood); r = sd_netlink_message_append_u8(req, IFLA_BRPORT_UNICAST_FLOOD, link->network->unicast_flood);
if (r < 0) if (r < 0)
return log_link_error_errno(link, r, "Could not append IFLA_BRPORT_UNICAST_FLOOD attribute: %m"); return log_link_error_errno(link, r, "Could not append IFLA_BRPORT_UNICAST_FLOOD attribute: %m");
}
if (link->network->cost != 0) { if (link->network->cost != 0) {
r = sd_netlink_message_append_u32(req, IFLA_BRPORT_COST, link->network->cost); r = sd_netlink_message_append_u32(req, IFLA_BRPORT_COST, link->network->cost);
if (r < 0) if (r < 0)

View File

@ -148,11 +148,11 @@ DHCPServer.Timezone, config_parse_timezone,
DHCPServer.PoolOffset, config_parse_uint32, 0, offsetof(Network, dhcp_server_pool_offset) DHCPServer.PoolOffset, config_parse_uint32, 0, offsetof(Network, dhcp_server_pool_offset)
DHCPServer.PoolSize, config_parse_uint32, 0, offsetof(Network, dhcp_server_pool_size) DHCPServer.PoolSize, config_parse_uint32, 0, offsetof(Network, dhcp_server_pool_size)
Bridge.Cost, config_parse_uint32, 0, offsetof(Network, cost) Bridge.Cost, config_parse_uint32, 0, offsetof(Network, cost)
Bridge.UseBPDU, config_parse_bool, 0, offsetof(Network, use_bpdu) Bridge.UseBPDU, config_parse_tristate, 0, offsetof(Network, use_bpdu)
Bridge.HairPin, config_parse_bool, 0, offsetof(Network, hairpin) Bridge.HairPin, config_parse_tristate, 0, offsetof(Network, hairpin)
Bridge.FastLeave, config_parse_bool, 0, offsetof(Network, fast_leave) Bridge.FastLeave, config_parse_tristate, 0, offsetof(Network, fast_leave)
Bridge.AllowPortToBeRoot, config_parse_bool, 0, offsetof(Network, allow_port_to_be_root) Bridge.AllowPortToBeRoot, config_parse_tristate, 0, offsetof(Network, allow_port_to_be_root)
Bridge.UnicastFlood, config_parse_bool, 0, offsetof(Network, unicast_flood) Bridge.UnicastFlood, config_parse_tristate, 0, offsetof(Network, unicast_flood)
Bridge.Priority, config_parse_bridge_port_priority, 0, offsetof(Network, priority) Bridge.Priority, config_parse_bridge_port_priority, 0, offsetof(Network, priority)
BridgeFDB.MACAddress, config_parse_fdb_hwaddr, 0, 0 BridgeFDB.MACAddress, config_parse_fdb_hwaddr, 0, 0
BridgeFDB.VLANId, config_parse_fdb_vlan_id, 0, 0 BridgeFDB.VLANId, config_parse_fdb_vlan_id, 0, 0

View File

@ -224,9 +224,11 @@ static int network_load_one(Manager *manager, const char *filename) {
network->router_emit_dns = true; network->router_emit_dns = true;
network->router_emit_domains = true; network->router_emit_domains = true;
network->use_bpdu = true; network->use_bpdu = -1;
network->allow_port_to_be_root = true; network->hairpin = -1;
network->unicast_flood = true; network->fast_leave = -1;
network->allow_port_to_be_root = -1;
network->unicast_flood = -1;
network->priority = LINK_BRIDGE_PORT_PRIORITY_INVALID; network->priority = LINK_BRIDGE_PORT_PRIORITY_INVALID;
network->lldp_mode = LLDP_MODE_ROUTERS_ONLY; network->lldp_mode = LLDP_MODE_ROUTERS_ONLY;

View File

@ -177,11 +177,11 @@ struct Network {
char **router_search_domains; char **router_search_domains;
/* Bridge Support */ /* Bridge Support */
bool use_bpdu; int use_bpdu;
bool hairpin; int hairpin;
bool fast_leave; int fast_leave;
bool allow_port_to_be_root; int allow_port_to_be_root;
bool unicast_flood; int unicast_flood;
uint32_t cost; uint32_t cost;
uint16_t priority; uint16_t priority;