[libvirt] [PATCH] The logic in veth.c that searches for free interface names takes into account

Daniel Veillard veillard at redhat.com
Thu Aug 7 08:30:30 UTC 2008


On Wed, Aug 06, 2008 at 08:20:38AM -0700, Dan Smith wrote:
> only current devices, but not device names already planned for the other
> half of a container's device pair.  Thus, the search can result in attempting
> to create a pair of devices such as veth1 and veth1, which obviously does
> not work.
> 
> This patch augments the logic to be a little smarter in this regard, and should
> fix one case where attempting to start a container results in an error message
> of "unable to create device pair".
[...]
> -    if (1 > strlen(veth2)) {
> +    while ((1 > strlen(veth2)) || STREQ(veth1, veth2)) {
>          vethDev = getFreeVethName(veth2, veth2MaxLen, vethDev);
>          DEBUG("assigned veth2: %s", veth2);
>      }

  Seems a side effect statement is needed in this loop to exit it if we 
happen to enter it, no ?

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard at redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/




More information about the libvir-list mailing list