isc_boolean_t
address_okay(isc_interface_t *isc_if) {
+
+ /* XXXPDM This should be fixed later, but since we may not have set
+ * the UP flag, we at least get to use the interface. The listen_to
+ * _virtual_ips check should be last.
+ */
if (listen_to_virtual_ips == 1)
return (ISC_TRUE);
if ((isc_if->flags & INTERFACE_F_UP) == 0) /* Ignore interfaces not up */
if (setsockopt(inter_list[i].fd, SOL_SOCKET,
SO_REUSEADDR, (char *)&flag,
sizeof(flag))) {
- netsyslog(LOG_ERR, "create_sockets: setsockopt(SO_REUSEADDR, %s) failed: %m", flag ? "on" : "off");
+ netsyslog(LOG_ERR, "set_reuseaddr: setsockopt(SO_REUSEADDR, %s) failed: %m", flag ? "on" : "off");
}
}
}
int i = ninterfaces; /* Use the next interface */
u_int32 haddr = ntohl(((struct sockaddr_in*)&addr)->sin_addr.s_addr);
struct in_addr iaddr;
- int s;
+ SOCKET s;
struct sockaddr_in *sinp;
#ifdef HAVE_IPV6
set_reuseaddr(1);
s = open_socket((struct sockaddr_storage*)sinp, 0, 1);
set_reuseaddr(0);
- if (s < 0) {
+ if (s == INVALID_SOCKET) {
memset((char *)&inter_list[i], 0, sizeof(struct interface));
if (wildipv4 >= 0) {
i = wildipv4;
set_reuseaddr(1);
s = open_socket((struct sockaddr_storage*)sin6p, 0, 1);
set_reuseaddr(0);
- if(s < 0){
+ if(s == INVALID_SOCKET){
memset((char *)&inter_list[i], 0, sizeof(struct interface));
if (wildipv6 >= 0) {
i = wildipv6;
*/
mreq.imr_multiaddr = ((struct sockaddr_in*)&addr)->sin_addr;
mreq.imr_interface.s_addr = htonl(INADDR_ANY);
- for (i = nwilds; i < ninterfaces; i++)
+ for (i = 0; i < ninterfaces; i++)
{
/* Be sure it's the correct family */
if (inter_list[i].sin.ss_family != AF_INET)
continue;
if (!SOCKCMP(&addr, &inter_list[i].sin))
continue;
- if (i != 0)
+ if (i != wildipv4)
{
/* we have an explicit fd, so we can close it */
close_socket(inter_list[i].fd);
*/
mreq6.ipv6mr_multiaddr = ((struct sockaddr_in6*)&addr)->sin6_addr;
mreq6.ipv6mr_interface = 0;
- for (i = nwilds; i < ninterfaces; i++)
+ for (i = 0; i < ninterfaces; i++)
{
/* Be sure it's the correct family */
if (inter_list[i].sin.ss_family != AF_INET6)
continue;
if (!SOCKCMP(&addr, &inter_list[i].sin))
continue;
- if (i != 0)
+ if (i != wildipv6)
{
/* we have an explicit fd, so we can close it */
close_socket(inter_list[i].fd);
/*NOTREACHED*/
}
#elif defined(FIONBIO)
- if (
# if defined(VMS)
- (ioctl(fd,FIONBIO,&1) < 0)
+ if (ioctl(fd,FIONBIO,&on) < 0)
# elif defined(SYS_WINNT)
- (ioctlsocket(fd,FIONBIO,(u_long *) &on) == SOCKET_ERROR)
+ if (ioctlsocket(fd,FIONBIO,(u_long *) &on) == SOCKET_ERROR)
# else
- (ioctl(fd,FIONBIO,&on) < 0)
+ if (ioctl(fd,FIONBIO,&on) < 0)
# endif
- )
{
netsyslog(LOG_ERR, "ioctl(FIONBIO) fails on address %s: %m",
stoa(addr));