static struct interface *find_addr_in_list (struct sockaddr_storage *);
static struct interface *find_flagged_addr_in_list (struct sockaddr_storage *, int);
static void create_wildcards (u_short);
-static isc_boolean_t address_okay (struct interface *);
+static isc_boolean_t address_okay (isc_interface_t *);
static void convert_isc_if (isc_interface_t *, struct interface *, u_short);
static struct interface *getinterface (struct sockaddr_storage *, int);
static struct interface *findlocalinterface (struct sockaddr_storage *, int);
((struct sockaddr_in*)&interface->bcast)->sin_addr.s_addr = htonl(INADDR_ANY);
#endif /* MCAST */
interface->fd = open_socket(&interface->sin,
- interface->flags, 1, interface);
+ 0, 1, interface);
if (interface->fd != INVALID_SOCKET) {
wildipv4 = interface;
stoa((&interface->sin)));
exit(1);
}
+ DPRINT_INTERFACE(2, (interface, "created ", "\n"));
}
#ifdef INCLUDE_IPV6_SUPPORT
interface->ignore_packets = ISC_TRUE;
interface->fd = open_socket(&interface->sin,
- interface->flags, 1, interface);
+ 0, 1, interface);
if (interface->fd != INVALID_SOCKET) {
wildipv6 = interface;
stoa((&interface->sin)));
exit(1);
}
+ DPRINT_INTERFACE(2, (interface, "created ", "\n"));
}
#endif
}
static isc_boolean_t
-address_okay(struct interface *iface) {
+address_okay(isc_interface_t *isc_if) {
DPRINTF(4, ("address_okay: listen Virtual: %d, IF name: %s\n",
- listen_to_virtual_ips, iface->name));
+ listen_to_virtual_ips, isc_if->name));
/*
* Always allow the loopback
*/
- if((iface->flags & INT_LOOPBACK) != 0) {
+ if((isc_if->flags & INTERFACE_F_LOOPBACK) != 0) {
DPRINTF(4, ("address_okay: loopback - OK\n"));
return (ISC_TRUE);
}
* Check if the interface is specified
*/
if (specific_interface != NULL) {
- if (strcasecmp(iface->name, specific_interface) == 0) {
+ if (strcasecmp(isc_if->name, specific_interface) == 0) {
DPRINTF(4, ("address_okay: specific interface name matched - OK\n"));
return (ISC_TRUE);
} else {
}
else {
if (listen_to_virtual_ips == 0 &&
- (strchr(iface->name, (int)':') != NULL)) {
+ (strchr(isc_if->name, (int)':') != NULL)) {
DPRINTF(4, ("address_okay: virtual ip/alias - FAIL\n"));
return (ISC_FALSE);
}
}
static void
-convert_isc_if(isc_interface_t *isc_if, struct interface *itf, u_short port)
-{
+convert_isc_if(isc_interface_t *isc_if, struct interface *itf, u_short port) {
itf->scopeid = 0;
itf->family = (short) isc_if->af;
strcpy(itf->name, isc_if->name);
{
close_and_delete_fd_from_list(interface->fd);
interface->fd = open_socket(&interface->sin,
- interface->flags, 0, interface);
+ 0, 0, interface);
/*
* reset TTL indication so TTL is is set again
* next time around
* and potentially causing problems with more than one
* process fiddling with the clock
*/
- if (address_okay(&interface) == ISC_TRUE) {
+ if (address_okay(&isc_if) == ISC_TRUE) {
interface.ignore_packets = ISC_FALSE;
}
else {
* create socket
*/
interface->fd = open_socket(&interface->sin,
- interface->flags, 0, interface);
+ 0, 0, interface);
if (interface->fd != INVALID_SOCKET)
list_if_listening(interface, port);
*/
if (interf->bfd == INVALID_SOCKET) {
fd = interf->fd;
+ jstatus = socket_broadcast_enable(interf, fd, &interf->sin);
}
else {
fd = interf->bfd;
+ jstatus = ISC_TRUE;
}
/* Enable Broadcast on socket */
- jstatus = socket_broadcast_enable(interf, fd, &interf->sin);
if (jstatus == ISC_TRUE)
{
nif++;
stoa(addr));
}
#endif /* IPTOS_LOWDELAY && IPPROTO_IP && IP_TOS */
+ if ((flags & INT_BROADCAST))
+ socket_broadcast_enable(interf, fd, addr);
}
/*
"bind() fd %d, family %d, port %d, addr %s, in_classd=%d flags=0x%x fails: %m",
fd, addr->ss_family, (int)ntohs(((struct sockaddr_in*)addr)->sin_port),
stoa(addr),
- IN_CLASSD(ntohl(((struct sockaddr_in*)addr)->sin_addr.s_addr)), flags);
+ IN_CLASSD(ntohl(((struct sockaddr_in*)addr)->sin_addr.s_addr)), interf->flags);
#ifdef INCLUDE_IPV6_SUPPORT
else if (addr->ss_family == AF_INET6)
netsyslog(LOG_ERR,
-1
# endif
, stoa(addr),
- IN6_IS_ADDR_MULTICAST(&((struct sockaddr_in6*)addr)->sin6_addr), flags);
+ IN6_IS_ADDR_MULTICAST(&((struct sockaddr_in6*)addr)->sin6_addr), interf->flags);
#endif
}
addr->ss_family,
(int)ntohs(((struct sockaddr_in*)addr)->sin_port),
stoa(addr),
- flags));
+ interf->flags));
init_nonblocking_io(fd);
struct sockaddr_storage saddr;
GETSOCKNAME_SOCKLEN_TYPE saddrlen = SOCKLEN(addr);
struct interface *iface;
+ int on = 1;
DPRINTF(4, ("Finding interface for addr %s in list of addresses\n",
stoa(addr));)
* we carve out an exception but only if the client has requested
* to receive wildcard sockets
*/
+#ifdef DEBUG
+ if(debug > 3 && get_packet_mode(buff) == MODE_BROADCAST)
+ printf("****Accepting Broadcast packet on fd %d from %s\n", buff->fd, stoa(&buff->recv_srcadr));
+#endif
ignore_this = inter->ignore_packets;
if (ignore_this == ISC_TRUE && inter->family == AF_INET &&
inter->flags == (INT_BROADCAST | INT_WILDCARD) &&
get_packet_mode(buff) == MODE_BROADCAST &&
get_broadcastclient_flag() == ISC_TRUE
- )
+ ) {
ignore_this = ISC_FALSE;
+#ifdef DEBUG
+ if (debug > 3)
+ printf("****Accepting ignored packet on fd %d from %s\n", buff->fd, stoa(&buff->recv_srcadr));
+#endif
+ }
/*
* If we keep it add some info to the structure
buff->receiver = receive;
buff->dstadr = inter;
#ifdef DEBUG
- if (debug > 3)
- printf("Received %d bytes in buffer %x from %s\n", Bytes, buff, stoa(&buff->recv_srcadr));
+ if (debug > 1)
+ printf("Received %d bytes of fd %d in buffer %x from %s\n", Bytes, buff->fd, buff, stoa(&buff->recv_srcadr));
#endif
add_full_recv_buffer(buff);
/*