ports/100338: New port: net/netselect Ultrafast implementation of ping

Timothy Redaelli drizzt at gufi.org
Sat Jul 15 11:20:12 UTC 2006


>Number:         100338
>Category:       ports
>Synopsis:       New port: net/netselect Ultrafast implementation of ping
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jul 15 11:20:11 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Timothy Redaelli
>Release:        FreeBSD 6.1-STABLE i386
>Organization:
>Environment:
System: FreeBSD picard.drizzt.local 6.1-STABLE FreeBSD 6.1-STABLE #1: Sun May 28 17:44:31 CEST 2006 drizzt at picard.drizzt.local:/usr/obj/usr/src/sys/PICARD i386
>Description:
>How-To-Repeat:
>Fix:

--- netselect.shar begins here ---
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	/usr/ports/net/netselect/
#	/usr/ports/net/netselect/pkg-descr
#	/usr/ports/net/netselect/distinfo
#	/usr/ports/net/netselect/Makefile
#	/usr/ports/net/netselect/files
#	/usr/ports/net/netselect/files/patch-netselect.c
#
echo c - /usr/ports/net/netselect/
mkdir -p /usr/ports/net/netselect/ > /dev/null 2>&1
echo x - /usr/ports/net/netselect/pkg-descr
sed 's/^X//' >/usr/ports/net/netselect/pkg-descr << 'END-of-/usr/ports/net/netselect/pkg-descr'
Xnetselect is an ultrafast intelligent parallelizing binary-search
Ximplementation of "ping."
X
Xnetselect determines several facts about all of the hosts given on the command
Xline, much faster than you would if you tried to use ping and traceroute.
XFor example, if I type:
X
X  netselect -v ftp.fceia.unr.edu.ar \
X      ftp.kulnet.kuleuven.ac.be \
X      ftp.cdrom.com ftp.debian.org \
X      ftp.de.debian.org
X
XIt tells me statistics about each of the hostnames I provided,
Xin much less time than doing a whole bunch of traceroutes.
END-of-/usr/ports/net/netselect/pkg-descr
echo x - /usr/ports/net/netselect/distinfo
sed 's/^X//' >/usr/ports/net/netselect/distinfo << 'END-of-/usr/ports/net/netselect/distinfo'
XMD5 (netselect-0.3.tar.gz) = 3a3714946db2458e5db3d55373057ef2
XSHA256 (netselect-0.3.tar.gz) = fe81942589d5219d030e5cecfb12787fb6d3613416cb326dea4952bf53f9c978
XSIZE (netselect-0.3.tar.gz) = 22047
END-of-/usr/ports/net/netselect/distinfo
echo x - /usr/ports/net/netselect/Makefile
sed 's/^X//' >/usr/ports/net/netselect/Makefile << 'END-of-/usr/ports/net/netselect/Makefile'
X# New ports collection makefile for:    netselect
X# Date created:                         15 July 2006
X# Whom:                                 Timothy Redaelli <drizzt at gufi.org>
X#
X# $FreeBSD$
X#
X
XPORTNAME=	netselect
XPORTVERSION=	0.3
XCATEGORIES=	net
XMASTER_SITES=	${MASTER_SITE_GENTOO} \
X		http://www.worldvisions.ca/~apenwarr/netselect/
XMASTER_SITE_SUBDIR=	distfiles
X
XMAINTAINER=	drizzt at gufi.org
XCOMMENT=	Ultrafast implementation of ping
X
XPLIST_FILES=	bin/${PORTNAME}
X
XWRKSRC=		${WRKDIR}/${PORTNAME}
X
XOPTIONS=	SUID "Install with the sticky bit (mode 4110)" off
X
X.include <bsd.port.pre.mk>
X
X.if defined(WITH_SUID)
XBINMODE=	4110
X.else
XBINMODE=	0100
X.endif
X
Xdo-build:
X	${CC} ${CFLAGS} -o ${WRKSRC}/${PORTNAME} ${WRKSRC}/${PORTNAME}.c
X
Xdo-install:
X	${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${PREFIX}/bin
X
X.include <bsd.port.post.mk>
END-of-/usr/ports/net/netselect/Makefile
echo c - /usr/ports/net/netselect/files
mkdir -p /usr/ports/net/netselect/files > /dev/null 2>&1
echo x - /usr/ports/net/netselect/files/patch-netselect.c
sed 's/^X//' >/usr/ports/net/netselect/files/patch-netselect.c << 'END-of-/usr/ports/net/netselect/files/patch-netselect.c'
X--- netselect.c.orig	2006-07-14 22:59:18.000000000 +0200
X+++ netselect.c	2006-07-14 22:57:22.000000000 +0200
X@@ -39,14 +39,13 @@
X  * hey, great!  Let me know. -- apenwarr
X  */
X 
X-#ifdef __EMX__
X-# include <io.h>
X-# include <fcntl.h>
X-# include <sys/types.h>
X-# include <sys/select.h>
X-# include <machine/endian.h>
X-#else
X-# include <endian.h>
X+#ifdef __linux__
X+#include <endian.h>
X+#elif defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__)
X+#if defined(__OpenBSD__)
X+#include <machine/types.h>
X+#endif
X+#include <machine/endian.h>
X #endif
X 
X #include <sys/param.h>
X@@ -152,6 +151,7 @@
X     extern int optind;
X     int hostcount, startcount, endcount = 0, sent_one, lag, min_lag = 100;
X     int ch, seq, ttl, max_ttl = 30, min_tries = 10, num_score = 1;
X+    int on = 1;
X     struct timeval now;
X     struct timezone tz;
X     OPacket outpacket;          /* last output (udp) packet */
X@@ -234,7 +234,12 @@
X     if (verbose >= 1)
X 	fprintf(stderr, "Running netselect to choose %d out of %d address%s.\n",
X 		num_score, numhosts, numhosts==1 ? "" : "es");
X-    
X+   
X+   if (setsockopt(sndsock, IPPROTO_IP, IP_HDRINCL, &on, sizeof(on)) < 0) {
X+        perror("IP_HDRINCL");
X+	_exit(EXIT_FAILURE);
X+   }
X+
X     /* keep going until most of the hosts have been finished */
X     must_continue = numhosts;
X     while (must_continue && must_continue >= numhosts/2)
X@@ -712,7 +717,7 @@
X     ip->ip_off = 0;
X     ip->ip_hl = sizeof(*ip) >> 2;
X     ip->ip_p = IPPROTO_UDP;
X-    ip->ip_len = 0; /* kernel fills this in */
X+    ip->ip_len = sizeof(OPacket);
X     ip->ip_ttl = ttl;
X     ip->ip_v = IPVERSION;
X     ip->ip_id = htons(ident + seq);
END-of-/usr/ports/net/netselect/files/patch-netselect.c
exit
--- netselect.sh ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list