[lxc-devel] [lxc/master] network: Adds upscript handling for vlan network type
tomponline on Github
lxc-bot at linuxcontainers.org
Fri Apr 26 17:03:17 UTC 2019
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 443 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190426/12edf456/attachment.bin>
-------------- next part --------------
From 3a73d9f10940f1443fb66f5363a052494d723a9c Mon Sep 17 00:00:00 2001
From: tomponline <thomas.parrott at canonical.com>
Date: Fri, 26 Apr 2019 18:01:53 +0100
Subject: [PATCH] network: Adds upscript handling for vlan network type
Signed-off-by: tomponline <thomas.parrott at canonical.com>
---
src/lxc/network.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/src/lxc/network.c b/src/lxc/network.c
index d1b4d43ada..53855d8e4e 100644
--- a/src/lxc/network.c
+++ b/src/lxc/network.c
@@ -297,6 +297,21 @@ static int instantiate_vlan(struct lxc_handler *handler, struct lxc_netdev *netd
return -1;
}
+ if (netdev->upscript) {
+ char *argv[] = {
+ "vlan",
+ netdev->link,
+ NULL,
+ };
+
+ err = run_script_argv(handler->name,
+ handler->conf->hooks_version, "net",
+ netdev->upscript, "up", argv);
+ if (err < 0)
+ lxc_netdev_delete_by_name(peer);
+ return -1;
+ }
+
DEBUG("Instantiated vlan \"%s\" with ifindex is \"%d\" (vlan1000)",
peer, netdev->ifindex);
if (netdev->mtu) {
@@ -447,6 +462,21 @@ static int shutdown_macvlan(struct lxc_handler *handler, struct lxc_netdev *netd
static int shutdown_vlan(struct lxc_handler *handler, struct lxc_netdev *netdev)
{
+ int ret;
+ char *argv[] = {
+ "vlan",
+ netdev->link,
+ NULL,
+ };
+
+ if (!netdev->downscript)
+ return 0;
+
+ ret = run_script_argv(handler->name, handler->conf->hooks_version,
+ "net", netdev->downscript, "down", argv);
+ if (ret < 0)
+ return -1;
+
return 0;
}
More information about the lxc-devel
mailing list