[lxc-devel] [PATCH] Fixing MTU calculation in instantiate_veth()]

Serge Hallyn serge.hallyn at ubuntu.com
Thu Sep 10 14:49:04 UTC 2015


Quoting Stephane Nguyen (stephminh at yahoo.es):
> Signed-off-by: Stephane Nguyen <stephminh at yahoo.es>
> ---

Thanks

Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>

>  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 at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel


More information about the lxc-devel mailing list