netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] return the right retcode when add a unreachable route
@ 2014-07-06 11:01 Xin Long
  2014-07-08 18:49 ` Cong Wang
  0 siblings, 1 reply; 4+ messages in thread
From: Xin Long @ 2014-07-06 11:01 UTC (permalink / raw)
  To: network dev; +Cc: Xin Long

when add a route like this:
ip route add 74.125.31.199 dev eth0 via 1.2.3.4 ,
1.2.3.4 is a unreachable ip, it return -ENETUNREACH, it is ok.
but before that I add a rule:
ip rule add fwmark 1 lookup 101 ,
then add that route , it will return -ESRCH.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 include/net/ip_fib.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 9922093..cfc2293 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -261,7 +261,9 @@ static inline int fib_lookup(struct net *net, struct flowi4 *flp,
 			return 0;
 		return -ENETUNREACH;
 	}
-	return __fib_lookup(net, flp, res);
+	if(__fib_lookup(net, flp, res))
+		return -ENETUNREACH;
+	return 0;
 }
 
 #endif /* CONFIG_IP_MULTIPLE_TABLES */
-- 
1.8.3.1

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

end of thread, other threads:[~2014-07-09  2:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-06 11:01 [PATCH] return the right retcode when add a unreachable route Xin Long
2014-07-08 18:49 ` Cong Wang
2014-07-09  1:51   ` lucien xin
2014-07-09  2:33     ` 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).