[PATCH] Re: IP4Config and routes



On Saturday 05 of June 2010 04:58:36 Dan Williams wrote:
> On Wed, 2010-06-02 at 09:51 +0200, Simon Schampijer wrote:
> > On 12/18/2009 03:14 PM, Daniel Drake wrote:
> > > On Thu, 2009-12-17 at 14:22 -0800, Dan Williams wrote:
> > >> What would you expect the routing table to look like in your case?  I
> > >> suppose we could do a default route for link-local.  Not sure if that
> > >> will confuse apps that expect a default route to mean an internet
> > >> connection though.
> > > 
> > > I would expect the subnet route, as NM is creating already:
> > > 	dest=169.254.0.0
> > > 	gateway=0.0.0.0
> > > 	genmask=255.255.0.0
> > > 
> > > I would also like the routing table to either include a default route:
> > > 	dest=0.0.0
> > > 	gateway=0.0.0.0
> > > 	genmask=0.0.0.0
> > > 
> > > or a multicast one:
> > > 	dest=224.0.0.0
> > > 	gateway=0.0.0.0
> > > 	genmask=240.0.0.0
> > > 
> > > The routing table that NM is setting up now is reasonable, in my
> > > opinion, but there should be some way of customizing the behaviour in
> > > the settings object.
> > > 
> > > Daniel
> > 
> > Hi,
> > 
> > what is the status on this one? Was there a conclusion on whether NM
> > should set a default route for link local?
> 
> Creating a multicast route by default on link-local IPv4 connections
> seems reasonable.  Want to do a patch for that?  I'd say just add the
> desired route in aipd_get_ip4_config() in src/nm-device.c to the
> returned NMIP4Config object and then lets make sure the code that adds
> routes works correctly there.
> 

The patch adds a multicast route as suggested by Dan.

destination=224.0.0.0
netmask=240.0.0.0

Daniel, does it work for your case?

Jirka
diff --git a/src/nm-device.c b/src/nm-device.c
index fcd3120..ba26dec 100644
--- a/src/nm-device.c
+++ b/src/nm-device.c
@@ -1019,6 +1019,7 @@ aipd_get_ip4_config (NMDevice *self, NMDeviceStateReason *reason)
 	NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
 	NMIP4Config *config = NULL;
 	NMIP4Address *addr;
+	NMIP4Route *route;
 
 	g_return_val_if_fail (priv->aipd_addr > 0, NULL);
 
@@ -1033,6 +1034,14 @@ aipd_get_ip4_config (NMDevice *self, NMDeviceStateReason *reason)
 	nm_ip4_address_set_prefix (addr, 16);
 	nm_ip4_config_take_address (config, addr);
 
+	/* Add a multicast route for link-local connections: destination= 224.0.0.0, netmask=240.0.0.0 */
+	route = nm_ip4_route_new ();
+	nm_ip4_route_set_dest (route, (guint32) htonl (0xE0000000L));
+	nm_ip4_route_set_prefix (route, 4);
+	nm_ip4_route_set_next_hop (route, (guint32) 0);
+	nm_ip4_route_set_metric (route, 0);
+	nm_ip4_config_take_route (config, route);
+
 	return config;	
 }
 


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