Re: [PATCH] [2/3] Use libnl instead of iproute/AF_PACKET (nm_system_device_replace_default_ipv4_route)



On Wed, Apr 23, 2008 at 12:23:45PM -0400, Dan Williams wrote:
> On Fri, 2008-04-18 at 20:12 -0400, Benoit Boissinot wrote:
> > (depends on the cleanup of the frugalware backend)
> > 
> > Remove nm_system_device_replace_default_ip4_route from all
> > backends, implement it with libnl.
> 
> So this patch doesn't seem to work for me, I always get ESRCH returned
> from libnl.
> 
> -- Error received: No such process
> -- Original message: type=0x18 length=52 flags=<REQUEST,ACK,ROOT,ATOMIC> sequence-nr=1208967030 pid=4218374
> NetworkManager: <WARN>  nm_system_device_replace_default_ip4_route(): rtnl_addr_add() error -3

I don't see any rtnl_addr_add in nm_system_device_replace_default_ip4_route, it is rtnl_route_add, right ?
> 
> probably need to poke Thomas about this one, before I start
> instrumenting iproute2 to dump the netlink packets it sends, doing the
> same for libnl, and see what's different.

I'm on it, I can reproduce it (and I've already dumped libnl vs iproute).

regards,

Benoit
> 
> Dan
> 
> > +void
> > +nm_system_device_replace_default_ip4_route (const char *iface, guint32 gw, guint32 mss)
> > +{
> > +	struct rtnl_route * route;
> > +	struct nl_handle  * nlh;
> > +	struct nl_addr    * gw_addr;
> > +	int iface_idx;
> > +
> > +	nlh = nm_netlink_get_default_handle ();
> > +	g_return_if_fail (nlh != NULL);
> > +
> > +	route = rtnl_route_alloc();
> > +	g_return_if_fail (route != NULL);
> > +
> > +	iface_idx = nm_netlink_iface_to_index (iface);
> > +	if (iface_idx < 0)
> > +		goto out;
> > +	rtnl_route_set_oif (route, iface_idx);
> > +
> > +	if (gw > 0) {
> > +		if (!(gw_addr = nl_addr_build (AF_INET, &gw, sizeof (gw))))
> > +			goto out;
> > +		rtnl_route_set_gateway (route, gw_addr);
> > +		nl_addr_put (gw_addr);
> > +	}
> > +
> > +	if (mss > 0)
> > +		if (rtnl_route_set_metric (route, RTAX_ADVMSS, mss) < 0)
> > +			goto out;
> > +
> > +	rtnl_route_add (nlh, route, NLM_F_REPLACE);
> > +out:
> > +	rtnl_route_put (route);
> > +}
> > +

-- 
:wq


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