]> git.proxmox.com Git - mirror_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)
committertomponline <thomas.parrott@canonical.com>
Fri, 26 Apr 2019 17:01:53 +0000 (18:01 +0100)
Signed-off-by: tomponline <thomas.parrott@canonical.com>
src/lxc/network.c

index d1b4d43ada70c036591581eab696bde02a707efd..53855d8e4ee715210a27f88bdce7c6a7058f7b3b 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;
 }