]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: add support for vlan confs(MVRP, reorder header, loose binding) (#5834)
authorSusant Sahani <ssahani@users.noreply.github.com>
Tue, 9 May 2017 18:25:11 +0000 (18:25 +0000)
committerLennart Poettering <lennart@poettering.net>
Tue, 9 May 2017 18:25:11 +0000 (20:25 +0200)
man/systemd.netdev.xml
src/network/netdev/netdev-gperf.gperf
src/network/netdev/vlan.c
src/network/netdev/vlan.h

index f9b558520b68c4c576b86564426bef9d1c0d4913..71cf2f2a50a43c889e3940ff790b235d9e5a494b 100644 (file)
             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>
 
index ed943789d731568ce1144a69a44b9c15d5b72486..766e7cf9fa5501932196f8145a00d617cd007a66 100644 (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)
index 60d6343021ddf12478bb34a2856167377be208d5..6f41633eade74da08b9f4c0cbd71010b8a1b4ff5 100644 (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 = {
index 19a62b76c1137464bf6df946260c80fa106b8fe4..780d61262a2fc858ed64f5777c170797c0e623b2 100644 (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);