summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2000-10-07 21:47:32 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2000-10-07 21:47:32 +0000
commite6f5bd0a8cce3ac7ce3d2a18acec743434e15332 (patch)
tree2831d841c3a635a5f833da00add6355041aee104
parentab1cf2e011530d7d84f2d53b82a52e0907b024ac (diff)
sync with kame, to make future upgrade easier
-rw-r--r--usr.sbin/traceroute6/Makefile4
-rw-r--r--usr.sbin/traceroute6/traceroute6.c25
2 files changed, 25 insertions, 4 deletions
diff --git a/usr.sbin/traceroute6/Makefile b/usr.sbin/traceroute6/Makefile
index 93bd4d8e130..db93af76f17 100644
--- a/usr.sbin/traceroute6/Makefile
+++ b/usr.sbin/traceroute6/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.2 2000/02/16 06:24:48 itojun Exp $
+# $OpenBSD: Makefile,v 1.3 2000/10/07 21:47:31 itojun Exp $
PROG= traceroute6
@@ -6,7 +6,7 @@ BINOWN= root
BINGRP= bin
BINMODE=4555
-CPPFLAGS+=-DINET6
+CPPFLAGS+=-DINET6 -DHAVE_POLL
MAN= traceroute6.8
diff --git a/usr.sbin/traceroute6/traceroute6.c b/usr.sbin/traceroute6/traceroute6.c
index 3d58c72b4e8..d8bd23cba9c 100644
--- a/usr.sbin/traceroute6/traceroute6.c
+++ b/usr.sbin/traceroute6/traceroute6.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: traceroute6.c,v 1.12 2000/10/07 16:05:45 deraadt Exp $ */
-/* $KAME: traceroute6.c,v 1.29 2000/06/12 16:29:18 itojun Exp $ */
+/* $OpenBSD: traceroute6.c,v 1.13 2000/10/07 21:47:31 itojun Exp $ */
+/* $KAME: traceroute6.c,v 1.33 2000/10/07 06:22:55 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -261,7 +261,9 @@ static char sccsid[] = "@(#)traceroute.c 8.1 (Berkeley) 6/6/93";
#include <netdb.h>
#include <stdio.h>
#include <err.h>
+#ifdef HAVE_POLL
#include <poll.h>
+#endif
#include <errno.h>
#include <stdlib.h>
#include <string.h>
@@ -867,6 +869,7 @@ wait_for_reply(sock, mhdr)
int sock;
struct msghdr *mhdr;
{
+#ifdef HAVE_POLL
struct pollfd pfd[1];
int cc = 0;
@@ -878,6 +881,24 @@ wait_for_reply(sock, mhdr)
cc = recvmsg(rcvsock, mhdr, 0);
return(cc);
+#else
+ fd_set *fdsp;
+ struct timeval wait;
+ int cc = 0, fdsn;
+
+ fdsn = howmany(sock+1, NFDBITS) * sizeof(fd_mask);
+ if ((fdsp = (fd_set *)malloc(fdsn)) == NULL)
+ err(1, "malloc");
+ memset(fdsp, 0, fdsn);
+ FD_SET(sock, fdsp);
+ wait.tv_sec = waittime; wait.tv_usec = 0;
+
+ if (select(sock+1, fdsp, (fd_set *)0, (fd_set *)0, &wait) > 0)
+ cc = recvmsg(rcvsock, mhdr, 0);
+
+ free(fdsp);
+ return(cc);
+#endif
}
#ifdef IPSEC