Unverified Commit f36a519a by Thomas Parrott Committed by Stéphane Graber

network: Adds check for bridge link interface existence in instantiate_veth

To avoid misleading errors about openvswitch when non-existent bridge link interface specified. Signed-off-by: 's avatarThomas Parrott <thomas.parrott@canonical.com>
parent b4c9fc14
......@@ -324,11 +324,15 @@ static int instantiate_veth(struct lxc_handler *handler, struct lxc_netdev *netd
}
if (!is_empty_string(netdev->link) && netdev->priv.veth_attr.mode == VETH_MODE_BRIDGE) {
if (!lxc_nic_exists(netdev->link)) {
SYSERROR("Failed to attach \"%s\" to bridge \"%s\", bridge interface doesn't exist", veth1, netdev->link);
goto out_delete;
}
err = lxc_bridge_attach(netdev->link, veth1);
if (err) {
errno = -err;
SYSERROR("Failed to attach \"%s\" to bridge \"%s\"",
veth1, netdev->link);
SYSERROR("Failed to attach \"%s\" to bridge \"%s\"", veth1, netdev->link);
goto out_delete;
}
INFO("Attached \"%s\" to bridge \"%s\"", veth1, netdev->link);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment