[libvirt] Adding and Clearing bridge addresses

Daniel P. Berrange berrange at redhat.com
Tue Mar 12 19:23:53 UTC 2013


On Tue, Mar 12, 2013 at 03:11:56PM -0400, Laine Stump wrote:
> On 03/12/2013 01:45 PM, Gene Czarcinski wrote:
> > I have been working on this patch to have libvirt optionally set
> > static routes.
> >
> > So I found the function that adds both IPv4 and IPv6 addresses to the
> > bridge in virnetdev.c. I found that besides the
> > virNetDevAddIPv4Address() there is also virNetDevCleanIPv4Address(). 
> > I patterned my virNetDevAddGateway() after the
> > virNetDevAddIPv4Address() function.
> >
> > What I am puzzled about is that it appears that nobody calls the Clear
> > function.  What don't I understand?
> 
> Probably it's there just for completeness of API.
> 
> The thing that I find strange is that these functions include "IPv4" in
> their names, in spite of working just as well for IPv6. It's very likely
> that if I dig back through the blame history (which won't be simple
> since the code has been moved into different files), I'll find that I
> originally wrote it (I have a vague memory of it), but don't think I
> would purposefully add IPv4 to the names... :-/

The virNetDevGetIPv4Address method uses an ioctl to get the address
and this only works on IPv4 addrs. The intent was to turn the other
two calls into ioctl() calls too, to kill off shell commands.

Setting IPv6 addresses would require netlink usage instead IIRC


Daniel-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list