mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-07 18:56:40 +00:00
minor cleanups for instanciate_veth()
the same cleanup as in instanciate_macvlan(). Just makes code shorter and less "jumpy" (as with goto back) Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
This commit is contained in:
parent
8634bc197f
commit
6ab9ab6d08
@ -831,7 +831,6 @@ static int instanciate_veth(struct lxc_netdev *netdev)
|
|||||||
{
|
{
|
||||||
char veth1buf[IFNAMSIZ], *veth1;
|
char veth1buf[IFNAMSIZ], *veth1;
|
||||||
char veth2[IFNAMSIZ];
|
char veth2[IFNAMSIZ];
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
if (netdev->pair)
|
if (netdev->pair)
|
||||||
veth1 = netdev->pair;
|
veth1 = netdev->pair;
|
||||||
@ -851,19 +850,14 @@ static int instanciate_veth(struct lxc_netdev *netdev)
|
|||||||
|
|
||||||
if (lxc_veth_create(veth1, veth2)) {
|
if (lxc_veth_create(veth1, veth2)) {
|
||||||
ERROR("failed to create %s-%s", veth1, veth2);
|
ERROR("failed to create %s-%s", veth1, veth2);
|
||||||
goto out;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (netdev->mtu) {
|
if (netdev->mtu) {
|
||||||
if (lxc_device_set_mtu(veth1, atoi(netdev->mtu))) {
|
if (lxc_device_set_mtu(veth1, atoi(netdev->mtu)) ||
|
||||||
ERROR("failed to set mtu '%s' for '%s'",
|
lxc_device_set_mtu(veth2, atoi(netdev->mtu))) {
|
||||||
netdev->mtu, veth1);
|
ERROR("failed to set mtu '%s' for %s-%s",
|
||||||
goto out_delete;
|
netdev->mtu, veth1, veth2);
|
||||||
}
|
|
||||||
|
|
||||||
if (lxc_device_set_mtu(veth2, atoi(netdev->mtu))) {
|
|
||||||
ERROR("failed to set mtu '%s' for '%s'",
|
|
||||||
netdev->mtu, veth2);
|
|
||||||
goto out_delete;
|
goto out_delete;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -890,13 +884,11 @@ static int instanciate_veth(struct lxc_netdev *netdev)
|
|||||||
DEBUG("instanciated veth '%s/%s', index is '%d'",
|
DEBUG("instanciated veth '%s/%s', index is '%d'",
|
||||||
veth1, veth2, netdev->ifindex);
|
veth1, veth2, netdev->ifindex);
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
out:
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
out_delete:
|
out_delete:
|
||||||
lxc_device_delete(veth1);
|
lxc_device_delete(veth1);
|
||||||
goto out;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int instanciate_macvlan(struct lxc_netdev *netdev)
|
static int instanciate_macvlan(struct lxc_netdev *netdev)
|
||||||
|
Loading…
Reference in New Issue
Block a user