All of lore.kernel.org
 help / color / mirror / Atom feed
* [net-next]: unable to add routes to tables
@ 2015-08-18 16:57 Andreas Schultz
  2015-08-18 17:05 ` David Ahern
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Andreas Schultz @ 2015-08-18 16:57 UTC (permalink / raw)
  To: netdev

Hi,

It seems that the policy for adding routes to tables has changed between
Linux 4.2-rc6 and net-next.

In Linux main line (tested up to 4.2-rc6), with this main routing table:
# ip route show table main
...
172.28.0.0/24 dev vnf-xe1p0  proto kernel  scope link  src 172.28.0.16 

and an empty table 100, this works:

# ip route add 10.0.0.0/8 via 172.28.0.32 table 100 dev vnf-xe1p0

With net-next at commit d52736e24fe2e927c26817256f8d1a3c8b5d51a0, the
same command leads to an:

# ip route add 10.0.0.0/8 via 172.28.0.32 table 100 dev vnf-xe1p0
RTNETLINK answers: Resource temporarily unavailable

Is this expected behavior?

Andreas

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

* Re: [net-next]: unable to add routes to tables
  2015-08-18 16:57 [net-next]: unable to add routes to tables Andreas Schultz
@ 2015-08-18 17:05 ` David Ahern
  2015-08-18 17:26 ` David Ahern
  2015-08-19 18:40 ` [PATCH] net: Fix nexthop lookups David Ahern
  2 siblings, 0 replies; 6+ messages in thread
From: David Ahern @ 2015-08-18 17:05 UTC (permalink / raw)
  To: Andreas Schultz, netdev

On 8/18/15 10:57 AM, Andreas Schultz wrote:
> Hi,
>
> It seems that the policy for adding routes to tables has changed between
> Linux 4.2-rc6 and net-next.
>
> In Linux main line (tested up to 4.2-rc6), with this main routing table:
> # ip route show table main
> ...
> 172.28.0.0/24 dev vnf-xe1p0  proto kernel  scope link  src 172.28.0.16
>
> and an empty table 100, this works:
>
> # ip route add 10.0.0.0/8 via 172.28.0.32 table 100 dev vnf-xe1p0
>
> With net-next at commit d52736e24fe2e927c26817256f8d1a3c8b5d51a0, the
> same command leads to an:
>
> # ip route add 10.0.0.0/8 via 172.28.0.32 table 100 dev vnf-xe1p0
> RTNETLINK answers: Resource temporarily unavailable
>
> Is this expected behavior?

That's going to be due to 3bfd847203c6d89532f836ad3f5b4ff4ced26dd9.

I'll fix.

David

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

* Re: [net-next]: unable to add routes to tables
  2015-08-18 16:57 [net-next]: unable to add routes to tables Andreas Schultz
  2015-08-18 17:05 ` David Ahern
@ 2015-08-18 17:26 ` David Ahern
  2015-08-19 10:38   ` Andreas Schultz
  2015-08-19 18:40 ` [PATCH] net: Fix nexthop lookups David Ahern
  2 siblings, 1 reply; 6+ messages in thread
From: David Ahern @ 2015-08-18 17:26 UTC (permalink / raw)
  To: Andreas Schultz, netdev

[-- Attachment #1: Type: text/plain, Size: 855 bytes --]

On 8/18/15 10:57 AM, Andreas Schultz wrote:
> Hi,
>
> It seems that the policy for adding routes to tables has changed between
> Linux 4.2-rc6 and net-next.
>
> In Linux main line (tested up to 4.2-rc6), with this main routing table:
> # ip route show table main
> ...
> 172.28.0.0/24 dev vnf-xe1p0  proto kernel  scope link  src 172.28.0.16
>
> and an empty table 100, this works:
>
> # ip route add 10.0.0.0/8 via 172.28.0.32 table 100 dev vnf-xe1p0
>
> With net-next at commit d52736e24fe2e927c26817256f8d1a3c8b5d51a0, the
> same command leads to an:
>
> # ip route add 10.0.0.0/8 via 172.28.0.32 table 100 dev vnf-xe1p0
> RTNETLINK answers: Resource temporarily unavailable
>
> Is this expected behavior?
>

The attached works for me and so does my original problem. Can you 
confirm it resolves your problem? If so I'll send a formal patch.

David



[-- Attachment #2: fix-nexthop-lookup.path --]
[-- Type: text/plain, Size: 721 bytes --]

diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index c8025851dac7..01a237278dd2 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -710,9 +710,16 @@ static int fib_check_nh(struct fib_config *cfg, struct fib_info *fi,
 				err = fib_table_lookup(tbl, &fl4, &res,
 						       FIB_LOOKUP_IGNORE_LINKSTATE |
 						       FIB_LOOKUP_NOREF);
-			else
+
+			/* on error or if no table given do full lookup. This is
+			 * needed for example when nexthops are in the local table
+			 * rather than the given table
+			 */
+			if (!tbl || err) {
 				err = fib_lookup(net, &fl4, &res,
 						 FIB_LOOKUP_IGNORE_LINKSTATE);
+			}
+
 			if (err) {
 				rcu_read_unlock();
 				return err;

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

* Re: [net-next]: unable to add routes to tables
  2015-08-18 17:26 ` David Ahern
@ 2015-08-19 10:38   ` Andreas Schultz
  0 siblings, 0 replies; 6+ messages in thread
From: Andreas Schultz @ 2015-08-19 10:38 UTC (permalink / raw)
  To: David Ahern, netdev

On 08/18/2015 07:26 PM, David Ahern wrote:
> On 8/18/15 10:57 AM, Andreas Schultz wrote:
>> Hi,
>>
>> It seems that the policy for adding routes to tables has changed between
>> Linux 4.2-rc6 and net-next.
>>
>> In Linux main line (tested up to 4.2-rc6), with this main routing table:
>> # ip route show table main
>> ...
>> 172.28.0.0/24 dev vnf-xe1p0  proto kernel  scope link  src 172.28.0.16
>>
>> and an empty table 100, this works:
>>
>> # ip route add 10.0.0.0/8 via 172.28.0.32 table 100 dev vnf-xe1p0
>>
>> With net-next at commit d52736e24fe2e927c26817256f8d1a3c8b5d51a0, the
>> same command leads to an:
>>
>> # ip route add 10.0.0.0/8 via 172.28.0.32 table 100 dev vnf-xe1p0
>> RTNETLINK answers: Resource temporarily unavailable
>>
>> Is this expected behavior?
>>
>
> The attached works for me and so does my original problem. Can you confirm it resolves your problem? If so I'll send a formal patch.

Seems to fix my problem, thanks.

Andreas

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

* [PATCH] net: Fix nexthop lookups
  2015-08-18 16:57 [net-next]: unable to add routes to tables Andreas Schultz
  2015-08-18 17:05 ` David Ahern
  2015-08-18 17:26 ` David Ahern
@ 2015-08-19 18:40 ` David Ahern
  2015-08-20 21:43   ` David Miller
  2 siblings, 1 reply; 6+ messages in thread
From: David Ahern @ 2015-08-19 18:40 UTC (permalink / raw)
  To: netdev; +Cc: David Ahern

Andreas reported breakage adding routes with local nexthops:
$ ip route show table main
...
172.28.0.0/24 dev vnf-xe1p0  proto kernel  scope link  src 172.28.0.16

$ ip route add 10.0.0.0/8 via 172.28.0.32 table 100 dev vnf-xe1p0
RTNETLINK answers: Resource temporarily unavailable

3bfd847203c changed the lookup to use the passed in table but for cases like
this the nexthop is in the local table rather than the passed in table.

Fixes: 3bfd847203c ("net: Use passed in table for nexthop lookups")
Reported-by: Andreas Schultz <aschultz@tpip.net>
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
---
 net/ipv4/fib_semantics.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index c8025851dac7..0ab5bf558805 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -710,9 +710,16 @@ static int fib_check_nh(struct fib_config *cfg, struct fib_info *fi,
 				err = fib_table_lookup(tbl, &fl4, &res,
 						       FIB_LOOKUP_IGNORE_LINKSTATE |
 						       FIB_LOOKUP_NOREF);
-			else
+
+			/* on error or if no table given do full lookup. This
+			 * is needed for example when nexthops are in the local
+			 * table rather than the given table
+			 */
+			if (!tbl || err) {
 				err = fib_lookup(net, &fl4, &res,
 						 FIB_LOOKUP_IGNORE_LINKSTATE);
+			}
+
 			if (err) {
 				rcu_read_unlock();
 				return err;
-- 
2.3.2 (Apple Git-55)

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

* Re: [PATCH] net: Fix nexthop lookups
  2015-08-19 18:40 ` [PATCH] net: Fix nexthop lookups David Ahern
@ 2015-08-20 21:43   ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2015-08-20 21:43 UTC (permalink / raw)
  To: dsa; +Cc: netdev

From: David Ahern <dsa@cumulusnetworks.com>
Date: Wed, 19 Aug 2015 11:40:31 -0700

> Andreas reported breakage adding routes with local nexthops:
> $ ip route show table main
> ...
> 172.28.0.0/24 dev vnf-xe1p0  proto kernel  scope link  src 172.28.0.16
> 
> $ ip route add 10.0.0.0/8 via 172.28.0.32 table 100 dev vnf-xe1p0
> RTNETLINK answers: Resource temporarily unavailable
> 
> 3bfd847203c changed the lookup to use the passed in table but for cases like
> this the nexthop is in the local table rather than the passed in table.
> 
> Fixes: 3bfd847203c ("net: Use passed in table for nexthop lookups")
> Reported-by: Andreas Schultz <aschultz@tpip.net>
> Signed-off-by: David Ahern <dsa@cumulusnetworks.com>

Applied to net-next, thanks David.

Please be explicit in the future about what tree your patch is targetted
at by either saying "[PATCH net]" or "[PATCH net-next]" in your subject.

Thanks.

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

end of thread, other threads:[~2015-08-20 21:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-18 16:57 [net-next]: unable to add routes to tables Andreas Schultz
2015-08-18 17:05 ` David Ahern
2015-08-18 17:26 ` David Ahern
2015-08-19 10:38   ` Andreas Schultz
2015-08-19 18:40 ` [PATCH] net: Fix nexthop lookups David Ahern
2015-08-20 21:43   ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.