netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] ipv6: don't add link local route when there is no link local address
@ 2012-09-26 13:09 Nicolas Dichtel
  2012-10-01 20:55 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Dichtel @ 2012-09-26 13:09 UTC (permalink / raw)
  To: netdev, yoshfuji; +Cc: Nicolas Dichtel

When an address is added on loopback (ip -6 a a 2002::1/128 dev lo), a route
to fe80::/64 is added in the main table:
  unreachable fe80::/64 dev lo  proto kernel  metric 256  error -101

This route does not match any prefix (no fe80:: address on lo). In fact,
addrconf_dev_config() will not add link local address because this function
filters interfaces by type. If the link local address is added manually, the
route to the link local prefix will be automatically added by
addrconf_add_linklocal().
Note also, that this route is not deleted when the address is removed.

After looking at the code, it seems that addrconf_add_lroute() is redundant with
addrconf_add_linklocal(), because this function will add the link local route
when the link local address is configured.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
 net/ipv6/addrconf.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index ea3e9af..041664b 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1782,14 +1782,6 @@ static void sit_route_add(struct net_device *dev)
 }
 #endif
 
-static void addrconf_add_lroute(struct net_device *dev)
-{
-	struct in6_addr addr;
-
-	ipv6_addr_set(&addr,  htonl(0xFE800000), 0, 0, 0);
-	addrconf_prefix_route(&addr, 64, dev, 0, 0);
-}
-
 static struct inet6_dev *addrconf_add_dev(struct net_device *dev)
 {
 	struct inet6_dev *idev;
@@ -1807,8 +1799,6 @@ static struct inet6_dev *addrconf_add_dev(struct net_device *dev)
 	if (!(dev->flags & IFF_LOOPBACK))
 		addrconf_add_mroute(dev);
 
-	/* Add link local route */
-	addrconf_add_lroute(dev);
 	return idev;
 }
 
@@ -2489,7 +2479,6 @@ static void addrconf_sit_config(struct net_device *dev)
 
 	if (dev->flags&IFF_POINTOPOINT) {
 		addrconf_add_mroute(dev);
-		addrconf_add_lroute(dev);
 	} else
 		sit_route_add(dev);
 }
-- 
1.7.12

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [RFC PATCH] ipv6: don't add link local route when there is no link local address
  2012-09-26 13:09 [RFC PATCH] ipv6: don't add link local route when there is no link local address Nicolas Dichtel
@ 2012-10-01 20:55 ` David Miller
  2012-10-02  9:19   ` [PATCH v2] " Nicolas Dichtel
  0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2012-10-01 20:55 UTC (permalink / raw)
  To: nicolas.dichtel; +Cc: netdev, yoshfuji

From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Date: Wed, 26 Sep 2012 15:09:22 +0200

> When an address is added on loopback (ip -6 a a 2002::1/128 dev lo), a route
> to fe80::/64 is added in the main table:
>   unreachable fe80::/64 dev lo  proto kernel  metric 256  error -101
> 
> This route does not match any prefix (no fe80:: address on lo). In fact,
> addrconf_dev_config() will not add link local address because this function
> filters interfaces by type. If the link local address is added manually, the
> route to the link local prefix will be automatically added by
> addrconf_add_linklocal().
> Note also, that this route is not deleted when the address is removed.
> 
> After looking at the code, it seems that addrconf_add_lroute() is redundant with
> addrconf_add_linklocal(), because this function will add the link local route
> when the link local address is configured.
> 
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>

This change looks correct, however:

> @@ -2489,7 +2479,6 @@ static void addrconf_sit_config(struct net_device *dev)
>  
>  	if (dev->flags&IFF_POINTOPOINT) {
>  		addrconf_add_mroute(dev);
> -		addrconf_add_lroute(dev);
>  	} else
>  		sit_route_add(dev);

now that the if() branch is a single statement, please remove the
curly braces.

Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] ipv6: don't add link local route when there is no link local address
  2012-10-01 20:55 ` David Miller
@ 2012-10-02  9:19   ` Nicolas Dichtel
  2012-10-03  2:38     ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Dichtel @ 2012-10-02  9:19 UTC (permalink / raw)
  To: davem; +Cc: netdev, yoshfuji, Nicolas Dichtel

When an address is added on loopback (ip -6 a a 2002::1/128 dev lo), a route
to fe80::/64 is added in the main table:
  unreachable fe80::/64 dev lo  proto kernel  metric 256  error -101

This route does not match any prefix (no fe80:: address on lo). In fact,
addrconf_dev_config() will not add link local address because this function
filters interfaces by type. If the link local address is added manually, the
route to the link local prefix will be automatically added by
addrconf_add_linklocal().
Note also, that this route is not deleted when the address is removed.

After looking at the code, it seems that addrconf_add_lroute() is redundant with
addrconf_add_linklocal(), because this function will add the link local route
when the link local address is configured.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
v2: remove useless curly braces after the if statement in
    addrconf_sit_config()

 net/ipv6/addrconf.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index ea3e9af..caa8035 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1782,14 +1782,6 @@ static void sit_route_add(struct net_device *dev)
 }
 #endif
 
-static void addrconf_add_lroute(struct net_device *dev)
-{
-	struct in6_addr addr;
-
-	ipv6_addr_set(&addr,  htonl(0xFE800000), 0, 0, 0);
-	addrconf_prefix_route(&addr, 64, dev, 0, 0);
-}
-
 static struct inet6_dev *addrconf_add_dev(struct net_device *dev)
 {
 	struct inet6_dev *idev;
@@ -1807,8 +1799,6 @@ static struct inet6_dev *addrconf_add_dev(struct net_device *dev)
 	if (!(dev->flags & IFF_LOOPBACK))
 		addrconf_add_mroute(dev);
 
-	/* Add link local route */
-	addrconf_add_lroute(dev);
 	return idev;
 }
 
@@ -2487,10 +2477,9 @@ static void addrconf_sit_config(struct net_device *dev)
 
 	sit_add_v4_addrs(idev);
 
-	if (dev->flags&IFF_POINTOPOINT) {
+	if (dev->flags&IFF_POINTOPOINT)
 		addrconf_add_mroute(dev);
-		addrconf_add_lroute(dev);
-	} else
+	else
 		sit_route_add(dev);
 }
 #endif
-- 
1.7.12

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] ipv6: don't add link local route when there is no link local address
  2012-10-02  9:19   ` [PATCH v2] " Nicolas Dichtel
@ 2012-10-03  2:38     ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2012-10-03  2:38 UTC (permalink / raw)
  To: nicolas.dichtel; +Cc: netdev, yoshfuji

From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Date: Tue,  2 Oct 2012 11:19:14 +0200

> When an address is added on loopback (ip -6 a a 2002::1/128 dev lo), a route
> to fe80::/64 is added in the main table:
>   unreachable fe80::/64 dev lo  proto kernel  metric 256  error -101
> 
> This route does not match any prefix (no fe80:: address on lo). In fact,
> addrconf_dev_config() will not add link local address because this function
> filters interfaces by type. If the link local address is added manually, the
> route to the link local prefix will be automatically added by
> addrconf_add_linklocal().
> Note also, that this route is not deleted when the address is removed.
> 
> After looking at the code, it seems that addrconf_add_lroute() is redundant with
> addrconf_add_linklocal(), because this function will add the link local route
> when the link local address is configured.
> 
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>

Applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-10-03  2:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-26 13:09 [RFC PATCH] ipv6: don't add link local route when there is no link local address Nicolas Dichtel
2012-10-01 20:55 ` David Miller
2012-10-02  9:19   ` [PATCH v2] " Nicolas Dichtel
2012-10-03  2:38     ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).