aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDietmar Eggemann <dietmar.eggemann@gmx.de>2005-06-28 16:06:23 -0400
committerDavid S. Miller <davem@davemloft.net>2005-06-28 16:06:23 -0400
commit2c2910a401f1ce2ac9136171e7522e731e1a2a8c (patch)
treef7d9bc402481b402539f598cfa20646ec7561efe
parentae9cda5d65f3d8a495241cbdcc2d56f721c83cc3 (diff)
[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>
-rw-r--r--net/ipv4/ip_input.c6
-rw-r--r--net/ipv4/route.c9
2 files changed, 12 insertions, 3 deletions
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index af2ec88bbb2..c703528e0bc 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -283,14 +283,18 @@ static inline int ip_rcv_finish(struct sk_buff *skb)
283{ 283{
284 struct net_device *dev = skb->dev; 284 struct net_device *dev = skb->dev;
285 struct iphdr *iph = skb->nh.iph; 285 struct iphdr *iph = skb->nh.iph;
286 int err;
286 287
287 /* 288 /*
288 * Initialise the virtual path cache for the packet. It describes 289 * Initialise the virtual path cache for the packet. It describes
289 * how the packet travels inside Linux networking. 290 * how the packet travels inside Linux networking.
290 */ 291 */
291 if (skb->dst == NULL) { 292 if (skb->dst == NULL) {
292 if (ip_route_input(skb, iph->daddr, iph->saddr, iph->tos, dev)) 293 if ((err = ip_route_input(skb, iph->daddr, iph->saddr, iph->tos, dev))) {
294 if (err == -EHOSTUNREACH)
295 IP_INC_STATS_BH(IPSTATS_MIB_INADDRERRORS);
293 goto drop; 296 goto drop;
297 }
294 } 298 }
295 299
296#ifdef CONFIG_NET_CLS_ROUTE 300#ifdef CONFIG_NET_CLS_ROUTE
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 80cf633d9f4..12a1cf306f6 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1909,7 +1909,7 @@ static int ip_route_input_slow(struct sk_buff *skb, u32 daddr, u32 saddr,
1909 */ 1909 */
1910 if ((err = fib_lookup(&fl, &res)) != 0) { 1910 if ((err = fib_lookup(&fl, &res)) != 0) {
1911 if (!IN_DEV_FORWARD(in_dev)) 1911 if (!IN_DEV_FORWARD(in_dev))
1912 goto e_inval; 1912 goto e_hostunreach;
1913 goto no_route; 1913 goto no_route;
1914 } 1914 }
1915 free_res = 1; 1915 free_res = 1;
@@ -1933,7 +1933,7 @@ static int ip_route_input_slow(struct sk_buff *skb, u32 daddr, u32 saddr,
1933 } 1933 }
1934 1934
1935 if (!IN_DEV_FORWARD(in_dev)) 1935 if (!IN_DEV_FORWARD(in_dev))
1936 goto e_inval; 1936 goto e_hostunreach;
1937 if (res.type != RTN_UNICAST) 1937 if (res.type != RTN_UNICAST)
1938 goto martian_destination; 1938 goto martian_destination;
1939 1939
@@ -2025,6 +2025,11 @@ martian_destination:
2025 "%u.%u.%u.%u, dev %s\n", 2025 "%u.%u.%u.%u, dev %s\n",
2026 NIPQUAD(daddr), NIPQUAD(saddr), dev->name); 2026 NIPQUAD(daddr), NIPQUAD(saddr), dev->name);
2027#endif 2027#endif
2028
2029e_hostunreach:
2030 err = -EHOSTUNREACH;
2031 goto done;
2032
2028e_inval: 2033e_inval:
2029 err = -EINVAL; 2034 err = -EINVAL;
2030 goto done; 2035 goto done;