[libvirt] [PATCH] Fix error report from nl_recvmsg

Doug Goldstein cardoe at gentoo.org
Sat Mar 2 17:42:01 UTC 2013


On Fri, Mar 1, 2013 at 8:44 AM, Eric Blake <eblake at redhat.com> wrote:
> On 03/01/2013 03:18 AM, Daniel P. Berrange wrote:
>>>
>>> So the conclusion is that I see no extra harm in calling nl_geterror(). ACK.
>>
>> Except the API signature is different, so my patch won't work with
>> both versions :-(
>
> Sounds like its time for a wrapper function that #ifdefs away the
> difference in underlying API calls between libnl1 and libnl3, with the
> bulk of our code using our wrapper instead of direct nl_* functions.
> And by the time we convert our code to all go through our wrappers, how
> much simpler is it to have our wrapper do the direct socket work instead
> of catering to two parallel nl_ abstractions?
>
> --
> Eric Blake   eblake redhat com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>

This is the same road I went down with for an application at work. By
the time I got close to abstracting away all the badness, I had a
working netlink layer and dropped libnl entirely. I wasn't using all
the complex gennl types that libnl contains and abstracts however. A
reasonable read is libnfnetlink to see how really simple it is to use
netlink.

https://git.netfilter.org/libnfnetlink/

-- 
Doug Goldstein




More information about the libvir-list mailing list