diff options
author | Duan Jiong <duanj.fnst@cn.fujitsu.com> | 2014-02-14 18:26:22 +0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-02-16 23:45:31 -0500 |
commit | cd0f0b95fd2cd2b716caf5f15db73ab76992789b (patch) | |
tree | 1f9194b60c4f24a4897103c3ffec6c99d320d9be /net/ipv4 | |
parent | 891de74d693bb4fefe2efcc6432a4a9a9bee561e (diff) | |
download | blackbird-op-linux-cd0f0b95fd2cd2b716caf5f15db73ab76992789b.tar.gz blackbird-op-linux-cd0f0b95fd2cd2b716caf5f15db73ab76992789b.zip |
ipv4: distinguish EHOSTUNREACH from the ENETUNREACH
since commit 251da413("ipv4: Cache ip_error() routes even when not forwarding."),
the counter IPSTATS_MIB_INADDRERRORS can't work correctly, because the value of
err was always set to ENETUNREACH.
Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/route.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 25071b48921c..6f6dd85bdffc 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -1695,8 +1695,11 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, fl4.daddr = daddr; fl4.saddr = saddr; err = fib_lookup(net, &fl4, &res); - if (err != 0) + if (err != 0) { + if (!IN_DEV_FORWARD(in_dev)) + err = -EHOSTUNREACH; goto no_route; + } RT_CACHE_STAT_INC(in_slow_tot); @@ -1712,8 +1715,10 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, goto local_input; } - if (!IN_DEV_FORWARD(in_dev)) + if (!IN_DEV_FORWARD(in_dev)) { + err = -EHOSTUNREACH; goto no_route; + } if (res.type != RTN_UNICAST) goto martian_destination; |