Re: default route problem



Dan Williams wrote:
On Thu, 2008-11-13 at 16:19 +0000, Roy Marples wrote:
Could you point me to that bug? I would like to ensure that dhcpcd works with the same criteria. I'm pretty sure it does, but only for CIDR routes. But from the sounds of it, you could just construct the netlink message to say the host is directly on the link instead.

Could you explain that idea a bit more?  I tried various methods with
libnl to do this inside NM, but I don't fully understand the kernel
routing table behavior in this situation.  The procedure for
using /sbin/ip and libnl will be essentially the same, so if we can come
up with a procedure that works in /sbin/ip it should be easy to convert
to libnl.  Really, you just need to do something like:

ifconfig eth0 192.168.1.30/32 up
/sbin/ip route add default dev eth0 via 192.168.1.1

if (gateway->s_addr == INADDR_ANY)
     nlm->rt.rtm_scope = RT_SCOPE_LINK;

That's roughly what I use. But I bypass libnl and go straight to the kernel.

I'll double check with your code sample on my linux machine later.

Thanks

Roy


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]