IpInDelivers counter raw vs icmp bug/help?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Hi Folks,

I've been working on fixing some of the kernel level network counters
which are used by SNMP, and need a little advice. This is in the 2.4.2
kernel, but appears to be the same in 2.4.7.

One of bugs is related to IpInDelivers which is not incremented when an
incoming ICMP is delivered to icmp_rcv(). Looked like an easy enough fix
by calling IP_INC_STATS_BH(IpInDelivers) at the top of icmp_rcv().

Testing looked good, IpInDelivers now reflected the correct number of
delivers based on the network traffic sent and the number of IcmpInMsgs.

However, if there is a raw listener registered the counter can now be
incremented twice. For example if dhcpd is running.

If I've followed the code correctly (I'm relatively new to the Linux IP
code), raw_v4_input() is called prior to the protocol specific handler (if
required).

raw_v4_input() calls raw_rcv() which calls raw_rcv_skb() which increments
IpInDelivers.

After all the raw processing the protocol specific handler icmp_rcv() is
called and IpInDiscards is incremented again.

I can think of a few possible solutions:

1. Look at the skb in raw_rcv_skb() and if it looks like an ICMP don't
increment the IpInDelivers. Sort of nasty, looking at different level.

2. Don't increment IpInDelivers at all in the raw code.

3. Let it increment it twice as it was delivered to two different
handlers. Although this then leads to rather odd counters where
IpInDelivers is larger than IpInReceives.

IpInDelivers is defined as:

"The total number of input datagrams successfully delivered to IP
user-protocols (including ICMP)."

Looking at the skb would ensure that the counters are correct for both raw
and icmp delivers, but is ugly

So any advice on what the correct thing to do is, or other suggestions
greatly appreciated.

Anyway help appreciated.

Cheers, Mark.

----------
Mark Price
IBM Beaverton, OR - mnprice@us.ibm.com - mprice@sequent.com


-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux