mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-09 16:31:15 +00:00
Merge pull request #2979 from tomponline/tp-vlan-mtu
network: Makes vlan network interfaces set mtu before upscript called
This commit is contained in:
commit
1732294cab
@ -572,8 +572,23 @@ static int instantiate_vlan(struct lxc_handler *handler, struct lxc_netdev *netd
|
|||||||
netdev->ifindex = if_nametoindex(peer);
|
netdev->ifindex = if_nametoindex(peer);
|
||||||
if (!netdev->ifindex) {
|
if (!netdev->ifindex) {
|
||||||
ERROR("Failed to retrieve ifindex for \"%s\"", peer);
|
ERROR("Failed to retrieve ifindex for \"%s\"", peer);
|
||||||
lxc_netdev_delete_by_name(peer);
|
goto on_error;
|
||||||
return -1;
|
}
|
||||||
|
|
||||||
|
if (netdev->mtu) {
|
||||||
|
err = lxc_safe_uint(netdev->mtu, &mtu);
|
||||||
|
if (err < 0) {
|
||||||
|
errno = -err;
|
||||||
|
SYSERROR("Failed to parse mtu \"%s\" for interface \"%s\"", netdev->mtu, peer);
|
||||||
|
goto on_error;
|
||||||
|
}
|
||||||
|
|
||||||
|
err = lxc_netdev_set_mtu(peer, mtu);
|
||||||
|
if (err) {
|
||||||
|
errno = -err;
|
||||||
|
SYSERROR("Failed to set mtu \"%s\" for interface \"%s\"", netdev->mtu, peer);
|
||||||
|
goto on_error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (netdev->upscript) {
|
if (netdev->upscript) {
|
||||||
@ -587,32 +602,18 @@ static int instantiate_vlan(struct lxc_handler *handler, struct lxc_netdev *netd
|
|||||||
handler->conf->hooks_version, "net",
|
handler->conf->hooks_version, "net",
|
||||||
netdev->upscript, "up", argv);
|
netdev->upscript, "up", argv);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
lxc_netdev_delete_by_name(peer);
|
goto on_error;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG("Instantiated vlan \"%s\" with ifindex is \"%d\" (vlan1000)",
|
DEBUG("Instantiated vlan \"%s\" with ifindex is \"%d\" (vlan1000)",
|
||||||
peer, netdev->ifindex);
|
peer, netdev->ifindex);
|
||||||
if (netdev->mtu) {
|
|
||||||
if (lxc_safe_uint(netdev->mtu, &mtu) < 0) {
|
|
||||||
ERROR("Failed to retrieve mtu from \"%d\"/\"%s\".",
|
|
||||||
netdev->ifindex,
|
|
||||||
netdev->name[0] != '\0' ? netdev->name : "(null)");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
err = lxc_netdev_set_mtu(peer, mtu);
|
|
||||||
if (err) {
|
|
||||||
errno = -err;
|
|
||||||
SYSERROR("Failed to set mtu \"%s\" for \"%s\"",
|
|
||||||
netdev->mtu, peer);
|
|
||||||
lxc_netdev_delete_by_name(peer);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
on_error:
|
||||||
|
lxc_netdev_delete_by_name(peer);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int instantiate_phys(struct lxc_handler *handler, struct lxc_netdev *netdev)
|
static int instantiate_phys(struct lxc_handler *handler, struct lxc_netdev *netdev)
|
||||||
|
Loading…
Reference in New Issue
Block a user