994c6b
commit 1c97ab2b9bf401d8c4db9f4f4a4e13e1002c2d64
994c6b
Author: Robert Schiele <rschiele@gmail.com>
994c6b
Date:   Mon Mar 14 08:59:56 2016 +0100
994c6b
994c6b
    Revert "ping_common.c: fix message flood when EPERM is encountered in ping"
994c6b
    
994c6b
    This reverts commit a60ad56a18b660ea8158e6ce8d782fb0290329f8.
994c6b
    
994c6b
    The reason for this revert is that while the patch above fixed
994c6b
    https://bugzilla.redhat.com/show_bug.cgi?id=1061867 it had weird behavior
994c6b
    with other types of EPERM responses where it could end up in an endless
994c6b
    loop despite the fact that -c flag was specified.  In addition to that the
994c6b
    mentioned bug is also fixed with
994c6b
    commit 8b75f100bbc84aa32a2c35b54c53f48071af6e95
994c6b
    "ping: ICMP error replies while errno < 0 is a hard error"
994c6b
    by Jason A. Donenfeld <Jason@zx2c4.com>
994c6b
    such that this one should no longer be needed anyway.
994c6b
    
994c6b
    Signed-off-by: Robert Schiele <rschiele@gmail.com>
994c6b
994c6b
diff --git a/ping_common.c b/ping_common.c
994c6b
index fe7d6e3..7ea1fb3 100644
994c6b
--- a/ping_common.c
994c6b
+++ b/ping_common.c
994c6b
@@ -373,11 +373,10 @@ resend:
994c6b
 	if (i > 0) {
994c6b
 		/* Apparently, it is some fatal bug. */
994c6b
 		abort();
994c6b
-	} else if (errno == ENOBUFS || errno == ENOMEM || errno == EPERM) {
994c6b
+	} else if (errno == ENOBUFS || errno == ENOMEM) {
994c6b
 		int nores_interval;
994c6b
 
994c6b
-		/* Device queue overflow, OOM or operation not permitted.
994c6b
-		 * Packet is not sent. */
994c6b
+		/* Device queue overflow or OOM. Packet is not sent. */
994c6b
 		tokens = 0;
994c6b
 		/* Slowdown. This works only in adaptive mode (option -A) */
994c6b
 		rtt_addend += (rtt < 8*50000 ? rtt/8 : 50000);
994c6b
@@ -386,8 +385,7 @@ resend:
994c6b
 		nores_interval = SCHINT(interval/2);
994c6b
 		if (nores_interval > 500)
994c6b
 			nores_interval = 500;
994c6b
-		if (errno != EPERM)
994c6b
-			oom_count++;
994c6b
+		oom_count++;
994c6b
 		if (oom_count*nores_interval < lingertime)
994c6b
 			return nores_interval;
994c6b
 		i = 0;