summaryrefslogtreecommitdiff
path: root/src/network/netdev/vlan.c
diff options
context:
space:
mode:
authorSusant Sahani <ssahani@users.noreply.github.com>2017-04-21 14:31:59 +0530
committerLennart Poettering <lennart@poettering.net>2017-04-21 11:01:59 +0200
commitc8b21184052cc445a45f797ec11dae5e6a1d2b54 (patch)
tree2befea71fa21dff0af4aba9fa6791a252fd53f4a /src/network/netdev/vlan.c
parent41c237af809c2145f1d9a74a8288dd5a54e5eb0b (diff)
downloadsystemd-c8b21184052cc445a45f797ec11dae5e6a1d2b54.tar.gz
systemd-c8b21184052cc445a45f797ec11dae5e6a1d2b54.tar.bz2
systemd-c8b21184052cc445a45f797ec11dae5e6a1d2b54.zip
networkd: vlan add GVRP support (#5761)
Add support to configure GVRP. Closes #5760
Diffstat (limited to 'src/network/netdev/vlan.c')
-rw-r--r--src/network/netdev/vlan.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/network/netdev/vlan.c b/src/network/netdev/vlan.c
index 28c061fa4f..718b627b2b 100644
--- a/src/network/netdev/vlan.c
+++ b/src/network/netdev/vlan.c
@@ -17,12 +17,14 @@
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;
@@ -38,6 +40,19 @@ static int netdev_vlan_fill_message_create(NetDev *netdev, Link *link, sd_netlin
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;
}
@@ -66,6 +81,7 @@ static void vlan_init(NetDev *netdev) {
assert(v);
v->id = VLANID_INVALID;
+ v->gvrp = -1;
}
const NetDevVTable vlan_vtable = {