diff options
Diffstat (limited to 'usr.sbin/traceroute6')
-rw-r--r-- | usr.sbin/traceroute6/Makefile | 4 | ||||
-rw-r--r-- | usr.sbin/traceroute6/traceroute6.c | 25 |
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 |