From a60ad56a18b660ea8158e6ce8d782fb0290329f8 Mon Sep 17 00:00:00 2001 From: Jan Synacek Date: Fri, 25 Apr 2014 13:56:32 +0200 Subject: ping_common.c: fix message flood when EPERM is encountered in ping When icmp packet is sent and EPERM is encountered, next packet should be sent after the built-in interval, not immediately. Reported-by: Sami Farin RH-Bugzilla: #1061867 Signed-off-by: Jan Synacek --- ping_common.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ping_common.c b/ping_common.c index 2869ed1..5566003 100644 --- a/ping_common.c +++ b/ping_common.c @@ -527,10 +527,11 @@ resend: if (i > 0) { /* Apparently, it is some fatal bug. */ abort(); - } else if (errno == ENOBUFS || errno == ENOMEM) { + } else if (errno == ENOBUFS || errno == ENOMEM || errno == EPERM) { int nores_interval; - /* Device queue overflow or OOM. Packet is not sent. */ + /* Device queue overflow, OOM or operation not permitted. + * Packet is not sent. */ tokens = 0; /* Slowdown. This works only in adaptive mode (option -A) */ rtt_addend += (rtt < 8*50000 ? rtt/8 : 50000); @@ -539,7 +540,8 @@ resend: nores_interval = SCHINT(interval/2); if (nores_interval > 500) nores_interval = 500; - oom_count++; + if (errno != EPERM) + oom_count++; if (oom_count*nores_interval < lingertime) return nores_interval; i = 0; -- cgit v1.2.1