netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* icmp: account for ICMP out errors because of socket limit
@ 2014-05-12  3:19 zhuyj
  2014-05-12  4:48 ` zhuyj
  2014-05-14 18:07 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: zhuyj @ 2014-05-12  3:19 UTC (permalink / raw)
  To: eric.dumazet, David S. Miller; +Cc: Tao, Yue, zhuyj, linux-kernel, netdev

[-- Attachment #1: Type: text/plain, Size: 456 bytes --]

Hi, Eric && David

  ____           ______________
|    |         |              |
| PC |<------->| MIPS 32 core |
|____|         |______________|

When ping from a PC to a board (MIPS 32 core), because of socket limit,
ping echo will fail. But ICMP_MIB_OUTERRORS counter is not incremented.
In this case, "netstat -s" can not report these errors.

This patch will fix this problem. Now it is in the attachment. Please 
check it.

Best Regards!
Zhu Yanjun

[-- Attachment #2: 0001-icmp-account-for-ICMP-out-errors-because-of-socket-l.patch --]
[-- Type: text/x-patch, Size: 1025 bytes --]

>From af800d0f123cf9c66a9ae167baa7dc1d25d0cd1f Mon Sep 17 00:00:00 2001
From: Zhu Yanjun <Yanjun.Zhu@windriver.com>
Date: Mon, 12 May 2014 11:07:20 +0800
Subject: [PATCH 1/1] icmp: account for ICMP out errors because of socket
 limit

When icmp_xmit_lock fails because of socket limit or memory shortage,
increment ICMP_MIB_OUTERRORS counter, so that "netstat -s" can report
these errors.

netstat -s | grep "ICMP messages failed"
    0 ICMP messages failed

Signed-off-by: Zhu Yanjun <Yanjun.Zhu@windriver.com>
---
 net/ipv4/icmp.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 0134663..9a0bd7c 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -342,8 +342,10 @@ static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb)
 		return;
 
 	sk = icmp_xmit_lock(net);
-	if (sk == NULL)
+	if (sk == NULL){
+		ICMP_INC_STATS_BH(net, ICMP_MIB_OUTERRORS);
 		return;
+	}
 	inet = inet_sk(sk);
 
 	icmp_param->data.icmph.checksum = 0;
-- 
1.7.9.5


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

* Re: icmp: account for ICMP out errors because of socket limit
  2014-05-12  3:19 icmp: account for ICMP out errors because of socket limit zhuyj
@ 2014-05-12  4:48 ` zhuyj
  2014-05-14 18:07 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: zhuyj @ 2014-05-12  4:48 UTC (permalink / raw)
  To: eric.dumazet, David S. Miller; +Cc: Tao, Yue, linux-kernel, netdev, zhuyj

Hi, Eric && David

This patch is similar to the following patch.

commit 1f8438a853667d48055ad38384c63e94b32c6578
Author: Eric Dumazet <eric.dumazet@gmail.com>
Date:   Sat Apr 3 15:09:04 2010 -0700

     icmp: Account for ICMP out errors

     When ip_append() fails because of socket limit or memory shortage,
     increment ICMP_MIB_OUTERRORS counter, so that "netstat -s" can report
     these errors.

     LANG=C netstat -s | grep "ICMP messages failed"
         0 ICMP messages failed

     For IPV6, implement ICMP6_MIB_OUTERRORS counter as well.

     # grep Icmp6OutErrors /proc/net/dev_snmp6/*
     /proc/net/dev_snmp6/eth0:Icmp6OutErrors                     0
     /proc/net/dev_snmp6/lo:Icmp6OutErrors                       0

     Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
     Signed-off-by: David S. Miller <davem@davemloft.net>

Best Regards!
Zhu Yanjun

On 05/12/2014 11:19 AM, zhuyj wrote:
> Hi, Eric && David
>
>  ____           ______________
> |    |         |              |
> | PC |<------->| MIPS 32 core |
> |____|         |______________|
>
> When ping from a PC to a board (MIPS 32 core), because of socket limit,
> ping echo will fail. But ICMP_MIB_OUTERRORS counter is not incremented.
> In this case, "netstat -s" can not report these errors.
>
> This patch will fix this problem. Now it is in the attachment. Please 
> check it.
>
> Best Regards!
> Zhu Yanjun

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

* Re: icmp: account for ICMP out errors because of socket limit
  2014-05-12  3:19 icmp: account for ICMP out errors because of socket limit zhuyj
  2014-05-12  4:48 ` zhuyj
@ 2014-05-14 18:07 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2014-05-14 18:07 UTC (permalink / raw)
  To: zyjzyj2000; +Cc: eric.dumazet, Yue.Tao, linux-kernel, netdev

From: zhuyj <zyjzyj2000@gmail.com>
Date: Mon, 12 May 2014 11:19:28 +0800

> Hi, Eric && David
> 
>  ____           ______________
> |    |         |              |
> | PC |<------->| MIPS 32 core |
> |____|         |______________|
> 
> When ping from a PC to a board (MIPS 32 core), because of socket
> limit,
> ping echo will fail. But ICMP_MIB_OUTERRORS counter is not
> incremented.
> In this case, "netstat -s" can not report these errors.
> 
> This patch will fix this problem. Now it is in the attachment. Please
> check it.

The only time icmp_xmit_lock() can fail is if we try to generate an ICMP
response to a failure to send another ICMP packet.

It is an entirely different situation from Eric's other patch which
you've mentioned in this thread, and I do not think this case warrants
a statistic bump at all.

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

end of thread, other threads:[~2014-05-14 18:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-12  3:19 icmp: account for ICMP out errors because of socket limit zhuyj
2014-05-12  4:48 ` zhuyj
2014-05-14 18:07 ` 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).