summaryrefslogtreecommitdiff
path: root/sbin/ping
diff options
context:
space:
mode:
authorRyan Thomas McBride <mcbride@cvs.openbsd.org>2005-05-27 04:55:29 +0000
committerRyan Thomas McBride <mcbride@cvs.openbsd.org>2005-05-27 04:55:29 +0000
commit4470f6d571b57a867ad4f7875ea2cd7f46612f98 (patch)
tree8400c69016747dd92adad4694f3ecc9963d6d1f1 /sbin/ping
parente0dcbdc8ae74cec294cbf562a7cb834495055882 (diff)
Experimental support for opportunitic use of jumbograms where only some hosts
on the local network support them. This adds a new socket option, SO_JUMBO, and a new route flag, RTF_JUMBO. If _both_ the socket option is set and the route for the host has RTF_JUMBO set, ip_output will fragment the packet to the largest possible size for the link, ignoring the card's MTU. The semantics of this feature will be evolving rapidly; talk to us if you intend to use it. ok deraadt@ marius@
Diffstat (limited to 'sbin/ping')
-rw-r--r--sbin/ping/ping.c40
1 files changed, 24 insertions, 16 deletions
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c
index 75db06c5a37..9902f6902cd 100644
--- a/sbin/ping/ping.c
+++ b/sbin/ping/ping.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ping.c,v 1.70 2005/01/19 13:40:47 mpf Exp $ */
+/* $OpenBSD: ping.c,v 1.71 2005/05/27 04:55:27 mcbride Exp $ */
/* $NetBSD: ping.c,v 1.20 1995/08/11 22:37:58 cgd Exp $ */
/*
@@ -43,7 +43,7 @@ static const char copyright[] =
#if 0
static char sccsid[] = "@(#)ping.c 8.1 (Berkeley) 6/5/93";
#else
-static const char rcsid[] = "$OpenBSD: ping.c,v 1.70 2005/01/19 13:40:47 mpf Exp $";
+static const char rcsid[] = "$OpenBSD: ping.c,v 1.71 2005/05/27 04:55:27 mcbride Exp $";
#endif
#endif /* not lint */
@@ -107,18 +107,19 @@ struct tvi {
/* various options */
int options;
-#define F_FLOOD 0x001
-#define F_INTERVAL 0x002
-#define F_NUMERIC 0x004
-#define F_PINGFILLED 0x008
-#define F_QUIET 0x010
-#define F_RROUTE 0x020
-#define F_SO_DEBUG 0x040
-#define F_SO_DONTROUTE 0x080
-#define F_VERBOSE 0x100
-#define F_SADDR 0x200
-#define F_HDRINCL 0x400
-#define F_TTL 0x800
+#define F_FLOOD 0x0001
+#define F_INTERVAL 0x0002
+#define F_NUMERIC 0x0004
+#define F_PINGFILLED 0x0008
+#define F_QUIET 0x0010
+#define F_RROUTE 0x0020
+#define F_SO_DEBUG 0x0040
+#define F_SO_DONTROUTE 0x0080
+#define F_VERBOSE 0x0100
+#define F_SADDR 0x0200
+#define F_HDRINCL 0x0400
+#define F_TTL 0x0800
+#define F_SO_JUMBO 0x1000
/* multicast options */
int moptions;
@@ -210,7 +211,8 @@ main(int argc, char *argv[])
preload = 0;
datap = &outpack[8 + sizeof(struct tvi)];
- while ((ch = getopt(argc, argv, "DI:LRS:c:dfi:l:np:qrs:T:t:vw:")) != -1)
+ while ((ch = getopt(argc, argv,
+ "DI:LRS:c:dfi:jl:np:qrs:T:t:vw:")) != -1)
switch(ch) {
case 'c':
npackets = strtonum(optarg, 1, INT_MAX, &errstr);
@@ -258,6 +260,9 @@ main(int argc, char *argv[])
options |= F_INTERVAL;
break;
+ case 'j':
+ options |= F_SO_JUMBO;
+ break;
case 'L':
moptions |= MULTICAST_NOLOOP;
loop = 0;
@@ -380,6 +385,9 @@ main(int argc, char *argv[])
if (options & F_SO_DONTROUTE)
(void)setsockopt(s, SOL_SOCKET, SO_DONTROUTE, (char *)&hold,
sizeof(hold));
+ if (options & F_SO_JUMBO)
+ (void)setsockopt(s, SOL_SOCKET, SO_JUMBO, (char *)&hold,
+ sizeof(hold));
if (options & F_TTL) {
if (IN_MULTICAST(ntohl(to->sin_addr.s_addr)))
@@ -1336,7 +1344,7 @@ void
usage(void)
{
(void)fprintf(stderr,
- "usage: ping [-DdfLnqRrv] [-c count] [-I ifaddr] [-i wait]\n"
+ "usage: ping [-DdfjLnqRrv] [-c count] [-I ifaddr] [-i wait]\n"
"\t[-l preload] [-p pattern] [-s packetsize] [-T tos] [-t ttl]\n"
"\t[-w maxwait] host\n");
exit(1);