netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: ipv6: fallback to full lookup if table lookup is unsuitable
@ 2016-09-16 12:55 Vincent Bernat
  2016-09-16 18:36 ` David Ahern
  2016-09-19  4:58 ` [PATCH] " David Miller
  0 siblings, 2 replies; 11+ messages in thread
From: Vincent Bernat @ 2016-09-16 12:55 UTC (permalink / raw)
  To: David S. Miller, David Ahern, Alexey Kuznetsov, James Morris,
	Hideaki YOSHIFUJI, Patrick McHardy, netdev
  Cc: Vincent Bernat

Commit 8c14586fc320 ("net: ipv6: Use passed in table for nexthop
lookups") introduced a regression: insertion of an IPv6 route in a table
not containing the appropriate connected route for the gateway but which
contained a non-connected route (like a default gateway) fails while it
was previously working:

    $ ip link add eth0 type dummy
    $ ip link set up dev eth0
    $ ip addr add 2001:db8::1/64 dev eth0
    $ ip route add ::/0 via 2001:db8::5 dev eth0 table 20
    $ ip route add 2001:db8:cafe::1/128 via 2001:db8::6 dev eth0 table 20
    RTNETLINK answers: No route to host
    $ ip -6 route show table 20
    default via 2001:db8::5 dev eth0  metric 1024  pref medium

After this patch, we get:

    $ ip route add 2001:db8:cafe::1/128 via 2001:db8::6 dev eth0 table 20
    $ ip -6 route show table 20
    2001:db8:cafe::1 via 2001:db8::6 dev eth0  metric 1024  pref medium
    default via 2001:db8::5 dev eth0  metric 1024  pref medium

Signed-off-by: Vincent Bernat <vincent@bernat.im>
---
 net/ipv6/route.c | 48 +++++++++++++++++++++++++++---------------------
 1 file changed, 27 insertions(+), 21 deletions(-)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index ad4a7ff301fc..c2aaddcfed9e 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1808,6 +1808,30 @@ static struct rt6_info *ip6_nh_lookup_table(struct net *net,
 	return rt;
 }
 
+static int ip6_nh_valid(struct rt6_info *grt,
+			struct net_device **dev, struct inet6_dev **idev) {
+	int ret = 0;
+
+	if (!grt)
+		goto out;
+	if (grt->rt6i_flags & RTF_GATEWAY)
+		goto out;
+	if (*dev) {
+		if (*dev != grt->dst.dev)
+			goto out;
+	} else {
+		*dev = grt->dst.dev;
+		*idev = grt->rt6i_idev;
+		dev_hold(*dev);
+		in6_dev_hold(*idev);
+	}
+	ret = 1;
+out:
+	if (grt)
+		ip6_rt_put(grt);
+	return ret;
+}
+
 static struct rt6_info *ip6_route_info_create(struct fib6_config *cfg)
 {
 	struct net *net = cfg->fc_nlinfo.nl_net;
@@ -1991,33 +2015,15 @@ static struct rt6_info *ip6_route_info_create(struct fib6_config *cfg)
 			if (!(gwa_type & IPV6_ADDR_UNICAST))
 				goto out;
 
+			err = -EHOSTUNREACH;
 			if (cfg->fc_table)
 				grt = ip6_nh_lookup_table(net, cfg, gw_addr);
-
-			if (!grt)
+			if (!ip6_nh_valid(grt, &dev, &idev)) {
 				grt = rt6_lookup(net, gw_addr, NULL,
 						 cfg->fc_ifindex, 1);
-
-			err = -EHOSTUNREACH;
-			if (!grt)
-				goto out;
-			if (dev) {
-				if (dev != grt->dst.dev) {
-					ip6_rt_put(grt);
+				if (!ip6_nh_valid(grt, &dev, &idev))
 					goto out;
-				}
-			} else {
-				dev = grt->dst.dev;
-				idev = grt->rt6i_idev;
-				dev_hold(dev);
-				in6_dev_hold(grt->rt6i_idev);
 			}
-			if (!(grt->rt6i_flags & RTF_GATEWAY))
-				err = 0;
-			ip6_rt_put(grt);
-
-			if (err)
-				goto out;
 		}
 		err = -EINVAL;
 		if (!dev || (dev->flags & IFF_LOOPBACK))
-- 
2.9.3

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

* Re: [PATCH] net: ipv6: fallback to full lookup if table lookup is unsuitable
  2016-09-16 12:55 [PATCH] net: ipv6: fallback to full lookup if table lookup is unsuitable Vincent Bernat
@ 2016-09-16 18:36 ` David Ahern
  2016-09-16 19:15   ` Vincent Bernat
  2016-09-19  4:58 ` [PATCH] " David Miller
  1 sibling, 1 reply; 11+ messages in thread
From: David Ahern @ 2016-09-16 18:36 UTC (permalink / raw)
  To: Vincent Bernat, David S. Miller, Alexey Kuznetsov, James Morris,
	Hideaki YOSHIFUJI, Patrick McHardy, netdev

On 9/16/16 6:55 AM, Vincent Bernat wrote:
> Commit 8c14586fc320 ("net: ipv6: Use passed in table for nexthop
> lookups") introduced a regression: insertion of an IPv6 route in a table
> not containing the appropriate connected route for the gateway but which
> contained a non-connected route (like a default gateway) fails while it
> was previously working:
> 
>     $ ip link add eth0 type dummy
>     $ ip link set up dev eth0
>     $ ip addr add 2001:db8::1/64 dev eth0
>     $ ip route add ::/0 via 2001:db8::5 dev eth0 table 20
>     $ ip route add 2001:db8:cafe::1/128 via 2001:db8::6 dev eth0 table 20
>     RTNETLINK answers: No route to host
>     $ ip -6 route show table 20
>     default via 2001:db8::5 dev eth0  metric 1024  pref medium

so your table 20 is not complete in that it lacks a connected route to resolve 2001:db8::6 as a nexthop, so you are relying on a fallback to other tables (main in this case).

-----8<-----

> @@ -1991,33 +2015,15 @@ static struct rt6_info *ip6_route_info_create(struct fib6_config *cfg)
>  			if (!(gwa_type & IPV6_ADDR_UNICAST))
>  				goto out;
>  
> +			err = -EHOSTUNREACH;
>  			if (cfg->fc_table)
>  				grt = ip6_nh_lookup_table(net, cfg, gw_addr);

-----8<-----

> -			if (!(grt->rt6i_flags & RTF_GATEWAY))
> -				err = 0;

This is the check that is failing for your use case. ip6_nh_lookup_table is returning the default route and nexthops can not rely on a gateway. Given that a simpler and more direct change is (whitespace mangled on paste):

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index ad4a7ff301fc..48bae2ee2e18 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1991,9 +1991,19 @@ static struct rt6_info *ip6_route_info_create(struct fib6_config *cfg)
                        if (!(gwa_type & IPV6_ADDR_UNICAST))
                                goto out;

-                       if (cfg->fc_table)
+                       if (cfg->fc_table) {
                                grt = ip6_nh_lookup_table(net, cfg, gw_addr);

+                               /* a nexthop lookup can not go through a gw.
+                                * if this happens on a table based lookup
+                                * then fallback to a full lookup
+                                */
+                               if (grt && grt->rt6i_flags & RTF_GATEWAY) {
+                                       ip6_rt_put(grt);
+                                       grt = NULL;
+                               }
+                       }
+
                        if (!grt)
                                grt = rt6_lookup(net, gw_addr, NULL,
                                                 cfg->fc_ifindex, 1);

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

* Re: [PATCH] net: ipv6: fallback to full lookup if table lookup is unsuitable
  2016-09-16 18:36 ` David Ahern
@ 2016-09-16 19:15   ` Vincent Bernat
  2016-09-16 19:38     ` David Ahern
  0 siblings, 1 reply; 11+ messages in thread
From: Vincent Bernat @ 2016-09-16 19:15 UTC (permalink / raw)
  To: David Ahern
  Cc: David S. Miller, Alexey Kuznetsov, James Morris,
	Hideaki YOSHIFUJI, Patrick McHardy, netdev

 ❦ 16 septembre 2016 20:36 CEST, David Ahern <dsa@cumulusnetworks.com> :

>> contained a non-connected route (like a default gateway) fails while it
>> was previously working:
>> 
>>     $ ip link add eth0 type dummy
>>     $ ip link set up dev eth0
>>     $ ip addr add 2001:db8::1/64 dev eth0
>>     $ ip route add ::/0 via 2001:db8::5 dev eth0 table 20
>>     $ ip route add 2001:db8:cafe::1/128 via 2001:db8::6 dev eth0 table 20
>>     RTNETLINK answers: No route to host
>>     $ ip -6 route show table 20
>>     default via 2001:db8::5 dev eth0  metric 1024  pref medium
>
> so your table 20 is not complete in that it lacks a connected route to
> resolve 2001:db8::6 as a nexthop, so you are relying on a fallback to
> other tables (main in this case).

Yes.

>> @@ -1991,33 +2015,15 @@ static struct rt6_info *ip6_route_info_create(struct fib6_config *cfg)
>>  			if (!(gwa_type & IPV6_ADDR_UNICAST))
>>  				goto out;
>>  
>> +			err = -EHOSTUNREACH;
>>  			if (cfg->fc_table)
>>  				grt = ip6_nh_lookup_table(net, cfg, gw_addr);
>
> -----8<-----
>
>> -			if (!(grt->rt6i_flags & RTF_GATEWAY))
>> -				err = 0;
>
> This is the check that is failing for your use
> case. ip6_nh_lookup_table is returning the default route and nexthops
> can not rely on a gateway. Given that a simpler and more direct change
> is (whitespace mangled on paste):
>
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index ad4a7ff301fc..48bae2ee2e18 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -1991,9 +1991,19 @@ static struct rt6_info *ip6_route_info_create(struct fib6_config *cfg)
>                         if (!(gwa_type & IPV6_ADDR_UNICAST))
>                                 goto out;
>
> -                       if (cfg->fc_table)
> +                       if (cfg->fc_table) {
>                                 grt = ip6_nh_lookup_table(net, cfg, gw_addr);
>
> +                               /* a nexthop lookup can not go through a gw.
> +                                * if this happens on a table based lookup
> +                                * then fallback to a full lookup
> +                                */
> +                               if (grt && grt->rt6i_flags & RTF_GATEWAY) {
> +                                       ip6_rt_put(grt);
> +                                       grt = NULL;
> +                               }
> +                       }
> +
>                         if (!grt)
>                                 grt = rt6_lookup(net, gw_addr, NULL,
>                                                  cfg->fc_ifindex, 1);

OK. Should the dev check be dismissed or do we add "dev && dev !=
grt->dst.dev" just as a safety net (this would be a convulated setup,
but the correct direct route could be in an ip rule with higher priority
while the one in this table is incorrect)?
-- 
"... an experienced, industrious, ambitious, and often quite often
picturesque liar."
		-- Mark Twain

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

* Re: [PATCH] net: ipv6: fallback to full lookup if table lookup is unsuitable
  2016-09-16 19:15   ` Vincent Bernat
@ 2016-09-16 19:38     ` David Ahern
  2016-09-16 20:33       ` [v2] " Vincent Bernat
  0 siblings, 1 reply; 11+ messages in thread
From: David Ahern @ 2016-09-16 19:38 UTC (permalink / raw)
  To: Vincent Bernat
  Cc: David S. Miller, Alexey Kuznetsov, James Morris,
	Hideaki YOSHIFUJI, Patrick McHardy, netdev

On 9/16/16 1:15 PM, Vincent Bernat wrote:
>> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
>> index ad4a7ff301fc..48bae2ee2e18 100644
>> --- a/net/ipv6/route.c
>> +++ b/net/ipv6/route.c
>> @@ -1991,9 +1991,19 @@ static struct rt6_info *ip6_route_info_create(struct fib6_config *cfg)
>>                         if (!(gwa_type & IPV6_ADDR_UNICAST))
>>                                 goto out;
>>
>> -                       if (cfg->fc_table)
>> +                       if (cfg->fc_table) {
>>                                 grt = ip6_nh_lookup_table(net, cfg, gw_addr);
>>
>> +                               /* a nexthop lookup can not go through a gw.
>> +                                * if this happens on a table based lookup
>> +                                * then fallback to a full lookup
>> +                                */
>> +                               if (grt && grt->rt6i_flags & RTF_GATEWAY) {
>> +                                       ip6_rt_put(grt);
>> +                                       grt = NULL;
>> +                               }
>> +                       }
>> +
>>                         if (!grt)
>>                                 grt = rt6_lookup(net, gw_addr, NULL,
>>                                                  cfg->fc_ifindex, 1);
> 
> OK. Should the dev check be dismissed or do we add "dev && dev !=
> grt->dst.dev" just as a safety net (this would be a convulated setup,
> but the correct direct route could be in an ip rule with higher priority
> while the one in this table is incorrect)?
> 

yes. So the validity check becomes:

	grt = ip6_nh_lookup_table(net, cfg, gw_addr);
	if (grt) {
		if (grt->rt6i_flags & RTF_GATEWAY ||
		    dev && dev != grt->dst.dev) {
			ip6_rt_put(grt);
			grt = NULL;            <---- causes the full rt6_lookup
		}
	}

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

* [v2] net: ipv6: fallback to full lookup if table lookup is unsuitable
  2016-09-16 19:38     ` David Ahern
@ 2016-09-16 20:33       ` Vincent Bernat
  2016-09-18 15:12         ` David Ahern
  0 siblings, 1 reply; 11+ messages in thread
From: Vincent Bernat @ 2016-09-16 20:33 UTC (permalink / raw)
  To: David Ahern, David S. Miller, Alexey Kuznetsov, James Morris,
	Hideaki YOSHIFUJI, Patrick McHardy, netdev
  Cc: Vincent Bernat

Commit 8c14586fc320 ("net: ipv6: Use passed in table for nexthop
lookups") introduced a regression: insertion of an IPv6 route in a table
not containing the appropriate connected route for the gateway but which
contained a non-connected route (like a default gateway) fails while it
was previously working:

    $ ip link add eth0 type dummy
    $ ip link set up dev eth0
    $ ip addr add 2001:db8::1/64 dev eth0
    $ ip route add ::/0 via 2001:db8::5 dev eth0 table 20
    $ ip route add 2001:db8:cafe::1/128 via 2001:db8::6 dev eth0 table 20
    RTNETLINK answers: No route to host
    $ ip -6 route show table 20
    default via 2001:db8::5 dev eth0  metric 1024  pref medium

After this patch, we get:

    $ ip route add 2001:db8:cafe::1/128 via 2001:db8::6 dev eth0 table 20
    $ ip -6 route show table 20
    2001:db8:cafe::1 via 2001:db8::6 dev eth0  metric 1024  pref medium
    default via 2001:db8::5 dev eth0  metric 1024  pref medium

Signed-off-by: Vincent Bernat <vincent@bernat.im>
---
 net/ipv6/route.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index ad4a7ff301fc..2c6c7257ff75 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1994,6 +1994,14 @@ static struct rt6_info *ip6_route_info_create(struct fib6_config *cfg)
 			if (cfg->fc_table)
 				grt = ip6_nh_lookup_table(net, cfg, gw_addr);
 
+			if (grt) {
+				if (grt->rt6i_flags & RTF_GATEWAY ||
+				    (dev && dev != grt->dst.dev)) {
+					ip6_rt_put(grt);
+					grt = NULL;
+				}
+			}
+
 			if (!grt)
 				grt = rt6_lookup(net, gw_addr, NULL,
 						 cfg->fc_ifindex, 1);
-- 
2.9.3

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

* Re: [v2] net: ipv6: fallback to full lookup if table lookup is unsuitable
  2016-09-16 20:33       ` [v2] " Vincent Bernat
@ 2016-09-18 15:12         ` David Ahern
  2016-09-18 15:46           ` [v3] " Vincent Bernat
  0 siblings, 1 reply; 11+ messages in thread
From: David Ahern @ 2016-09-18 15:12 UTC (permalink / raw)
  To: Vincent Bernat, David S. Miller, Alexey Kuznetsov, James Morris,
	Hideaki YOSHIFUJI, Patrick McHardy, netdev

On 9/16/16 2:33 PM, Vincent Bernat wrote:
> Commit 8c14586fc320 ("net: ipv6: Use passed in table for nexthop
> lookups") introduced a regression: insertion of an IPv6 route in a table
> not containing the appropriate connected route for the gateway but which
> contained a non-connected route (like a default gateway) fails while it
> was previously working:
> 
>     $ ip link add eth0 type dummy
>     $ ip link set up dev eth0
>     $ ip addr add 2001:db8::1/64 dev eth0
>     $ ip route add ::/0 via 2001:db8::5 dev eth0 table 20
>     $ ip route add 2001:db8:cafe::1/128 via 2001:db8::6 dev eth0 table 20
>     RTNETLINK answers: No route to host
>     $ ip -6 route show table 20
>     default via 2001:db8::5 dev eth0  metric 1024  pref medium
> 
> After this patch, we get:
> 
>     $ ip route add 2001:db8:cafe::1/128 via 2001:db8::6 dev eth0 table 20
>     $ ip -6 route show table 20
>     2001:db8:cafe::1 via 2001:db8::6 dev eth0  metric 1024  pref medium
>     default via 2001:db8::5 dev eth0  metric 1024  pref medium
> 

need an explicit Fixes tag here:

Fixes: 8c14586fc320 ("net: ipv6: Use passed in table for nexthop lookups")

> Signed-off-by: Vincent Bernat <vincent@bernat.im>
> ---
>  net/ipv6/route.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index ad4a7ff301fc..2c6c7257ff75 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -1994,6 +1994,14 @@ static struct rt6_info *ip6_route_info_create(struct fib6_config *cfg)
>  			if (cfg->fc_table)
>  				grt = ip6_nh_lookup_table(net, cfg, gw_addr);
>  
> +			if (grt) {
> +				if (grt->rt6i_flags & RTF_GATEWAY ||
> +				    (dev && dev != grt->dst.dev)) {
> +					ip6_rt_put(grt);
> +					grt = NULL;
> +				}
> +			}
> +

The if grt check needs to be under the 'if (cfg->fc_table)'


>  			if (!grt)
>  				grt = rt6_lookup(net, gw_addr, NULL,
>  						 cfg->fc_ifindex, 1);
> 

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

* [v3] net: ipv6: fallback to full lookup if table lookup is unsuitable
  2016-09-18 15:12         ` David Ahern
@ 2016-09-18 15:46           ` Vincent Bernat
  2016-09-18 15:47             ` David Ahern
  2016-09-20  7:29             ` David Miller
  0 siblings, 2 replies; 11+ messages in thread
From: Vincent Bernat @ 2016-09-18 15:46 UTC (permalink / raw)
  To: David Ahern, David S. Miller, Alexey Kuznetsov, James Morris,
	Hideaki YOSHIFUJI, Patrick McHardy, netdev
  Cc: Vincent Bernat

Commit 8c14586fc320 ("net: ipv6: Use passed in table for nexthop
lookups") introduced a regression: insertion of an IPv6 route in a table
not containing the appropriate connected route for the gateway but which
contained a non-connected route (like a default gateway) fails while it
was previously working:

    $ ip link add eth0 type dummy
    $ ip link set up dev eth0
    $ ip addr add 2001:db8::1/64 dev eth0
    $ ip route add ::/0 via 2001:db8::5 dev eth0 table 20
    $ ip route add 2001:db8:cafe::1/128 via 2001:db8::6 dev eth0 table 20
    RTNETLINK answers: No route to host
    $ ip -6 route show table 20
    default via 2001:db8::5 dev eth0  metric 1024  pref medium

After this patch, we get:

    $ ip route add 2001:db8:cafe::1/128 via 2001:db8::6 dev eth0 table 20
    $ ip -6 route show table 20
    2001:db8:cafe::1 via 2001:db8::6 dev eth0  metric 1024  pref medium
    default via 2001:db8::5 dev eth0  metric 1024  pref medium

Fixes: 8c14586fc320 ("net: ipv6: Use passed in table for nexthop lookups")
Signed-off-by: Vincent Bernat <vincent@bernat.im>
---
 net/ipv6/route.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index ad4a7ff301fc..ec33c6d7eed5 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1991,9 +1991,18 @@ static struct rt6_info *ip6_route_info_create(struct fib6_config *cfg)
 			if (!(gwa_type & IPV6_ADDR_UNICAST))
 				goto out;
 
-			if (cfg->fc_table)
+			if (cfg->fc_table) {
 				grt = ip6_nh_lookup_table(net, cfg, gw_addr);
 
+				if (grt) {
+					if (grt->rt6i_flags & RTF_GATEWAY ||
+					    (dev && dev != grt->dst.dev)) {
+						ip6_rt_put(grt);
+						grt = NULL;
+					}
+				}
+			}
+
 			if (!grt)
 				grt = rt6_lookup(net, gw_addr, NULL,
 						 cfg->fc_ifindex, 1);
-- 
2.9.3

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

* Re: [v3] net: ipv6: fallback to full lookup if table lookup is unsuitable
  2016-09-18 15:46           ` [v3] " Vincent Bernat
@ 2016-09-18 15:47             ` David Ahern
  2016-09-20  7:29             ` David Miller
  1 sibling, 0 replies; 11+ messages in thread
From: David Ahern @ 2016-09-18 15:47 UTC (permalink / raw)
  To: Vincent Bernat, David S. Miller, Alexey Kuznetsov, James Morris,
	Hideaki YOSHIFUJI, Patrick McHardy, netdev

On 9/18/16 9:46 AM, Vincent Bernat wrote:
> Commit 8c14586fc320 ("net: ipv6: Use passed in table for nexthop
> lookups") introduced a regression: insertion of an IPv6 route in a table
> not containing the appropriate connected route for the gateway but which
> contained a non-connected route (like a default gateway) fails while it
> was previously working:
> 
>     $ ip link add eth0 type dummy
>     $ ip link set up dev eth0
>     $ ip addr add 2001:db8::1/64 dev eth0
>     $ ip route add ::/0 via 2001:db8::5 dev eth0 table 20
>     $ ip route add 2001:db8:cafe::1/128 via 2001:db8::6 dev eth0 table 20
>     RTNETLINK answers: No route to host
>     $ ip -6 route show table 20
>     default via 2001:db8::5 dev eth0  metric 1024  pref medium
> 
> After this patch, we get:
> 
>     $ ip route add 2001:db8:cafe::1/128 via 2001:db8::6 dev eth0 table 20
>     $ ip -6 route show table 20
>     2001:db8:cafe::1 via 2001:db8::6 dev eth0  metric 1024  pref medium
>     default via 2001:db8::5 dev eth0  metric 1024  pref medium
> 
> Fixes: 8c14586fc320 ("net: ipv6: Use passed in table for nexthop lookups")
> Signed-off-by: Vincent Bernat <vincent@bernat.im>
> ---
>  net/ipv6/route.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)

Acked-by: David Ahern <dsa@cumulusnetworks.com>
Tested-by: David Ahern <dsa@cumulusnetworks.com>

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

* Re: [PATCH] net: ipv6: fallback to full lookup if table lookup is unsuitable
  2016-09-16 12:55 [PATCH] net: ipv6: fallback to full lookup if table lookup is unsuitable Vincent Bernat
  2016-09-16 18:36 ` David Ahern
@ 2016-09-19  4:58 ` David Miller
  2016-09-19 20:27   ` Vincent Bernat
  1 sibling, 1 reply; 11+ messages in thread
From: David Miller @ 2016-09-19  4:58 UTC (permalink / raw)
  To: vincent; +Cc: dsa, kuznet, jmorris, yoshfuji, kaber, netdev

From: Vincent Bernat <vincent@bernat.im>
Date: Fri, 16 Sep 2016 14:55:31 +0200

> @@ -1808,6 +1808,30 @@ static struct rt6_info *ip6_nh_lookup_table(struct net *net,
>  	return rt;
>  }
>  
> +static int ip6_nh_valid(struct rt6_info *grt,
> +			struct net_device **dev, struct inet6_dev **idev) {
> +	int ret = 0;

First, this is not formatted properly.  The openning brace should start
on a new line.

Second, please use "bool", "true", and "false" for the return value.

Thanks.

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

* Re: [PATCH] net: ipv6: fallback to full lookup if table lookup is unsuitable
  2016-09-19  4:58 ` [PATCH] " David Miller
@ 2016-09-19 20:27   ` Vincent Bernat
  0 siblings, 0 replies; 11+ messages in thread
From: Vincent Bernat @ 2016-09-19 20:27 UTC (permalink / raw)
  To: David Miller; +Cc: dsa, kuznet, jmorris, yoshfuji, kaber, netdev

 ❦ 19 septembre 2016 06:58 CEST, David Miller <davem@davemloft.net> :

>> @@ -1808,6 +1808,30 @@ static struct rt6_info *ip6_nh_lookup_table(struct net *net,
>>  	return rt;
>>  }
>>  
>> +static int ip6_nh_valid(struct rt6_info *grt,
>> +			struct net_device **dev, struct inet6_dev **idev) {
>> +	int ret = 0;
>
> First, this is not formatted properly.  The openning brace should start
> on a new line.
>
> Second, please use "bool", "true", and "false" for the return value.

Noted for the next time. However, the v3 version of the patch doesn't
have the function anymore.
-- 
Avoid temporary variables.
            - The Elements of Programming Style (Kernighan & Plauger)

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

* Re: [v3] net: ipv6: fallback to full lookup if table lookup is unsuitable
  2016-09-18 15:46           ` [v3] " Vincent Bernat
  2016-09-18 15:47             ` David Ahern
@ 2016-09-20  7:29             ` David Miller
  1 sibling, 0 replies; 11+ messages in thread
From: David Miller @ 2016-09-20  7:29 UTC (permalink / raw)
  To: vincent; +Cc: dsa, kuznet, jmorris, yoshfuji, kaber, netdev

From: Vincent Bernat <vincent@bernat.im>
Date: Sun, 18 Sep 2016 17:46:07 +0200

> Commit 8c14586fc320 ("net: ipv6: Use passed in table for nexthop
> lookups") introduced a regression: insertion of an IPv6 route in a table
> not containing the appropriate connected route for the gateway but which
> contained a non-connected route (like a default gateway) fails while it
> was previously working:
> 
>     $ ip link add eth0 type dummy
>     $ ip link set up dev eth0
>     $ ip addr add 2001:db8::1/64 dev eth0
>     $ ip route add ::/0 via 2001:db8::5 dev eth0 table 20
>     $ ip route add 2001:db8:cafe::1/128 via 2001:db8::6 dev eth0 table 20
>     RTNETLINK answers: No route to host
>     $ ip -6 route show table 20
>     default via 2001:db8::5 dev eth0  metric 1024  pref medium
> 
> After this patch, we get:
> 
>     $ ip route add 2001:db8:cafe::1/128 via 2001:db8::6 dev eth0 table 20
>     $ ip -6 route show table 20
>     2001:db8:cafe::1 via 2001:db8::6 dev eth0  metric 1024  pref medium
>     default via 2001:db8::5 dev eth0  metric 1024  pref medium
> 
> Fixes: 8c14586fc320 ("net: ipv6: Use passed in table for nexthop lookups")
> Signed-off-by: Vincent Bernat <vincent@bernat.im>

Applied and queued up for -stable, thanks.

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

end of thread, other threads:[~2016-09-20  7:29 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-16 12:55 [PATCH] net: ipv6: fallback to full lookup if table lookup is unsuitable Vincent Bernat
2016-09-16 18:36 ` David Ahern
2016-09-16 19:15   ` Vincent Bernat
2016-09-16 19:38     ` David Ahern
2016-09-16 20:33       ` [v2] " Vincent Bernat
2016-09-18 15:12         ` David Ahern
2016-09-18 15:46           ` [v3] " Vincent Bernat
2016-09-18 15:47             ` David Ahern
2016-09-20  7:29             ` David Miller
2016-09-19  4:58 ` [PATCH] " David Miller
2016-09-19 20:27   ` Vincent Bernat

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).