From: Xin Long <lucien.xin@gmail.com>
To: network dev <netdev@vger.kernel.org>
Cc: Xin Long <lucien.xin@gmail.com>
Subject: [PATCH] return the right retcode when add a unreachable route
Date: Sun, 6 Jul 2014 19:01:51 +0800 [thread overview]
Message-ID: <1404644511-22112-1-git-send-email-lucien.xin@gmail.com> (raw)
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
next reply other threads:[~2014-07-06 11:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-06 11:01 Xin Long [this message]
2014-07-08 18:49 ` [PATCH] return the right retcode when add a unreachable route Cong Wang
2014-07-09 1:51 ` lucien xin
2014-07-09 2:33 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1404644511-22112-1-git-send-email-lucien.xin@gmail.com \
--to=lucien.xin@gmail.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).