Index: head/net/netselect/Makefile =================================================================== --- head/net/netselect/Makefile (revision 380834) +++ head/net/netselect/Makefile (revision 380835) @@ -1,29 +1,35 @@ # Created by: Timothy Redaelli # $FreeBSD$ PORTNAME= netselect PORTVERSION= 0.3 CATEGORIES= net MASTER_SITES= http://apenwarr.ca/netselect/ \ GENTOO/distfiles MAINTAINER= ports@FreeBSD.org COMMENT= Ultrafast implementation of ping LICENSE= BSD3CLAUSE -BROKEN= Does not work (sendto: Invalid argument) - -OPTIONS_DEFINE= SUID +OPTIONS_DEFINE= SUID DOCS OPTIONS_SUB= yes -SUID_DESC= Install with the setuid bit (mode 4110) +SUID_DESC= Install with the setuid bit to allow use by non-root users +EXTRACT_AFTER_ARGS=netselect/netselect.c netselect/README WRKSRC= ${WRKDIR}/${PORTNAME} do-build: ${CC} ${CFLAGS} -o ${WRKSRC}/${PORTNAME} ${WRKSRC}/${PORTNAME}.c + ${REINPLACE_CMD} -E -i "" -e 's|[[:blank:]]+$$||' ${WRKSRC}/README +.include + do-install: ${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin +.if ${PORT_OPTIONS:MDOCS} + ${MKDIR} ${STAGEDIR}${DOCSDIR} + ${INSTALL_DATA} ${WRKSRC}/README ${STAGEDIR}${DOCSDIR} +.endif .include Index: head/net/netselect/files/patch-netselect.c =================================================================== --- head/net/netselect/files/patch-netselect.c (revision 380834) +++ head/net/netselect/files/patch-netselect.c (revision 380835) @@ -1,55 +1,70 @@ ---- netselect.c.orig 2006-07-14 22:59:18.000000000 +0200 -+++ netselect.c 2006-07-14 22:57:22.000000000 +0200 +--- netselect.c 2001-08-29 05:18:57.000000000 -0400 ++++ netselect.c 2015-03-09 02:31:02.000000000 -0400 @@ -39,14 +39,13 @@ * hey, great! Let me know. -- apenwarr */ -#ifdef __EMX__ -# include -# include -# include -# include -# include -#else -# include +#ifdef __linux__ +#include +#elif defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__) +#if defined(__OpenBSD__) +#include +#endif +#include #endif #include @@ -152,6 +151,7 @@ extern int optind; int hostcount, startcount, endcount = 0, sent_one, lag, min_lag = 100; int ch, seq, ttl, max_ttl = 30, min_tries = 10, num_score = 1; + int on = 1; struct timeval now; struct timezone tz; OPacket outpacket; /* last output (udp) packet */ @@ -234,7 +234,12 @@ if (verbose >= 1) fprintf(stderr, "Running netselect to choose %d out of %d address%s.\n", num_score, numhosts, numhosts==1 ? "" : "es"); - + + if (setsockopt(sndsock, IPPROTO_IP, IP_HDRINCL, &on, sizeof(on)) < 0) { + perror("IP_HDRINCL"); + _exit(EXIT_FAILURE); + } + /* keep going until most of the hosts have been finished */ must_continue = numhosts; while (must_continue && must_continue >= numhosts/2) @@ -712,7 +717,7 @@ ip->ip_off = 0; ip->ip_hl = sizeof(*ip) >> 2; ip->ip_p = IPPROTO_UDP; - ip->ip_len = 0; /* kernel fills this in */ + ip->ip_len = sizeof(OPacket); ip->ip_ttl = ttl; ip->ip_v = IPVERSION; ip->ip_id = htons(ident + seq); +@@ -771,12 +776,8 @@ + int cc = 0; + time_t msec_used; + HostData *host; +- +-#if !defined(__GLIBC__) +- int fromlen = sizeof(from); +-#else /* __GLIBC__ */ +- size_t fromlen = sizeof(from); +-#endif /* __GLIBC__ */ ++ ++ socklen_t fromlen = sizeof(from); + + FD_ZERO(&fds); + FD_SET(sock, &fds); Index: head/net/netselect/pkg-plist =================================================================== --- head/net/netselect/pkg-plist (revision 380834) +++ head/net/netselect/pkg-plist (revision 380835) @@ -1,2 +1,3 @@ %%SUID%%@(root,wheel,4110) bin/netselect %%NO_SUID%%@(root,wheel,100) bin/netselect +%%PORTDOCS%%%%DOCSDIR%%/README