diff mbox

net: Fix nexthop lookups

Message ID 1440009631-8082-1-git-send-email-dsa@cumulusnetworks.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

David Ahern Aug. 19, 2015, 6:40 p.m. UTC
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(-)

Comments

David Miller Aug. 20, 2015, 9:43 p.m. UTC | #1
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.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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;