Add support to configure GVRP.
Closes #5760
This option is compulsory.</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><varname>GVRP=</varname></term>
+ <listitem>
+ <para>The Generic VLAN Registration Protocol (GVRP) is a protocol that
+ allows automatic learning of VLANs on a network. A boolean. When unset,
+ the kernel's default setting applies.</para>
+ </listitem>
+ </varlistentry>
</variablelist>
-
</refsect1>
<refsect1>
NetDev.MTUBytes, config_parse_iec_size, 0, offsetof(NetDev, mtu)
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)
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)
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include <linux/if_vlan.h>
#include <net/if.h>
#include "netdev/vlan.h"
#include "vlan-util.h"
static int netdev_vlan_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *req) {
+ struct ifla_vlan_flags flags = {};
VLan *v;
int r;
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_VLAN_ID attribute: %m");
+ if (v->gvrp != -1) {
+ flags.mask |= VLAN_FLAG_GVRP;
+
+ if (v->gvrp)
+ flags.flags |= VLAN_FLAG_GVRP;
+ else
+ flags.flags &= ~VLAN_FLAG_GVRP;
+ }
+
+ 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");
+
return 0;
}
assert(v);
v->id = VLANID_INVALID;
+ v->gvrp = -1;
}
const NetDevVTable vlan_vtable = {
NetDev meta;
uint16_t id;
+
+ int gvrp;
};
DEFINE_NETDEV_CAST(VLAN, VLan);