[lxc-devel] conf.c:instantiate_veth() rewrite

Serge Hallyn serge.hallyn at ubuntu.com
Mon Sep 7 15:13:05 UTC 2015


Quoting Stephane Nguyen (stephminh at yahoo.es):
> Hi
> 
> It looks like conf.c:instanciate_veth() was rewritten; the result is
> that lxc-start is failing when setting up the veth pair MTUs. I rewrote
> a very small section of the code and it seems to be working fine now:
> 
> 1) Move the following block (unchanged) before the block that's
> getting/setting the MTU
> < 	netdev->ifindex = if_nametoindex(veth2);
> < 	if (!netdev->ifindex) {
> < 		ERROR("failed to retrieve the index for %s", veth2);
> < 		goto out_delete;
> 
> 2) Replace
> < mtu = netdev_get_mtu(if_nametoindex(netdev->link));
> 
> by
> 
> > mtu = netdev_get_mtu(netdev->ifindex);
> 
> The whole code diff is as follows:
> 
> # diff lxc-master/src/lxc/conf.c lxc-steph/src/lxc/conf.c
> 2602a2603,2608
> > 	netdev->ifindex = if_nametoindex(veth2);
> > 	if (!netdev->ifindex) {
> > 		ERROR("failed to retrieve the index for %s", veth2);
> > 		goto out_delete;
> > 	}
> > 
> 2606c2612
> < 		mtu = netdev_get_mtu(if_nametoindex(netdev->link));
> ---
> > 		mtu = netdev_get_mtu(netdev->ifindex);
> 2627,2632d2632
> < 	}
> < 
> < 	netdev->ifindex = if_nametoindex(veth2);
> < 	if (!netdev->ifindex) {
> < 		ERROR("failed to retrieve the index for %s", veth2);
> < 		goto out_delete;
> 
> 
> Was there a reason why the interface index was searched after the MTU
> get/set which actually depends on the interface index?

Could you send this as a signed-off patch or a github pull request?


More information about the lxc-devel mailing list