]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
network: Adds upscript handling for vlan network type
authortomponline <thomas.parrott@canonical.com>
Fri, 26 Apr 2019 17:01:53 +0000 (18:01 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Sat, 18 May 2019 09:45:17 +0000 (11:45 +0200)
Signed-off-by: tomponline <thomas.parrott@canonical.com>
src/lxc/network.c

index 336805d1a1ae3e0dce72fa9034e91c3151141a01..b49aae68cb1eb09cd4dd96967fb69debbb7d2ae5 100644 (file)
@@ -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;
 }