From: Christian Brauner Date: Wed, 3 Jul 2019 19:46:37 +0000 (+0200) Subject: network: simplify instantiate_phys() X-Git-Tag: lxc-3.2.0~14^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=75b074eea0945e4ef263c6e47dee7665cd4c7451;p=thirdparty%2Flxc.git network: simplify instantiate_phys() Signed-off-by: Christian Brauner --- diff --git a/src/lxc/network.c b/src/lxc/network.c index 75cc5ec40..6e7004dfb 100644 --- a/src/lxc/network.c +++ b/src/lxc/network.c @@ -652,7 +652,8 @@ static int instantiate_phys(struct lxc_handler *handler, struct lxc_netdev *netd return -1; } - /* Note that we're retrieving the container's ifindex in the host's + /* + * Note that we're retrieving the container's ifindex in the host's * network namespace because we need it to move the device from the * host's network namespace to the container's network namespace later * on. @@ -665,12 +666,16 @@ static int instantiate_phys(struct lxc_handler *handler, struct lxc_netdev *netd return -1; } - /* Store the ifindex of the host's network device in the host's + /* + * Store the ifindex of the host's network device in the host's * namespace. */ netdev->priv.phys_attr.ifindex = netdev->ifindex; - /* Get original device MTU setting and store for restoration after container shutdown. */ + /* + * Get original device MTU setting and store for restoration after + * container shutdown. + */ mtu_orig = netdev_get_mtu(netdev->ifindex); if (mtu_orig < 0) { SYSERROR("Failed to get original mtu for interface \"%s\"", netdev->link); @@ -683,14 +688,16 @@ static int instantiate_phys(struct lxc_handler *handler, struct lxc_netdev *netd err = lxc_safe_uint(netdev->mtu, &mtu); if (err < 0) { errno = -err; - SYSERROR("Failed to parse mtu \"%s\" for interface \"%s\"", netdev->mtu, netdev->link); + SYSERROR("Failed to parse mtu \"%s\" for interface \"%s\"", + netdev->mtu, netdev->link); return -1; } err = lxc_netdev_set_mtu(netdev->link, mtu); if (err < 0) { errno = -err; - SYSERROR("Failed to set mtu \"%s\" for interface \"%s\"", netdev->mtu, netdev->link); + SYSERROR("Failed to set mtu \"%s\" for interface \"%s\"", + netdev->mtu, netdev->link); return -1; } } @@ -702,15 +709,15 @@ static int instantiate_phys(struct lxc_handler *handler, struct lxc_netdev *netd NULL, }; - err = run_script_argv(handler->name, - handler->conf->hooks_version, "net", - netdev->upscript, "up", argv); + err = run_script_argv(handler->name, handler->conf->hooks_version, + "net", netdev->upscript, "up", argv); if (err < 0) { return -1; } } - DEBUG("Instantiated phys \"%s\" with ifindex is \"%d\"", netdev->link, netdev->ifindex); + DEBUG("Instantiated phys \"%s\" with ifindex is \"%d\"", netdev->link, + netdev->ifindex); return 0; }