Problem adding a new route

Cedric Bosdonnat cbosdonnat at suse.com
Mon Aug 25 08:48:01 PDT 2014


Hi Dan,

On Mon, 2014-08-18 at 10:05 -0500, Dan Williams wrote:
> On Fri, 2014-08-08 at 17:19 +0200, Cedric Bosdonnat wrote:
> > Hi all,
> > 
> > I'm trying to netlinkify libvirt a bit more... and I'm having a problem
> > with the route adding function.
> > 
> > The code is here:
> > https://github.com/cbosdo/libvirt/commit/b661e278c3dbbff84c9424b4ce56976153c18297
> > 
> > Starting a container with a gateway seems to add it as I can see it
> > in /proc/net/route and with the route tool. However the route doesn't
> > work and 'ip route' doesn't list it.
> > 
> > Is there anything obvious I have forgotten? I'm not using the
> > libnl-route, only libnl since I guess we'll have platforms with old
> > versions of libnl.
> > 
> > Thanks for the help,
> 
> I can't see anything immediately wrong, about all I can suggest is to
> dump the message you're creating with libnl and see what it looks like,
> then modify /sbin/ip to dump it's messages and run the command with it,
> and compare the two.  What I've found is that the kernel often wants a
> very specific message, and if you don't build that up correctly it'll
> either reject it or do the wrong thing.

Thanks for your idea. Instead of modifying /sbin/ip, I just debugged it:
it's pretty convenient to see the actual message before it is sent. This
way I found I had some uninitialized values, thus not set to 0 thought
they should. Now it works :)

--
Cedric




More information about the libnl mailing list