Skip to content

Commit c6f8d17

Browse files
toanjupoettering
authored andcommitted
networkd: bridge add support to configure VLAN filtering (systemd#3344)
This patch implements support for IFLA_BR_VLAN_FILTERING configuration.
1 parent ca473d5 commit c6f8d17

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

man/systemd.netdev.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,15 @@
330330
</para>
331331
</listitem>
332332
</varlistentry>
333+
<varlistentry>
334+
<term><varname>VLANFiltering=</varname></term>
335+
<listitem>
336+
<para>A boolean. This setting controls the IFLA_BR_VLAN_FILTERING option in the kernel.
337+
If enabled, the bridge will be started in VLAN-filtering mode. When unset, the kernel's
338+
default setting applies.
339+
</para>
340+
</listitem>
341+
</varlistentry>
333342
</variablelist>
334343

335344
</refsect1>

src/network/networkd-netdev-bridge.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ static int netdev_bridge_post_create(NetDev *netdev, Link *link, sd_netlink_mess
102102
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BR_MCAST_SNOOPING attribute: %m");
103103
}
104104

105+
if (b->vlan_filtering >= 0) {
106+
r = sd_netlink_message_append_u8(req, IFLA_BR_VLAN_FILTERING, b->vlan_filtering);
107+
if (r < 0)
108+
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BR_VLAN_FILTERING attribute: %m");
109+
}
110+
105111
r = sd_netlink_message_close_container(req);
106112
if (r < 0)
107113
return log_netdev_error_errno(netdev, r, "Could not append IFLA_LINKINFO attribute: %m");
@@ -128,6 +134,7 @@ static void bridge_init(NetDev *n) {
128134

129135
b->mcast_querier = -1;
130136
b->mcast_snooping = -1;
137+
b->vlan_filtering = -1;
131138
}
132139

133140
const NetDevVTable bridge_vtable = {

src/network/networkd-netdev-bridge.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ typedef struct Bridge {
2626

2727
int mcast_querier;
2828
int mcast_snooping;
29+
int vlan_filtering;
2930

3031
usec_t forward_delay;
3132
usec_t hello_time;

src/network/networkd-netdev-gperf.gperf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,4 @@ Bridge.MaxAgeSec, config_parse_sec, 0,
100100
Bridge.ForwardDelaySec, config_parse_sec, 0, offsetof(Bridge, forward_delay)
101101
Bridge.MulticastQuerier, config_parse_tristate, 0, offsetof(Bridge, mcast_querier)
102102
Bridge.MulticastSnooping, config_parse_tristate, 0, offsetof(Bridge, mcast_snooping)
103+
Bridge.VLANFiltering, config_parse_tristate, 0, offsetof(Bridge, vlan_filtering)

0 commit comments

Comments
 (0)