diff mbox

iputils/ping_common.c: avoid gethostbyaddr during ping flood

Message ID Pine.LNX.4.64.1006170104000.26819@nacho.alt.net
State Not Applicable, archived
Delegated to: David Miller
Headers show

Commit Message

Chris Caputo June 17, 2010, 1:08 a.m. UTC
On Wed, 6 Feb 2008, Chris Caputo wrote:
> Unless a destination is specified by IP address, a ping flood results in a 
> gethostbyaddr() for every echo reply.  Thus a DNS flood can accompany a 
> ping flood.

Updated for iputils-s20100418...  Can someone review and work into next 
release?

Thanks,
Chris

---
Unless a destination is specified by IP address, a ping flood results in a
gethostbyaddr() for every echo reply.  Thus a DNS flood can accompany a
ping flood.

This patch makes it so a gethostbyaddr() is not performed with each echo
reply during a ping flood.

Signed-off-by: Chris Caputo <ccaputo@alt.net>
-------
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

YOSHIFUJI Hideaki / 吉藤英明 June 17, 2010, 2:08 a.m. UTC | #1
Chris Caputo wrote:
> On Wed, 6 Feb 2008, Chris Caputo wrote:
>> Unless a destination is specified by IP address, a ping flood results in a 
>> gethostbyaddr() for every echo reply.  Thus a DNS flood can accompany a 
>> ping flood.
> 
> Updated for iputils-s20100418...  Can someone review and work into next 
> release?

Applied, thanks.

--yoshfuji

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

--- iputils-s20100418/ping_common.c	2010-04-18 04:45:45.000000000 +0000
+++ iputils-dev/ping_common.c	2010-06-17 01:00:59.000000000 +0000
@@ -118,10 +118,6 @@  void common_options(int ch)
 	case 'D':
 		options |= F_PTIMEOFDAY;
 		break;
-	case 'f':
-		options |= F_FLOOD;
-		setbuf(stdout, (char *)NULL);
-		break;
 	case 'i':		/* wait between sending packets */
 	{
 		if (strchr(optarg, '.')) {
@@ -183,6 +179,10 @@  void common_options(int ch)
 			exit(2);
 		}
 		break;
+	case 'f':
+		options |= F_FLOOD;
+		setbuf(stdout, (char *)NULL);
+		/* fallthrough to numeric - avoid gethostbyaddr during flood */
 	case 'n':
 		options |= F_NUMERIC;
 		break;