Files
macports-ports/net/netselect/files/netselect.c.diff
2024-11-27 07:03:41 -05:00

45 lines
1.3 KiB
Diff

--- netselect.c 2010-10-26 23:08:55.000000000 +0000
+++ netselect.c 2024-11-24 00:06:55.339564162 +0000
@@ -39,8 +39,10 @@
* hey, great! Let me know. -- apenwarr
*/
-#ifdef __EMX__
-# include <io.h>
+#if defined(__EMX__) || 1 /* XXX BSD */
+# ifdef __EMX__
+# include <io.h>
+# endif
# include <fcntl.h>
# include <sys/types.h>
# include <sys/select.h>
@@ -167,6 +169,7 @@
extern int optind;
int hostcount, startcount, endcount = 0, sent_one, lag, min_lag = 100;
int ch, seq, ttl, max_ttl = 30, num_score = 1;
+ int on = 1;
int use_icmp = 0;
unsigned int min_tries = 10;
struct timeval now;
@@ -280,7 +283,10 @@
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(1);
+ }
/* keep going until most of the hosts have been finished */
must_continue = numhosts;
while (must_continue && must_continue >= numhosts/2)
@@ -774,7 +780,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);