diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-12-10 08:37:07 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-12-10 08:37:07 +0000 |
commit | 2f7a7ba17bb99870e3bac5e6c2fa656017224ee3 (patch) | |
tree | dba39b2944066feeffceace11886b7d5755fa55d /sbin/ping/ping.c | |
parent | 6a6c37ce5f9d7a4a7ed531e4f40457b65da4809e (diff) |
crank SO_SNDBUF if needed, kml@nas.nasa.gov
Diffstat (limited to 'sbin/ping/ping.c')
-rw-r--r-- | sbin/ping/ping.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c index ea4f4850731..4763c237bd6 100644 --- a/sbin/ping/ping.c +++ b/sbin/ping/ping.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ping.c,v 1.8 1996/07/23 10:36:41 deraadt Exp $ */ +/* $OpenBSD: ping.c,v 1.9 1996/12/10 08:37:06 deraadt 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.8 1996/07/23 10:36:41 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: ping.c,v 1.9 1996/12/10 08:37:06 deraadt Exp $"; #endif #endif /* not lint */ @@ -183,6 +183,7 @@ main(argc, argv) struct in_addr saddr; register int i; int ch, fdmask, hold = 1, packlen, preload; + int maxsize, maxsizelen; u_char *datap, *packet; char *target, hnamebuf[MAXHOSTNAMELEN]; u_char ttl = MAXTTL, loop = 1, df = 0; @@ -412,6 +413,17 @@ main(argc, argv) sizeof(saddr)) < 0) err(1, "setsockopt IP_MULTICAST_IF"); + /* + * When trying to send large packets, you must increase the + * size of both the send and receive buffers... + */ + maxsizelen = sizeof maxsize; + if (getsockopt(s, SOL_SOCKET, SO_SNDBUF, &maxsize, &maxsizelen) < 0) + err(1, "getsockopt"); + if (maxsize < packlen && + setsockopt(s, SOL_SOCKET, SO_SNDBUF, &packlen, sizeof(maxsize)) < 0) + err(1, "setsockopt"); + /* * When pinging the broadcast address, you can get a lot of answers. * Doing something so evil is useful if you are trying to stress the |