* [PATCH 1/1] fix return code from fib_rules_lookup()
@ 2014-11-22 6:25 Ani Sinha
2014-11-23 19:24 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Ani Sinha @ 2014-11-22 6:25 UTC (permalink / raw)
To: davem, maze, edumazet; +Cc: netdev, fruggeri, ani
fib_lookup() api returns two different types of error
codes. When no custom FIB rules are installed and
lookup fails, it returns ENETUNREACH. However, when
custom rules are installed, __fib_lookup() calls
fib_rules_lookup() which returns ESRCH when the rule
lookup fails. This patch makes both code paths return
identical error codes under lookup failure.
Signed-off-by: Ani Sinha <ani@arista.com>
---
net/core/fib_rules.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index 185c341..ab8e732 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -242,7 +242,7 @@ jumped:
}
}
- err = -ESRCH;
+ err = -ENETUNREACH;
out:
rcu_read_unlock();
--
1.7.4.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] fix return code from fib_rules_lookup()
2014-11-22 6:25 [PATCH 1/1] fix return code from fib_rules_lookup() Ani Sinha
@ 2014-11-23 19:24 ` David Miller
2014-11-24 18:34 ` Ani Sinha
0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2014-11-23 19:24 UTC (permalink / raw)
To: ani; +Cc: maze, edumazet, netdev, fruggeri
From: Ani Sinha <ani@arista.com>
Date: Fri, 21 Nov 2014 22:25:21 -0800
> fib_lookup() api returns two different types of error
> codes. When no custom FIB rules are installed and
> lookup fails, it returns ENETUNREACH. However, when
> custom rules are installed, __fib_lookup() calls
> fib_rules_lookup() which returns ESRCH when the rule
> lookup fails. This patch makes both code paths return
> identical error codes under lookup failure.
>
> Signed-off-by: Ani Sinha <ani@arista.com>
How does this relate to the already committed:
commit 49dd18ba4615eaa72f15c9087dea1c2ab4744cf5
Author: Panu Matilainen <pmatilai@redhat.com>
Date: Fri Nov 14 13:14:32 2014 +0200
ipv4: Fix incorrect error code when adding an unreachable route
Trying to add an unreachable route incorrectly returns -ESRCH if
if custom FIB rules are present:
[root@localhost ~]# ip route add 74.125.31.199 dev eth0 via 1.2.3.4
RTNETLINK answers: Network is unreachable
[root@localhost ~]# ip rule add to 55.66.77.88 table 200
[root@localhost ~]# ip route add 74.125.31.199 dev eth0 via 1.2.3.4
RTNETLINK answers: No such process
[root@localhost ~]#
Commit 83886b6b636173b206f475929e58fac75c6f2446 ("[NET]: Change "not found"
return value for rule lookup") changed fib_rules_lookup()
to use -ESRCH as a "not found" code internally, but for user space it
should be translated into -ENETUNREACH. Handle the translation centrally in
ipv4-specific fib_lookup(), leaving the DECnet case alone.
On a related note, commit b7a71b51ee37d919e4098cd961d59a883fd272d8
("ipv4: removed redundant conditional") removed a similar translation from
ip_route_input_slow() prematurely AIUI.
Fixes: b7a71b51ee37 ("ipv4: removed redundant conditional")
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c
index f2e1573..8f7bd56 100644
--- a/net/ipv4/fib_rules.c
+++ b/net/ipv4/fib_rules.c
@@ -62,6 +62,10 @@ int __fib_lookup(struct net *net, struct flowi4 *flp, struct fib_result *res)
else
res->tclassid = 0;
#endif
+
+ if (err == -ESRCH)
+ err = -ENETUNREACH;
+
return err;
}
EXPORT_SYMBOL_GPL(__fib_lookup);
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] fix return code from fib_rules_lookup()
2014-11-23 19:24 ` David Miller
@ 2014-11-24 18:34 ` Ani Sinha
0 siblings, 0 replies; 3+ messages in thread
From: Ani Sinha @ 2014-11-24 18:34 UTC (permalink / raw)
To: David Miller; +Cc: maze, Eric Dumazet, netdev@vger.kernel.org, fruggeri
On Sun, Nov 23, 2014 at 11:24 AM, David Miller <davem@davemloft.net> wrote:
>
> How does this relate to the already committed:
>
> commit 49dd18ba4615eaa72f15c9087dea1c2ab4744cf5
> Author: Panu Matilainen <pmatilai@redhat.com>
> Date: Fri Nov 14 13:14:32 2014 +0200
>
> ipv4: Fix incorrect error code when adding an unreachable route
>
Oh wow! This was committed only a week or so ago. My tree wasn't
updated. Sorry. Yes, this is the same problem I was referring to and
this patch should fix it.
Ani
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-11-24 18:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-22 6:25 [PATCH 1/1] fix return code from fib_rules_lookup() Ani Sinha
2014-11-23 19:24 ` David Miller
2014-11-24 18:34 ` Ani Sinha
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).