netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* MIB "ipInHdrErrors" error
@ 2006-05-25  8:37 Wei Dong
  2006-06-05 23:38 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Wei Dong @ 2006-05-25  8:37 UTC (permalink / raw)
  To: netdev

Hi All:
    When I test linux kernel 2.6.9-34, and find that kernel statistics
about ipInHdrErrors which exsits in file /proc/net/snmp doesn't increase
correctly.  The criteria conform to RFC2011:

ipInHdrErrors OBJECT-TYPE
    SYNTAX      Counter32
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION
            "The number of input datagrams discarded due to errors in
            their IP headers, including bad checksums, version number
            mismatch, other format errors, time-to-live exceeded, errors
            discovered in processing their IP options, etc."

When kernel receives an IP packet containing error protocol in IP
header, kernel doesn't increase this counter "ipInHdrErrors". Also, when
kernel receives an IP packet and need to forward, but  TTL=1 or TTL=0,
kernel just sends an ICMP packet to inform the sender TTL count
exceeded, and doesn't increase this counter.

The patch for this problem is shown as the following:

diff -ruN old/net/ipv4/ip_forward.c new/net/ipv4/ip_forward.c
--- old/net/ipv4/ip_forward.c   2006-05-10 10:43:30.000000000 +0800
+++ new/net/ipv4/ip_forward.c   2006-05-12 15:06:57.000000000 +0800
@@ -120,6 +120,7 @@
 
 too_many_hops:
         /* Tell the sender its packet died... */
+        IP_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS);
         icmp_send(skb, ICMP_TIME_EXCEEDED, ICMP_EXC_TTL, 0);
 drop:
        kfree_skb(skb);
diff -ruN old/net/ipv4/ip_input.c new/net/ipv4/ip_input.c
--- old/net/ipv4/ip_input.c     2006-05-10 10:43:31.000000000 +0800
+++ new/net/ipv4/ip_input.c     2006-05-12 15:07:27.000000000 +0800
@@ -249,6 +249,7 @@
                        if (!raw_sk) {
                                if (xfrm4_policy_check(NULL,
XFRM_POLICY_IN, skb)) {
                                        IP_INC_STATS_BH(IPSTATS_MIB_INUNKNOWNPROTOS);
+                                       IP_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS);
                                        icmp_send(skb,
ICMP_DEST_UNREACH,
                                                  ICMP_PROT_UNREACH, 0);
                                }

Signed-off-by: Wei Dong <weid@nanjing-fnst.com>

Regards
Wei Dong 



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: MIB "ipInHdrErrors" error
  2006-05-25  8:37 Wei Dong
@ 2006-06-05 23:38 ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2006-06-05 23:38 UTC (permalink / raw)
  To: weid; +Cc: netdev

From: Wei Dong <weid@nanjing-fnst.com>
Date: Thu, 25 May 2006 16:37:42 +0800

>     When I test linux kernel 2.6.9-34, and find that kernel statistics
> about ipInHdrErrors which exsits in file /proc/net/snmp doesn't increase
> correctly.  The criteria conform to RFC2011:
> 
> ipInHdrErrors OBJECT-TYPE
>     SYNTAX      Counter32
>     MAX-ACCESS  read-only
>     STATUS      current
>     DESCRIPTION
>             "The number of input datagrams discarded due to errors in
>             their IP headers, including bad checksums, version number
>             mismatch, other format errors, time-to-live exceeded, errors
>             discovered in processing their IP options, etc."
> 
> When kernel receives an IP packet containing error protocol in IP
> header, kernel doesn't increase this counter "ipInHdrErrors".

This event is not listed in the description you quoted.

> Also, when kernel receives an IP packet and need to forward, but
> TTL=1 or TTL=0, kernel just sends an ICMP packet to inform the
> sender TTL count exceeded, and doesn't increase this counter.

This part of your change seems correct, please just resubmit
this part.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: MIB "ipInHdrErrors" error
@ 2006-06-12  8:49 Wei Dong
  2006-06-12 20:10 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Wei Dong @ 2006-06-12  8:49 UTC (permalink / raw)
  To: netdev; +Cc: davem

On Mon, 2006-06-12 at 15:24 +0800, Wei Dong wrote:
> > Also, when kernel receives an IP packet and need to forward, but
> > TTL=1 or TTL=0, kernel just sends an ICMP packet to inform the
> > sender TTL count exceeded, and doesn't increase this counter.
> 
> This part of your change seems correct, please just resubmit
> this part.
The following is the latest patch for MIB ipIHdrErrors. 

diff -ruN old/net/ipv4/ip_forward.c new/net/ipv4/ip_forward.c
--- old/net/ipv4/ip_forward.c	2006-06-06 13:56:48.000000000 +0800
+++ new/net/ipv4/ip_forward.c	2006-06-12 15:11:04.000000000 +0800
@@ -120,6 +120,7 @@
 
 too_many_hops:
         /* Tell the sender its packet died... */
+        IP_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS);
         icmp_send(skb, ICMP_TIME_EXCEEDED, ICMP_EXC_TTL, 0);
 drop:
 	kfree_skb(skb);

Signed-off-by: Weidong <weid@nanjing-fnst.com>




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: MIB "ipInHdrErrors" error
  2006-06-12  8:49 MIB "ipInHdrErrors" error Wei Dong
@ 2006-06-12 20:10 ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2006-06-12 20:10 UTC (permalink / raw)
  To: weid; +Cc: netdev

From: Wei Dong <weid@nanjing-fnst.com>
Date: Mon, 12 Jun 2006 16:49:23 +0800

> On Mon, 2006-06-12 at 15:24 +0800, Wei Dong wrote:
> > > Also, when kernel receives an IP packet and need to forward, but
> > > TTL=1 or TTL=0, kernel just sends an ICMP packet to inform the
> > > sender TTL count exceeded, and doesn't increase this counter.
> > 
> > This part of your change seems correct, please just resubmit
> > this part.
> The following is the latest patch for MIB ipIHdrErrors. 

Patch applied, thanks a lot.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-06-12 20:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-12  8:49 MIB "ipInHdrErrors" error Wei Dong
2006-06-12 20:10 ` David Miller
  -- strict thread matches above, loose matches on Subject: below --
2006-05-25  8:37 Wei Dong
2006-06-05 23:38 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).