From: Thomas Parrott Date: Wed, 3 Jun 2020 10:26:35 +0000 (+0100) Subject: network: Adds check for bridge link interface existence in instantiate_veth X-Git-Tag: lxc-5.0.0~422^2~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=26da53c3acc51d5a93476c47836508e1661c6505;p=thirdparty%2Flxc.git 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: Thomas Parrott --- diff --git a/src/lxc/network.c b/src/lxc/network.c index da09141dd..15c362fb6 100644 --- a/src/lxc/network.c +++ b/src/lxc/network.c @@ -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);