Message ID | 1404644511-22112-1-git-send-email-lucien.xin@gmail.com |
---|---|
State | Rejected, archived |
Delegated to: | David Miller |
Headers | show |
On Sun, Jul 6, 2014 at 4:01 AM, Xin Long <lucien.xin@gmail.com> wrote: > 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. > This would potentially break user-space applications. -- 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
On Wed, Jul 9, 2014 at 2:49 AM, Cong Wang <cwang@twopensource.com> wrote: > On Sun, Jul 6, 2014 at 4:01 AM, Xin Long <lucien.xin@gmail.com> wrote: > > This would potentially break user-space applications. yes, you are right. if I only handle the -ESRCH , like: - return __fib_lookup(net, flp, res); + + err = __fib_lookup(net, flp, res); + if(err == -ESRCH) + return -ENETUNREACH; + + return err; I think it will be ok, after all, it looks confused that err is *No such process* when add a route. thanks for your reply. -- 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
From: lucien xin <lucien.xin@gmail.com> Date: Wed, 9 Jul 2014 09:51:02 +0800 > On Wed, Jul 9, 2014 at 2:49 AM, Cong Wang <cwang@twopensource.com> wrote: >> On Sun, Jul 6, 2014 at 4:01 AM, Xin Long <lucien.xin@gmail.com> wrote: >> >> This would potentially break user-space applications. > > yes, you are right. if I only handle the -ESRCH , like: > > - return __fib_lookup(net, flp, res); > + > + err = __fib_lookup(net, flp, res); > + if(err == -ESRCH) > + return -ENETUNREACH; > + > + return err; > > I think it will be ok, after all, it looks confused that err is *No > such process* when add a route. It doesn't matter, if applications want to work on all kernels they will test whatever error code is being provided now. Therefore, by changing it you will break those applications. -- 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 --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 */
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(-)