#define LXC_USERNIC_PATH LIBEXECDIR "/lxc/lxc-user-nic"
static int lxc_create_network_unpriv_exec(const char *lxcpath, const char *lxcname,
- struct lxc_netdev *netdev, pid_t pid)
+ struct lxc_netdev *netdev, pid_t pid, unsigned int hooks_version)
{
int ret;
pid_t child;
return -1;
}
+ if (netdev->upscript) {
+ char *argv[] = {
+ "veth",
+ netdev->link,
+ netdev->priv.veth_attr.veth1,
+ NULL,
+ };
+
+ ret = run_script_argv(lxcname,
+ hooks_version, "net",
+ netdev->upscript, "up", argv);
+ if (ret < 0)
+ return -1;
+ }
+
return 0;
}
}
int lxc_create_network_unpriv(const char *lxcpath, const char *lxcname,
- struct lxc_list *network, pid_t pid)
+ struct lxc_list *network, pid_t pid, unsigned int hooks_version)
{
struct lxc_list *iterator;
if (netdev->mtu)
INFO("mtu ignored due to insufficient privilege");
- if (lxc_create_network_unpriv_exec(lxcpath, lxcname, netdev, pid))
+ if (lxc_create_network_unpriv_exec(lxcpath, lxcname, netdev, pid, hooks_version))
return -1;
}
extern void lxc_delete_network(struct lxc_handler *handler);
extern int lxc_find_gateway_addresses(struct lxc_handler *handler);
extern int lxc_create_network_unpriv(const char *lxcpath, const char *lxcname,
- struct lxc_list *network, pid_t pid);
+ struct lxc_list *network, pid_t pid, unsigned int hook_version);
extern int lxc_requests_empty_network(struct lxc_handler *handler);
extern int lxc_restore_phys_nics_to_netns(struct lxc_handler *handler);
extern int lxc_setup_network_in_child_namespaces(const struct lxc_conf *conf,
}
ret = lxc_create_network_unpriv(handler->lxcpath, handler->name,
- &conf->network, handler->pid);
+ &conf->network, handler->pid, conf->hooks_version);
if (ret < 0) {
ERROR("Failed to create the configured network");
goto out_delete_net;