aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorDuan Jiong <duanj.fnst@cn.fujitsu.com>2014-02-14 05:26:22 -0500
committerDavid S. Miller <davem@davemloft.net>2014-02-16 23:45:31 -0500
commitcd0f0b95fd2cd2b716caf5f15db73ab76992789b (patch)
tree1f9194b60c4f24a4897103c3ffec6c99d320d9be /net
parent891de74d693bb4fefe2efcc6432a4a9a9bee561e (diff)
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')
-rw-r--r--net/ipv4/route.c9
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,
1695 fl4.daddr = daddr; 1695 fl4.daddr = daddr;
1696 fl4.saddr = saddr; 1696 fl4.saddr = saddr;
1697 err = fib_lookup(net, &fl4, &res); 1697 err = fib_lookup(net, &fl4, &res);
1698 if (err != 0) 1698 if (err != 0) {
1699 if (!IN_DEV_FORWARD(in_dev))
1700 err = -EHOSTUNREACH;
1699 goto no_route; 1701 goto no_route;
1702 }
1700 1703
1701 RT_CACHE_STAT_INC(in_slow_tot); 1704 RT_CACHE_STAT_INC(in_slow_tot);
1702 1705
@@ -1712,8 +1715,10 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
1712 goto local_input; 1715 goto local_input;
1713 } 1716 }
1714 1717
1715 if (!IN_DEV_FORWARD(in_dev)) 1718 if (!IN_DEV_FORWARD(in_dev)) {
1719 err = -EHOSTUNREACH;
1716 goto no_route; 1720 goto no_route;
1721 }
1717 if (res.type != RTN_UNICAST) 1722 if (res.type != RTN_UNICAST)
1718 goto martian_destination; 1723 goto martian_destination;
1719 1724