]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
Fixing MTU calculation in instantiate_veth()]
authorStephane Nguyen <stephminh@yahoo.es>
Wed, 9 Sep 2015 06:22:52 +0000 (08:22 +0200)
committerStéphane Graber <stgraber@ubuntu.com>
Mon, 21 Sep 2015 15:40:57 +0000 (11:40 -0400)
Signed-off-by: Stephane Nguyen <stephminh@yahoo.es>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
src/lxc/conf.c

index 6bc9ecb4adc461fa640cd7c7c0943246d0e643fd..0913b22f5c448dbda20e0279a64e08673f7c92d1 100644 (file)
@@ -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));