summaryrefslogtreecommitdiff
path: root/sbin/ping6
diff options
context:
space:
mode:
authorPeter Hessler <phessler@cvs.openbsd.org>2010-06-26 18:30:04 +0000
committerPeter Hessler <phessler@cvs.openbsd.org>2010-06-26 18:30:04 +0000
commitb7bb87be35f33a31cb03eaef1f259f52b9c85636 (patch)
treedfff98203979da8e31106b272c5e1bc57be0452b /sbin/ping6
parent10b352c821da24ff907aa04a6bdfb68e39179fad (diff)
allow a user to set a -c count of 0.
while here, change ping6 to use strtonum instead of strtol. OK claudio@
Diffstat (limited to 'sbin/ping6')
-rw-r--r--sbin/ping6/ping6.87
-rw-r--r--sbin/ping6/ping6.c11
2 files changed, 12 insertions, 6 deletions
diff --git a/sbin/ping6/ping6.8 b/sbin/ping6/ping6.8
index cc1a5dd629b..be5c228fbf1 100644
--- a/sbin/ping6/ping6.8
+++ b/sbin/ping6/ping6.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ping6.8,v 1.41 2009/06/01 14:16:02 jmc Exp $
+.\" $OpenBSD: ping6.8,v 1.42 2010/06/26 18:30:03 phessler Exp $
.\" $KAME: ping6.8,v 1.57 2002/05/26 13:18:25 itojun Exp $
.\"
.\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -28,7 +28,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd $Mdocdate: June 1 2009 $
+.Dd $Mdocdate: June 26 2010 $
.Dt PING6 8
.Os
.Sh NAME
@@ -102,6 +102,9 @@ Stop after sending
.Ar count
.Dv ECHO_RESPONSE
packets.
+If
+.Ar count
+is 0, send an unlimited number of packets.
.It Fl d
Set the
.Dv SO_DEBUG
diff --git a/sbin/ping6/ping6.c b/sbin/ping6/ping6.c
index bede8d8a51a..92827d27f72 100644
--- a/sbin/ping6/ping6.c
+++ b/sbin/ping6/ping6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ping6.c,v 1.79 2010/05/10 02:00:50 krw Exp $ */
+/* $OpenBSD: ping6.c,v 1.80 2010/06/26 18:30:03 phessler Exp $ */
/* $KAME: ping6.c,v 1.163 2002/10/25 02:19:06 itojun Exp $ */
/*
@@ -257,6 +257,7 @@ main(int argc, char *argv[])
int ch, hold, packlen, preload, optval, ret_ga;
u_char *datap, *packet;
char *e, *target, *ifname = NULL, *gateway = NULL;
+ const char *errstr;
int ip6optlen = 0;
struct cmsghdr *scmsgp = NULL;
#if defined(SO_SNDBUF) && defined(SO_RCVBUF)
@@ -338,10 +339,12 @@ main(int argc, char *argv[])
#endif
break;
case 'c':
- npackets = strtol(optarg, &e, 10);
- if (npackets <= 0 || *optarg == '\0' || *e != '\0')
+ npackets = (unsigned long)strtonum(optarg, 0,
+ INT_MAX, &errstr);
+ if (errstr)
errx(1,
- "illegal number of packets -- %s", optarg);
+ "number of packets to transmit is %s: %s",
+ errstr, optarg);
break;
case 'd':
options |= F_SO_DEBUG;