On Wed, Jun 22, 2011 at 08:45:23PM -0400, Laine Stump wrote:
The upstream libnl maintainer (I'm Cc'ing him) has told me
it
wouldn't be difficult to make libvirt's libnl usage compatible with
all versions of libnl, but he didn't elaborate. If we're lucky, the
libnl usage in that bit of code will require no change, but we
definitely shouldn't let ourselves get to a release that requires
libnl for all Linux builds without resolving this.
(Thomas - the code in question is in src/util/netlink.[ch] of
git://libvirt.org/libvirt.git)
I just looked at the code briefly. I don't think any of the API
that you use has changed between 2.x and 3.x so no changes should
be needed.
However:
*respbuflen = nl_recv(nlhandle, &nladdr, respbuf, NULL);
if (*respbuflen <= 0) {
virReportSystemError(errno,
"%s", _("nl_recv failed"));
rc = -1;
}
You could simplify this a lot by using nl_wait_for_ack() in
all cases except where you fetch the link which would have
to use nl_recvmsgs() and a have a callback do the parsing.
Still, the code as-is looks solid, all you could do is ditch
a few dozen lines of code.