summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Synacek <jsynacek@redhat.com>2014-04-25 13:56:32 +0200
committerJan Synacek <jsynacek@redhat.com>2014-04-25 14:06:10 +0200
commita60ad56a18b660ea8158e6ce8d782fb0290329f8 (patch)
tree1efc2c8bff98c6fd1f3e347aa72ed5d7e513f2aa
parentc34b0a8d6458230dc78e8e7da1fc9396983ec5c3 (diff)
downloadiputils-a60ad56a18b660ea8158e6ce8d782fb0290329f8.tar.gz
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 <hvtaifwkbgefbaei@gmail.com> RH-Bugzilla: #1061867 Signed-off-by: Jan Synacek <jsynacek@redhat.com>
-rw-r--r--ping_common.c8
1 files 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;