提交 cd0f0b95 编写于 作者: D Duan Jiong 提交者: David S. Miller

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: NDuan Jiong <duanj.fnst@cn.fujitsu.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 891de74d
...@@ -1695,8 +1695,11 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, ...@@ -1695,8 +1695,11 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
fl4.daddr = daddr; fl4.daddr = daddr;
fl4.saddr = saddr; fl4.saddr = saddr;
err = fib_lookup(net, &fl4, &res); err = fib_lookup(net, &fl4, &res);
if (err != 0) if (err != 0) {
if (!IN_DEV_FORWARD(in_dev))
err = -EHOSTUNREACH;
goto no_route; goto no_route;
}
RT_CACHE_STAT_INC(in_slow_tot); 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, ...@@ -1712,8 +1715,10 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
goto local_input; goto local_input;
} }
if (!IN_DEV_FORWARD(in_dev)) if (!IN_DEV_FORWARD(in_dev)) {
err = -EHOSTUNREACH;
goto no_route; goto no_route;
}
if (res.type != RTN_UNICAST) if (res.type != RTN_UNICAST)
goto martian_destination; goto martian_destination;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册