<Holger.Trapp@Informatik.TU-Chemnitz.DE>
<andre.lucas@dial.pipex.com>
- Make IPv4 use the default in RPM packages
- Irix uses preformatted manpages
+ - Missing htons() in bsd-bindresvport.c, fix from Holger Trapp
+ <Holger.Trapp@Informatik.TU-Chemnitz.DE>
20000120
- Don't use getaddrinfo on AIX
struct sockaddr_in *sin;
struct sockaddr_in6 *sin6;
u_int16_t *portp;
+ u_int16_t port;
int salen;
int i;
}
sa->sa_family = af;
- if (*portp == 0)
- *portp = (u_int16_t)(arc4random() % NPORTS) + STARTPORT;
+ port = ntohs(*portp);
+ if (port == 0)
+ port = (arc4random() % NPORTS) + STARTPORT;
for(i = 0; i < NPORTS; i++) {
+ *portp = htons(port);
+
error = bind(sd, sa, salen);
/* Terminate on success */
if ((error < 0) && !((errno == EADDRINUSE) || (errno == EINVAL)))
break;
- *portp = (i % NPORTS) + STARTPORT;
+ port++;
+ if (port > ENDPORT)
+ port = STARTPORT;
}
return (error);