Signed-off-by: Stephane Nguyen <stephm...@yahoo.es>
---
 src/lxc/conf.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/lxc/conf.c b/src/lxc/conf.c
index 6bc9ecb..0913b22 100644
--- a/src/lxc/conf.c
+++ b/src/lxc/conf.c
@@ -2600,10 +2600,16 @@ static int instantiate_veth(struct lxc_handler 
*handler, struct lxc_netdev *netd
                goto out_delete;
        }
 
+       netdev->ifindex = if_nametoindex(veth2);
+       if (!netdev->ifindex) {
+               ERROR("failed to retrieve the index for %s", veth2);
+               goto out_delete;
+       }
+
        if (netdev->mtu) {
                mtu = atoi(netdev->mtu);
        } else if (netdev->link) {
-               mtu = netdev_get_mtu(if_nametoindex(netdev->link));
+               mtu = netdev_get_mtu(netdev->ifindex);
        }
 
        if (mtu) {
@@ -2626,12 +2632,6 @@ static int instantiate_veth(struct lxc_handler *handler, 
struct lxc_netdev *netd
                }
        }
 
-       netdev->ifindex = if_nametoindex(veth2);
-       if (!netdev->ifindex) {
-               ERROR("failed to retrieve the index for %s", veth2);
-               goto out_delete;
-       }
-
        err = lxc_netdev_up(veth1);
        if (err) {
                ERROR("failed to set %s up : %s", veth1, strerror(-err));
-- 
2.1.0

_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to