diff options
author | Rong-En Fan <rafan@FreeBSD.org> | 2006-07-15 17:14:45 +0000 |
---|---|---|
committer | Rong-En Fan <rafan@FreeBSD.org> | 2006-07-15 17:14:45 +0000 |
commit | b5be3c084ed3aa2cdd35a0e75f47cc882a842890 (patch) | |
tree | 42fbf0f96e8f5b71619e4834e051d9be788f413d /net/netselect/files/patch-netselect.c | |
parent | Add p5-OurNet-BBSAgent 1.61, scriptable telnet-based virtual users. (diff) |
Add netselect 0.3, ultrafast implementation of ping.
PR: ports/100338
Submitted by: Timothy Redaelli <drizzt at gufi.org>
Notes
Notes:
svn path=/head/; revision=167914
Diffstat (limited to 'net/netselect/files/patch-netselect.c')
-rw-r--r-- | net/netselect/files/patch-netselect.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/net/netselect/files/patch-netselect.c b/net/netselect/files/patch-netselect.c new file mode 100644 index 000000000000..6e7f1cacca48 --- /dev/null +++ b/net/netselect/files/patch-netselect.c @@ -0,0 +1,55 @@ +--- netselect.c.orig 2006-07-14 22:59:18.000000000 +0200 ++++ netselect.c 2006-07-14 22:57:22.000000000 +0200 +@@ -39,14 +39,13 @@ + * hey, great! Let me know. -- apenwarr + */ + +-#ifdef __EMX__ +-# include <io.h> +-# include <fcntl.h> +-# include <sys/types.h> +-# include <sys/select.h> +-# include <machine/endian.h> +-#else +-# include <endian.h> ++#ifdef __linux__ ++#include <endian.h> ++#elif defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__) ++#if defined(__OpenBSD__) ++#include <machine/types.h> ++#endif ++#include <machine/endian.h> + #endif + + #include <sys/param.h> +@@ -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); |