libnl 3 with kernel < 2.6.38

Thierry Reding thierry.reding at avionic-design.de
Wed Mar 23 05:50:06 EDT 2011


* Thomas Graf wrote:
> On Wed, Mar 23, 2011 at 10:17:21AM +0100, Thierry Reding wrote:
> > I use libnl in a project for link monitoring and recently upgraded to libnl
> > 3. However it looks like libnl 3 does not properly work against kernels older
> > than 2.6.38. Specifically, rtnl_link_change() returns NLE_INVAL with code
> > that worked with libnl 2 on 2.6.37 (and libnl 3 on 2.6.38) but fails with
> > libnl 3 on 2.6.37.
> > 
> > Am I doing something wrong or is this expected behaviour? I couldn't find any
> > mention of such an incompatibility.
> 
> This is not expected behaviour.
> 
> Can you give me some additional details on what kind of link change
> you do?

The following is the function that exhibits the described behaviour:

	static int link_up(struct nl_sock *sock, struct rtnl_link *link)
	{
		struct rtnl_link *request = rtnl_link_alloc();
		int err = 0;

		rtnl_link_set_flags(request, IFF_UP);

		err = rtnl_link_change(sock, link, request, 0); 
		if (err < 0) {
			rtnl_link_put(request);
			return err;
		}

		rtnl_link_put(request);
		return 0;
	}

Cheers,
Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/libnl/attachments/20110323/a20b9a88/attachment.sig>


More information about the libnl mailing list