[IPV4]: Snmpv2 Mib IP counter ipInAddrErrors support

I followed Thomas' proposal to see every martian destination as a case
where the ipInAddrErrors counter has to be incremented. There are
two advantages by doing so: (1) The relation between the ipInReceive
counter and all the other ipInXXX counters is more accurate in the
case the RTN_UNICAST code check fails and (2) it makes the code in
ip_route_input_slow easier.

Signed-off-by: Dietmar Eggemann <dietmar.eggemann@gmx.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Dietmar Eggemann
2005-06-28 13:06:23 -07:00
committed by David S. Miller
parent ae9cda5d65
commit 2c2910a401
2 changed files with 12 additions and 3 deletions

View File

@ -1909,7 +1909,7 @@ static int ip_route_input_slow(struct sk_buff *skb, u32 daddr, u32 saddr,
*/
if ((err = fib_lookup(&fl, &res)) != 0) {
if (!IN_DEV_FORWARD(in_dev))
goto e_inval;
goto e_hostunreach;
goto no_route;
}
free_res = 1;
@ -1933,7 +1933,7 @@ static int ip_route_input_slow(struct sk_buff *skb, u32 daddr, u32 saddr,
}
if (!IN_DEV_FORWARD(in_dev))
goto e_inval;
goto e_hostunreach;
if (res.type != RTN_UNICAST)
goto martian_destination;
@ -2025,6 +2025,11 @@ martian_destination:
"%u.%u.%u.%u, dev %s\n",
NIPQUAD(daddr), NIPQUAD(saddr), dev->name);
#endif
e_hostunreach:
err = -EHOSTUNREACH;
goto done;
e_inval:
err = -EINVAL;
goto done;