static isc_result_t
get_udpsocket(dns_dispatchmgr_t *mgr, dns_dispatch_t *disp,
isc_socketmgr_t *sockmgr, const isc_sockaddr_t *localaddr,
- isc_socket_t **sockp, isc_socket_t *dup_socket, bool duponly);
+ isc_socket_t **sockp, isc_socket_t *dup_socket);
static isc_result_t
dispatch_createudp(dns_dispatchmgr_t *mgr, isc_socketmgr_t *sockmgr,
isc_taskmgr_t *taskmgr, const isc_sockaddr_t *localaddr,
return (ISC_R_SUCCESS);
}
- if ((disp->attributes & DNS_DISPATCHATTR_NOLISTEN) != 0) {
- return (ISC_R_SUCCESS);
- }
-
if (disp->recv_pending != 0 && dispsock == NULL) {
return (ISC_R_SUCCESS);
}
static isc_result_t
get_udpsocket(dns_dispatchmgr_t *mgr, dns_dispatch_t *disp,
isc_socketmgr_t *sockmgr, const isc_sockaddr_t *localaddr,
- isc_socket_t **sockp, isc_socket_t *dup_socket, bool duponly) {
+ isc_socket_t **sockp, isc_socket_t *dup_socket) {
unsigned int i, j;
isc_socket_t *held[DNS_DISPATCH_HELD];
isc_sockaddr_t localaddr_bound;
/* Allow to reuse address for non-random ports. */
result = open_socket(sockmgr, localaddr,
ISC_SOCKET_REUSEADDRESS, &sock, dup_socket,
- duponly);
+ true);
if (result == ISC_R_SUCCESS) {
*sockp = sock;
dns_dispatch_t *disp;
isc_socket_t *sock = NULL;
int i = 0;
- bool duponly = ((attributes & DNS_DISPATCHATTR_CANREUSE) == 0);
- /* This is an attribute needed only at creation time */
- attributes &= ~DNS_DISPATCHATTR_CANREUSE;
/*
* dispatch_allocate() checks mgr for us.
*/
if ((attributes & DNS_DISPATCHATTR_EXCLUSIVE) == 0) {
result = get_udpsocket(mgr, disp, sockmgr, localaddr, &sock,
- dup_socket, duponly);
+ dup_socket);
if (result != ISC_R_SUCCESS) {
goto deallocate_dispatch;
}
}
/*
- * Try somewhat hard to find an unique ID unless FIXEDID is set
- * in which case we use the id passed in via *idp.
+ * Try somewhat hard to find a unique ID, unless
+ * DNS_DISPATCHOPT_FIXEDID is set, in which case we
+ * use the ID passed in via *idp.
*/
LOCK(&qid->lock);
if ((options & DNS_DISPATCHOPT_FIXEDID) != 0) {
ok = true;
break;
}
- if ((disp->attributes & DNS_DISPATCHATTR_FIXEDID) != 0) {
- break;
- }
id += qid->qid_increment;
id &= 0x0000ffff;
} while (i++ < 64);
REQUIRE(VALID_DISPATCH(disp));
/* Exclusive attribute can only be set on creation */
REQUIRE((attributes & DNS_DISPATCHATTR_EXCLUSIVE) == 0);
- /* Also, a dispatch with randomport specified cannot start listening */
- REQUIRE((disp->attributes & DNS_DISPATCHATTR_EXCLUSIVE) == 0 ||
- (attributes & DNS_DISPATCHATTR_NOLISTEN) == 0);
/* XXXMLG
* Should check for valid attributes here!
LOCK(&disp->lock);
- if ((mask & DNS_DISPATCHATTR_NOLISTEN) != 0) {
- if ((disp->attributes & DNS_DISPATCHATTR_NOLISTEN) != 0 &&
- (attributes & DNS_DISPATCHATTR_NOLISTEN) == 0)
- {
- disp->attributes &= ~DNS_DISPATCHATTR_NOLISTEN;
- (void)startrecv(disp, NULL);
- } else if ((disp->attributes & DNS_DISPATCHATTR_NOLISTEN) ==
- 0 &&
- (attributes & DNS_DISPATCHATTR_NOLISTEN) != 0)
- {
- disp->attributes |= DNS_DISPATCHATTR_NOLISTEN;
- if (disp->recv_pending != 0) {
- isc_socket_cancel(disp->socket, disp->task[0],
- ISC_SOCKCANCEL_RECV);
- }
- }
- }
-
disp->attributes &= ~mask;
disp->attributes |= (attributes & mask);
UNLOCK(&disp->lock);
* _IPV4, _IPV6
* The dispatcher uses an IPv4 or IPv6 socket.
*
- * _NOLISTEN
- * The dispatcher should not listen on the socket.
- *
* _MAKEQUERY
* The dispatcher can be used to issue queries to other servers, and
* accept replies from them.
#define DNS_DISPATCHATTR_UDP 0x00000004U
#define DNS_DISPATCHATTR_IPV4 0x00000008U
#define DNS_DISPATCHATTR_IPV6 0x00000010U
-#define DNS_DISPATCHATTR_NOLISTEN 0x00000020U
#define DNS_DISPATCHATTR_MAKEQUERY 0x00000040U
#define DNS_DISPATCHATTR_CONNECTED 0x00000080U
-#define DNS_DISPATCHATTR_FIXEDID 0x00000100U
#define DNS_DISPATCHATTR_EXCLUSIVE 0x00000200U
-#define DNS_DISPATCHATTR_CANREUSE 0x00000400U
/*@}*/
/*