summaryrefslogtreecommitdiff
path: root/sbin/ping/ping.c
diff options
context:
space:
mode:
authorHugh Graham <hugh@cvs.openbsd.org>2002-01-28 08:08:21 +0000
committerHugh Graham <hugh@cvs.openbsd.org>2002-01-28 08:08:21 +0000
commit4700bb52c2c0503fdff9aec4c12a052f26f83b02 (patch)
tree0a84b06a3914dca2b8874ce40ab8dc8642ed14d3 /sbin/ping/ping.c
parent3df05a24cccd1f741892d490deb40e0084f5bc1f (diff)
Request enough buffer space to fit the maximum size of a packet.
Problem noticed by Art, and fix checked by Markus and Niels.
Diffstat (limited to 'sbin/ping/ping.c')
-rw-r--r--sbin/ping/ping.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c
index f6cb8d7a128..98e627e25e7 100644
--- a/sbin/ping/ping.c
+++ b/sbin/ping/ping.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ping.c,v 1.47 2001/11/05 07:39:17 mpech Exp $ */
+/* $OpenBSD: ping.c,v 1.48 2002/01/28 08:08:20 hugh Exp $ */
/* $NetBSD: ping.c,v 1.20 1995/08/11 22:37:58 cgd Exp $ */
/*
@@ -47,7 +47,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)ping.c 8.1 (Berkeley) 6/5/93";
#else
-static char rcsid[] = "$OpenBSD: ping.c,v 1.47 2001/11/05 07:39:17 mpech Exp $";
+static char rcsid[] = "$OpenBSD: ping.c,v 1.48 2002/01/28 08:08:20 hugh Exp $";
#endif
#endif /* not lint */
@@ -170,8 +170,7 @@ quad_t tsumsq = 0; /* sum of all times squared, for std. dev. */
int reset_kerninfo;
#endif
-#define DEFAULT_BUFSPACE 60*1024 /* default read buffer size */
-int bufspace = DEFAULT_BUFSPACE;
+int bufspace = IP_MAXPACKET;
void fill __P((char *, char *));
void catcher(), prtsig(), finish(), summary(int);
@@ -467,9 +466,9 @@ main(argc, argv)
if ((bufspace -= 1024) <= 0)
err(1, "Cannot set the receive buffer size");
}
- if (bufspace < DEFAULT_BUFSPACE)
+ if (bufspace < IP_MAXPACKET)
warnx("Could only allocate a receive buffer of %i bytes (default %i)",
- bufspace, DEFAULT_BUFSPACE);
+ bufspace, IP_MAXPACKET);
if (to->sin_family == AF_INET)
(void)printf("PING %s (%s): %d data bytes\n", hostname,