[libvirt] [PATCH] lxc: fix veth off by 1 error

Daniel P. Berrange berrange at redhat.com
Wed Apr 8 10:20:29 UTC 2009


On Tue, Apr 07, 2009 at 04:21:39PM -0500, Serge E. Hallyn wrote:
> When not specifying a target for veth device, veth.c:getFreeVethName()
> is supposed to scan for unused veth devices in /sys/class/net.
> However, when it finds one, it bumps the index by one before
> returning it.
> 
> So, if you have one container running, veth0 is passed into
> the container, veth1 is taken and still sitting in /sys/class/net.
> When you now start a second container, getFreeVethName() finds
> veth0 is unused, but returns 1.  Now container creation dies
> becuase /sys/class/net/veth1 exists.

ACK. 

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list