1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-10-28 03:25:27 +03:00

networkd: add support to set STP (#3903)

fixes #3881
This commit is contained in:
Susant Sahani 2016-08-06 05:14:57 +05:30 committed by Lennart Poettering
parent ceab9e2dee
commit b760a9af90
4 changed files with 17 additions and 1 deletions

View File

@ -343,8 +343,15 @@
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><varname>STP=</varname></term>
<listitem>
<para>A boolean. This enables the bridge's Spanning Tree Protocol (STP). When unset,
the kernel's default setting applies.
</para>
</listitem>
</varlistentry>
</variablelist> </variablelist>
</refsect1> </refsect1>
<refsect1> <refsect1>

View File

@ -108,6 +108,12 @@ static int netdev_bridge_post_create(NetDev *netdev, Link *link, sd_netlink_mess
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BR_VLAN_FILTERING attribute: %m"); return log_netdev_error_errno(netdev, r, "Could not append IFLA_BR_VLAN_FILTERING attribute: %m");
} }
if (b->stp >= 0) {
r = sd_netlink_message_append_u32(req, IFLA_BR_STP_STATE, b->stp);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BR_STP_STATE attribute: %m");
}
r = sd_netlink_message_close_container(req); r = sd_netlink_message_close_container(req);
if (r < 0) if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_LINKINFO attribute: %m"); return log_netdev_error_errno(netdev, r, "Could not append IFLA_LINKINFO attribute: %m");
@ -135,6 +141,7 @@ static void bridge_init(NetDev *n) {
b->mcast_querier = -1; b->mcast_querier = -1;
b->mcast_snooping = -1; b->mcast_snooping = -1;
b->vlan_filtering = -1; b->vlan_filtering = -1;
b->stp = -1;
} }
const NetDevVTable bridge_vtable = { const NetDevVTable bridge_vtable = {

View File

@ -27,6 +27,7 @@ typedef struct Bridge {
int mcast_querier; int mcast_querier;
int mcast_snooping; int mcast_snooping;
int vlan_filtering; int vlan_filtering;
int stp;
usec_t forward_delay; usec_t forward_delay;
usec_t hello_time; usec_t hello_time;

View File

@ -106,4 +106,5 @@ Bridge.ForwardDelaySec, config_parse_sec, 0,
Bridge.MulticastQuerier, config_parse_tristate, 0, offsetof(Bridge, mcast_querier) Bridge.MulticastQuerier, config_parse_tristate, 0, offsetof(Bridge, mcast_querier)
Bridge.MulticastSnooping, config_parse_tristate, 0, offsetof(Bridge, mcast_snooping) Bridge.MulticastSnooping, config_parse_tristate, 0, offsetof(Bridge, mcast_snooping)
Bridge.VLANFiltering, config_parse_tristate, 0, offsetof(Bridge, vlan_filtering) Bridge.VLANFiltering, config_parse_tristate, 0, offsetof(Bridge, vlan_filtering)
Bridge.STP, config_parse_tristate, 0, offsetof(Bridge, stp)
VRF.TableId, config_parse_uint32, 0, offsetof(Vrf, table_id) VRF.TableId, config_parse_uint32, 0, offsetof(Vrf, table_id)