#include <isc/magic.h>
#include <isc/mem.h>
#include <isc/socket.h>
#include <dns/result.h>
#include <named/listenlist.h>
#include <named/types.h>
Go to the source code of this file.
Data Structures | |
struct | ns_interface |
The nameserver interface structure. More... | |
Defines | |
#define | NAMED_INTERFACEMGR_H 1 |
#define | IFACE_MAGIC ISC_MAGIC('I',':','-',')') |
#define | NS_INTERFACE_VALID(t) ISC_MAGIC_VALID(t, IFACE_MAGIC) |
#define | NS_INTERFACEFLAG_ANYADDR 0x01U |
bound to "any" address | |
#define | MAX_UDP_DISPATCH 128 |
Maximum number of UDP dispatchers to start per interface. | |
Functions | |
isc_result_t | ns_interfacemgr_create (isc_mem_t *mctx, isc_taskmgr_t *taskmgr, isc_socketmgr_t *socketmgr, dns_dispatchmgr_t *dispatchmgr, isc_task_t *task, ns_interfacemgr_t **mgrp) |
void | ns_interfacemgr_attach (ns_interfacemgr_t *source, ns_interfacemgr_t **target) |
Create a new interface manager. | |
void | ns_interfacemgr_detach (ns_interfacemgr_t **targetp) |
void | ns_interfacemgr_shutdown (ns_interfacemgr_t *mgr) |
isc_boolean_t | ns_interfacemgr_islistening (ns_interfacemgr_t *mgr) |
isc_result_t | ns_interfacemgr_scan (ns_interfacemgr_t *mgr, isc_boolean_t verbose) |
Return if the manager is listening on any interface. It can be called after a scan or adjust. | |
isc_result_t | ns_interfacemgr_adjust (ns_interfacemgr_t *mgr, ns_listenlist_t *list, isc_boolean_t verbose) |
Scan the operatings system's list of network interfaces and create listeners when new interfaces are discovered. Shut down the sockets for interfaces that go away. | |
void | ns_interfacemgr_setlistenon4 (ns_interfacemgr_t *mgr, ns_listenlist_t *value) |
Similar to ns_interfacemgr_scan(), but this function also tries to see the need for an explicit listen-on when a list element in 'list' is going to override an already-listening a wildcard interface. | |
void | ns_interfacemgr_setlistenon6 (ns_interfacemgr_t *mgr, ns_listenlist_t *value) |
Set the IPv4 "listen-on" list of 'mgr' to 'value'. The previous IPv4 listen-on list is freed. | |
dns_aclenv_t * | ns_interfacemgr_getaclenv (ns_interfacemgr_t *mgr) |
Set the IPv6 "listen-on" list of 'mgr' to 'value'. The previous IPv6 listen-on list is freed. | |
void | ns_interface_attach (ns_interface_t *source, ns_interface_t **target) |
void | ns_interface_detach (ns_interface_t **targetp) |
void | ns_interface_shutdown (ns_interface_t *ifp) |
void | ns_interfacemgr_dumprecursing (FILE *f, ns_interfacemgr_t *mgr) |
Stop listening for queries on interface 'ifp'. May safely be called multiple times. | |
isc_boolean_t | ns_interfacemgr_listeningon (ns_interfacemgr_t *mgr, isc_sockaddr_t *addr) |
Reliability:
Security:
Definition in file interfacemgr.h.
#define NAMED_INTERFACEMGR_H 1 |
Definition at line 21 of file interfacemgr.h.
#define IFACE_MAGIC ISC_MAGIC('I',':','-',')') |
#define NS_INTERFACE_VALID | ( | t | ) | ISC_MAGIC_VALID(t, IFACE_MAGIC) |
Definition at line 65 of file interfacemgr.h.
Referenced by ns_interface_attach(), ns_interface_destroy(), ns_interface_detach(), and purge_old_interfaces().
#define NS_INTERFACEFLAG_ANYADDR 0x01U |
bound to "any" address
Definition at line 67 of file interfacemgr.h.
Referenced by client_request(), and do_scan().
#define MAX_UDP_DISPATCH 128 |
Maximum number of UDP dispatchers to start per interface.
Definition at line 68 of file interfacemgr.h.
Referenced by configure_view(), ns_interface_create(), and ns_interface_listenudp().
isc_result_t ns_interfacemgr_create | ( | isc_mem_t * | mctx, | |
isc_taskmgr_t * | taskmgr, | |||
isc_socketmgr_t * | socketmgr, | |||
dns_dispatchmgr_t * | dispatchmgr, | |||
isc_task_t * | task, | |||
ns_interfacemgr_t ** | mgrp | |||
) |
Definition at line 172 of file interfacemgr.c.
References ns_interfacemgr::aclenv, ns_interfacemgr::dispatchmgr, dns_aclenv_destroy(), dns_aclenv_init(), ns_interfacemgr::generation, IFMGR_MAGIC, ISC_LIST_INIT, isc_mem_attach(), isc_mem_get, isc_mem_putanddetach, isc_mutex_init, ISC_R_FAMILYNOSUPPORT, ISC_R_NOMEMORY, ISC_R_NOPERM, ISC_R_NOTIMPLEMENTED, ISC_R_SUCCESS, isc_socket_create(), isc_socket_detach(), isc_socket_recv(), isc_sockettype_raw, isc_task_attach(), isc_task_detach(), ns_interfacemgr::listenon4, ns_interfacemgr::listenon6, ns_interfacemgr::lock, ns_interfacemgr::magic, ns_interfacemgr::mctx, ns_interfacemgr_detach(), ns_listenlist_attach(), ns_listenlist_create(), ns_listenlist_detach(), ns_interfacemgr::references, REQUIRE, ns_interfacemgr::socketmgr, ns_interfacemgr::taskmgr, and UNUSED.
Referenced by run_server().
void ns_interfacemgr_attach | ( | ns_interfacemgr_t * | source, | |
ns_interfacemgr_t ** | target | |||
) |
Create a new interface manager.
Initially, the new manager will not listen on any interfaces. Call ns_interfacemgr_setlistenon() and/or ns_interfacemgr_setlistenon6() to set nonempty listen-on lists.
Definition at line 300 of file interfacemgr.c.
References INSIST, ns_interfacemgr::lock, LOCK, NS_INTERFACEMGR_VALID, ns_interfacemgr::references, REQUIRE, and UNLOCK.
Referenced by ns_interface_create().
void ns_interfacemgr_detach | ( | ns_interfacemgr_t ** | targetp | ) |
Definition at line 310 of file interfacemgr.c.
References ISC_FALSE, ISC_TRUE, ns_interfacemgr::lock, LOCK, ns_interfacemgr_destroy(), NS_INTERFACEMGR_VALID, ns_interfacemgr::references, REQUIRE, and UNLOCK.
Referenced by ns_interface_destroy(), ns_interfacemgr_create(), and shutdown_server().
void ns_interfacemgr_shutdown | ( | ns_interfacemgr_t * | mgr | ) |
Shut down and detach all interfaces. By incrementing the generation count, we make purge_old_interfaces() consider all interfaces "old".
Definition at line 327 of file interfacemgr.c.
References ns_interfacemgr::generation, ISC_SOCKCANCEL_RECV, isc_socket_cancel(), isc_socket_detach(), isc_task_detach(), ns_interfacemgr::lock, LOCK, NS_INTERFACEMGR_VALID, purge_old_interfaces(), REQUIRE, and UNLOCK.
Referenced by shutdown_server().
isc_boolean_t ns_interfacemgr_islistening | ( | ns_interfacemgr_t * | mgr | ) |
Definition at line 1184 of file interfacemgr.c.
References ISC_FALSE, ISC_LIST_EMPTY, ISC_TRUE, NS_INTERFACEMGR_VALID, and REQUIRE.
isc_result_t ns_interfacemgr_scan | ( | ns_interfacemgr_t * | mgr, | |
isc_boolean_t | verbose | |||
) |
Return if the manager is listening on any interface. It can be called after a scan or adjust.
Definition at line 1191 of file interfacemgr.c.
References ns_interfacemgr_scan0().
Referenced by scan_interfaces().
isc_result_t ns_interfacemgr_adjust | ( | ns_interfacemgr_t * | mgr, | |
ns_listenlist_t * | list, | |||
isc_boolean_t | verbose | |||
) |
Scan the operatings system's list of network interfaces and create listeners when new interfaces are discovered. Shut down the sockets for interfaces that go away.
This should be called once on server startup and then periodically according to the 'interface-interval' option in named.conf.
Definition at line 1196 of file interfacemgr.c.
References ns_interfacemgr_scan0().
Referenced by adjust_interfaces().
void ns_interfacemgr_setlistenon4 | ( | ns_interfacemgr_t * | mgr, | |
ns_listenlist_t * | value | |||
) |
Similar to ns_interfacemgr_scan(), but this function also tries to see the need for an explicit listen-on when a list element in 'list' is going to override an already-listening a wildcard interface.
This function does not update localhost and localnets ACLs.
This should be called once on server startup, after configuring views and zones.
Definition at line 1203 of file interfacemgr.c.
References ns_interfacemgr::listenon4, ns_interfacemgr::lock, LOCK, ns_listenlist_attach(), ns_listenlist_detach(), and UNLOCK.
Referenced by load_configuration().
void ns_interfacemgr_setlistenon6 | ( | ns_interfacemgr_t * | mgr, | |
ns_listenlist_t * | value | |||
) |
Set the IPv4 "listen-on" list of 'mgr' to 'value'. The previous IPv4 listen-on list is freed.
Definition at line 1211 of file interfacemgr.c.
References ns_interfacemgr::listenon6, ns_interfacemgr::lock, LOCK, ns_listenlist_attach(), ns_listenlist_detach(), and UNLOCK.
Referenced by load_configuration().
dns_aclenv_t* ns_interfacemgr_getaclenv | ( | ns_interfacemgr_t * | mgr | ) |
Set the IPv6 "listen-on" list of 'mgr' to 'value'. The previous IPv6 listen-on list is freed.
Definition at line 295 of file interfacemgr.c.
References ns_interfacemgr::aclenv.
Referenced by scan_interfaces().
void ns_interface_attach | ( | ns_interface_t * | source, | |
ns_interface_t ** | target | |||
) |
Definition at line 634 of file interfacemgr.c.
References INSIST, ns_interface::lock, LOCK, NS_INTERFACE_VALID, ns_interface::references, REQUIRE, and UNLOCK.
Referenced by get_client(), and get_worker().
void ns_interface_detach | ( | ns_interface_t ** | targetp | ) |
Definition at line 644 of file interfacemgr.c.
References ISC_FALSE, ISC_TRUE, ns_interface::lock, LOCK, ns_interface_destroy(), NS_INTERFACE_VALID, ns_interface::references, REQUIRE, and UNLOCK.
Referenced by exit_check(), ns_interface_setup(), and purge_old_interfaces().
void ns_interface_shutdown | ( | ns_interface_t * | ifp | ) |
Definition at line 601 of file interfacemgr.c.
References ns_interface::clientmgr, and ns_clientmgr_destroy().
Referenced by ns_interface_destroy(), and purge_old_interfaces().
void ns_interfacemgr_dumprecursing | ( | FILE * | f, | |
ns_interfacemgr_t * | mgr | |||
) |
Stop listening for queries on interface 'ifp'. May safely be called multiple times.
Definition at line 1219 of file interfacemgr.c.
References ns_interface::clientmgr, ISC_LIST_HEAD, ISC_LIST_NEXT, ns_interfacemgr::lock, LOCK, ns_client_dumprecursing(), and UNLOCK.
Referenced by ns_server_dumprecursing().
isc_boolean_t ns_interfacemgr_listeningon | ( | ns_interfacemgr_t * | mgr, | |
isc_sockaddr_t * | addr | |||
) |
Definition at line 1233 of file interfacemgr.c.
References ISC_FALSE, ISC_LIST_HEAD, ISC_LIST_NEXT, isc_sockaddr_equal(), and ISC_TRUE.
Referenced by ns_client_isself().