[libvirt] Replace AF_LOCAL with AF_PACKET

Daniel P. Berrange berrange at redhat.com
Fri Jul 31 14:23:59 UTC 2015


On Fri, Jul 31, 2015 at 03:10:24PM +0100, Ben Gray wrote:
> Hi,
> 
>     I've a question on whether it's 'safe' to change the socket type used in
> virNetxxx calls from AF_PACKET to AF_LOCAL ?
> 
>     The reason I ask is that we're using libvirt-lxc with a couple of bridge
> interfaces, and we've found that the socket close call on AF_PACKET type
> sockets takes between 40ms and 60ms. For our container config there is
> roughly 12 close calls on AF_PACKET sockets, delaying the start-up of the
> LXC container by around 450ms.
> 
>     So a simple fix to speed up our container start-up is to just switch
> from AF_PACKET to AF_LOCAL sockets.  Hence my question on whether we can
> safely do this, or is there some reason why AF_PACKET was chosen ?

AFAIK, there's no particular reason why we chose AF_PACKET - we were
probably just copying code somewhere else. Looking at the kernel code
it seems the various ioctls() we do are accepted on any type of socket
family. So if AF_LOCAL works, I don't see a reason not to change it.

We should probably test old distro like RHEL5 to be sure there's no
historical reason for it though.

Regards,
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