On Wed, 2010-06-30 at 21:09 +0200, Jakub Hrozek wrote:
-----BEGIN PGP SIGNED MESSAGE-----
I managed to complete the detection of routes going up/down and the
associated SSSD-specific work using libnl 1.1 on Fedora 12/13 based on
your code from NetworkManager.
However, I ran into some trouble with the RHEL5 version of libnl
(1.0-pre5) as it doesn't seem to have support for subscribing to group
(nl_socket_add_membership etc.). Can you recall if there is any
workaround with the old libnl code? The last resort would be to not
support this functionality on RHEL5, but I'd like to avoid that if possible.
It looks like RHEL5's kernel has the necessary NETLINK_ADD_MEMBERSHIP
stuff, so I think for RHEL5 you can just do it manually using the
internal file descriptor of the netlink socket. All you really need to
int group = RTNLGRP_LINK;
err = setsockopt(fd, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP,
and when dropping using NETLINK_DROP_MEMBERSHIP for the same group
number. Thankfully the libnl functions for this don't need to touch
anything internal to libnl or the nl_sock* object.
Hope that helps.