diff --git a/bin/named/include/named/interfacemgr.h b/bin/named/include/named/interfacemgr.h index 1c4d2e64df..d17e603340 100644 --- a/bin/named/include/named/interfacemgr.h +++ b/bin/named/include/named/interfacemgr.h @@ -123,6 +123,14 @@ ns_interfacemgr_setlistenon(ns_interfacemgr_t *mgr, * The previous listen-on list is freed. */ +isc_result_t +ns_interfacemgr_findudpdispatcher(ns_interfacemgr_t *mgr, + isc_sockaddr_t *address, + dns_dispatch_t **dispatchp); +/* + * Find a UDP dispatcher matching 'address', if it exists. + */ + void ns_interface_attach(ns_interface_t *source, ns_interface_t **target); diff --git a/bin/named/interfacemgr.c b/bin/named/interfacemgr.c index 26b6e04c5e..63a5b2e20f 100644 --- a/bin/named/interfacemgr.c +++ b/bin/named/interfacemgr.c @@ -253,13 +253,8 @@ ns_interface_listenudp(ns_interface_t *ifp) { isc_result_totext(result)); goto udp_bind_failure; } - /* - * XXXRTH hardwired constants. We're going to need to determine if - * this UDP socket will be shared with the resolver, and if so, we - * need to set the hashsize to be be something bigger than 17. - */ result = dns_dispatch_create(ifp->mgr->mctx, ifp->udpsocket, ifp->task, - 4096, 50, 50, 17, 19, NULL, + 4096, 1000, 32768, 8219, 8237, NULL, &ifp->udpdispatch); if (result != ISC_R_SUCCESS) { UNEXPECTED_ERROR(__FILE__, __LINE__, @@ -268,8 +263,8 @@ ns_interface_listenudp(ns_interface_t *ifp) { goto udp_dispatch_failure; } - result = ns_clientmgr_createclients(ifp->mgr->clientmgr, ns_g_cpus, ifp, - ISC_FALSE); + result = ns_clientmgr_createclients(ifp->mgr->clientmgr, ns_g_cpus, + ifp, ISC_FALSE); if (result != ISC_R_SUCCESS) { UNEXPECTED_ERROR(__FILE__, __LINE__, "UDP ns_clientmgr_createclients(): %s", @@ -628,3 +623,22 @@ ns_interfacemgr_setlistenon(ns_interfacemgr_t *mgr, ns_listenlist_attach(value, &mgr->listenon); UNLOCK(&mgr->lock); } + +isc_result_t +ns_interfacemgr_findudpdispatcher(ns_interfacemgr_t *mgr, + isc_sockaddr_t *address, + dns_dispatch_t **dispatchp) +{ + ns_interface_t *ifp; + + /* + * Find a UDP dispatcher matching 'address', if it exists. + */ + + ifp = find_matching_interface(mgr, address); + if (ifp == NULL || ifp->udpdispatch == NULL) + return (ISC_R_NOTFOUND); + dns_dispatch_attach(ifp->udpdispatch, dispatchp); + + return (ISC_R_SUCCESS); +}