[PATCH 1/1] icmp: account for ICMP out errors because of socket limit

From: Zhu Yanjun
Date: Sun May 11 2014 - 23:07:20 EST


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@xxxxxxxxxxxxx>
---
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


--------------020500030407000703090906--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/