network: add support for vlan confs(MVRP, reorder header, loose binding) (#5834)

This commit is contained in:
Susant Sahani 2017-05-09 18:25:11 +00:00 committed by Lennart Poettering
parent 09b69d68fa
commit 6c1ff21b00
4 changed files with 49 additions and 0 deletions

View file

@ -410,6 +410,31 @@
the kernel's default setting applies.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>MVRP=</varname></term>
<listitem>
<para>Multiple VLAN Registration Protocol (MVRP) formerly known as GARP VLAN
Registration Protocol (GVRP) is a standards-based Layer 2 network protocol,
for automatic configuration of VLAN information on switches. It was defined
in the 802.1ak amendment to 802.1Q-2005. A boolean. When unset, the kernel's
default setting applies.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>LooseBinding=</varname></term>
<listitem>
<para>The VLAN loose binding mode, in which only the operational state is passed
from the parent to the associated VLANs, but the VLAN device state is not changed.
A boolean. When unset, the kernel's default setting applies.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>ReorderHeader=</varname></term>
<listitem>
<para>The VLAN reorder header is set VLAN interfaces behave like physical interfaces.
A boolean. When unset, the kernel's default setting applies.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

View file

@ -38,6 +38,9 @@ NetDev.MTUBytes, config_parse_iec_size, 0,
NetDev.MACAddress, config_parse_hwaddr, 0, offsetof(NetDev, mac)
VLAN.Id, config_parse_vlanid, 0, offsetof(VLan, id)
VLAN.GVRP, config_parse_tristate, 0, offsetof(VLan, gvrp)
VLAN.MVRP, config_parse_tristate, 0, offsetof(VLan, mvrp)
VLAN.LooseBinding, config_parse_tristate, 0, offsetof(VLan, loose_binding)
VLAN.ReorderHeader, config_parse_tristate, 0, offsetof(VLan, reorder_hdr)
MACVLAN.Mode, config_parse_macvlan_mode, 0, offsetof(MacVlan, mode)
MACVTAP.Mode, config_parse_macvlan_mode, 0, offsetof(MacVlan, mode)
IPVLAN.Mode, config_parse_ipvlan_mode, 0, offsetof(IPVlan, mode)

View file

@ -45,6 +45,21 @@ static int netdev_vlan_fill_message_create(NetDev *netdev, Link *link, sd_netlin
SET_FLAG(flags.flags, VLAN_FLAG_GVRP, v->gvrp);
}
if (v->mvrp != -1) {
flags.mask |= VLAN_FLAG_MVRP;
SET_FLAG(flags.flags, VLAN_FLAG_MVRP, v->mvrp);
}
if (v->reorder_hdr != -1) {
flags.mask |= VLAN_FLAG_REORDER_HDR;
SET_FLAG(flags.flags, VLAN_FLAG_REORDER_HDR, v->reorder_hdr);
}
if (v->loose_binding != -1) {
flags.mask |= VLAN_FLAG_LOOSE_BINDING;
SET_FLAG(flags.flags, VLAN_FLAG_LOOSE_BINDING, v->loose_binding);
}
r = sd_netlink_message_append_data(req, IFLA_VLAN_FLAGS, &flags, sizeof(struct ifla_vlan_flags));
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_VLAN_FLAGS attribute: %m");
@ -78,6 +93,9 @@ static void vlan_init(NetDev *netdev) {
v->id = VLANID_INVALID;
v->gvrp = -1;
v->mvrp = -1;
v->loose_binding = -1;
v->reorder_hdr = -1;
}
const NetDevVTable vlan_vtable = {

View file

@ -29,6 +29,9 @@ struct VLan {
uint16_t id;
int gvrp;
int mvrp;
int loose_binding;
int reorder_hdr;
};
DEFINE_NETDEV_CAST(VLAN, VLan);