bind  9.11.23
About: BIND 9.11 implements the Domain Name System (DNS) protocols for the Internet (see the Release Notes). ESV = Extended Supported Version. Source code distribution.
  Fossies Dox: bind-9.11.23.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

controlconf.c File Reference
#include <config.h>
#include <inttypes.h>
#include <stdbool.h>
#include <isc/base64.h>
#include <isc/buffer.h>
#include <isc/event.h>
#include <isc/file.h>
#include <isc/mem.h>
#include <isc/net.h>
#include <isc/netaddr.h>
#include <isc/random.h>
#include <isc/result.h>
#include <isc/stdtime.h>
#include <isc/string.h>
#include <isc/timer.h>
#include <isc/util.h>
#include <isccfg/namedconf.h>
#include <bind9/check.h>
#include <isccc/alist.h>
#include <isccc/cc.h>
#include <isccc/ccmsg.h>
#include <isccc/events.h>
#include <isccc/result.h>
#include <isccc/sexpr.h>
#include <isccc/symtab.h>
#include <isccc/util.h>
#include <dns/result.h>
#include <named/control.h>
#include <named/log.h>
#include <named/server.h>
Include dependency graph for controlconf.c:

Go to the source code of this file.

Data Structures

struct  controlconnection
 
struct  controllistener
 
struct  ns_controls
 

Macros

#define CLOCKSKEW   300
 
#define CHECK(x)
 

Typedefs

typedef struct controlkey controlkey_t
 

Functions

typedef ISC_LIST (controlkey_t)
 
static void control_newconn (isc_task_t *task, isc_event_t *event)
 
static void control_recvmessage (isc_task_t *task, isc_event_t *event)
 
static void free_controlkey (controlkey_t *key, isc_mem_t *mctx)
 
static void free_controlkeylist (controlkeylist_t *keylist, isc_mem_t *mctx)
 
static void free_listener (controllistener_t *listener)
 
static void maybe_free_listener (controllistener_t *listener)
 
static void maybe_free_connection (controlconnection_t *conn)
 
static void shutdown_listener (controllistener_t *listener)
 
static bool address_ok (isc_sockaddr_t *sockaddr, dns_acl_t *acl)
 
static isc_result_t control_accept (controllistener_t *listener)
 
static isc_result_t control_listen (controllistener_t *listener)
 
static void control_next (controllistener_t *listener)
 
static void control_senddone (isc_task_t *task, isc_event_t *event)
 
static void log_invalid (isccc_ccmsg_t *ccmsg, isc_result_t result)
 
static void control_timeout (isc_task_t *task, isc_event_t *event)
 
static isc_result_t newconnection (controllistener_t *listener, isc_socket_t *sock)
 
static void controls_shutdown (ns_controls_t *controls)
 
void ns_controls_shutdown (ns_controls_t *controls)
 
static isc_result_t cfgkeylist_find (const cfg_obj_t *keylist, const char *keyname, const cfg_obj_t **objp)
 
static isc_result_t controlkeylist_fromcfg (const cfg_obj_t *keylist, isc_mem_t *mctx, controlkeylist_t *keyids)
 
static void register_keys (const cfg_obj_t *control, const cfg_obj_t *keylist, controlkeylist_t *keyids, isc_mem_t *mctx, const char *socktext)
 
static isc_result_t get_rndckey (isc_mem_t *mctx, controlkeylist_t *keyids)
 
static void get_key_info (const cfg_obj_t *config, const cfg_obj_t *control, const cfg_obj_t **global_keylistp, const cfg_obj_t **control_keylistp)
 
static void update_listener (ns_controls_t *cp, controllistener_t **listenerp, const cfg_obj_t *control, const cfg_obj_t *config, isc_sockaddr_t *addr, cfg_aclconfctx_t *aclconfctx, const char *socktext, isc_sockettype_t type)
 
static void add_listener (ns_controls_t *cp, controllistener_t **listenerp, const cfg_obj_t *control, const cfg_obj_t *config, isc_sockaddr_t *addr, cfg_aclconfctx_t *aclconfctx, const char *socktext, isc_sockettype_t type)
 
isc_result_t ns_controls_configure (ns_controls_t *cp, const cfg_obj_t *config, cfg_aclconfctx_t *aclconfctx)
 
isc_result_t ns_controls_create (ns_server_t *server, ns_controls_t **ctrlsp)
 
void ns_controls_destroy (ns_controls_t **ctrlsp)
 

Macro Definition Documentation

◆ CHECK

#define CHECK (   x)
Value:
do { \
result = (x); \
if (result != ISC_R_SUCCESS) \
goto cleanup; \
} while (0)

Definition at line 837 of file controlconf.c.

◆ CLOCKSKEW

#define CLOCKSKEW   300

Definition at line 116 of file controlconf.c.

Typedef Documentation

◆ controlkey_t

typedef struct controlkey controlkey_t

Definition at line 1 of file controlconf.c.

Function Documentation

◆ add_listener()

◆ address_ok()

static bool address_ok ( isc_sockaddr_t sockaddr,
dns_acl_t acl 
)
static

Definition at line 227 of file controlconf.c.

References ns_server::aclenv, dns_acl_match(), isc_netaddr_fromsockaddr(), ISC_R_SUCCESS, match(), and ns_g_server.

Referenced by control_newconn().

Here is the caller graph for this function:

◆ cfgkeylist_find()

static isc_result_t cfgkeylist_find ( const cfg_obj_t keylist,
const char *  keyname,
const cfg_obj_t **  objp 
)
static

Definition at line 691 of file controlconf.c.

References cfg_list_first(), cfg_list_next(), cfg_listelt_value(), cfg_map_getname(), cfg_obj_asstring(), ISC_R_NOTFOUND, ISC_R_SUCCESS, keylist, and str.

Referenced by register_keys().

Here is the caller graph for this function:

◆ control_accept()

static isc_result_t control_accept ( controllistener_t *  listener)
static

Definition at line 244 of file controlconf.c.

References control_newconn(), ISC_R_SUCCESS, isc_result_totext(), isc_socket_accept(), and UNEXPECTED_ERROR.

Referenced by add_listener(), and control_next().

Here is the caller graph for this function:

◆ control_listen()

static isc_result_t control_listen ( controllistener_t *  listener)
static

Definition at line 259 of file controlconf.c.

References ISC_R_SUCCESS, isc_result_totext(), isc_socket_listen(), and UNEXPECTED_ERROR.

Referenced by add_listener().

Here is the caller graph for this function:

◆ control_newconn()

static void control_newconn ( isc_task_t task,
isc_event_t event 
)
static

◆ control_next()

static void control_next ( controllistener_t *  listener)
static

Definition at line 271 of file controlconf.c.

References control_accept().

Referenced by control_newconn().

Here is the caller graph for this function:

◆ control_recvmessage()

◆ control_senddone()

static void control_senddone ( isc_task_t task,
isc_event_t event 
)
static

◆ control_timeout()

static void control_timeout ( isc_task_t task,
isc_event_t event 
)
static

Definition at line 548 of file controlconf.c.

References conn, isc_event_free(), isc_timer_detach(), maybe_free_connection(), and UNUSED.

Referenced by newconnection().

Here is the caller graph for this function:

◆ controlkeylist_fromcfg()

static isc_result_t controlkeylist_fromcfg ( const cfg_obj_t keylist,
isc_mem_t mctx,
controlkeylist_t *  keyids 
)
static

Definition at line 715 of file controlconf.c.

References cfg_list_first(), cfg_list_next(), cfg_listelt_value(), cfg_obj_asstring(), cleanup(), DST_ALG_UNKNOWN, free_controlkeylist(), ISC_LINK_INIT, ISC_LIST_APPEND, isc_mem_free, isc_mem_get, isc_mem_strdup, ISC_R_NOMEMORY, ISC_R_SUCCESS, keylist, mctx, and str.

Referenced by add_listener(), and update_listener().

Here is the caller graph for this function:

◆ controls_shutdown()

static void controls_shutdown ( ns_controls_t controls)
static

Definition at line 667 of file controlconf.c.

References ISC_LIST_HEAD, ISC_LIST_NEXT, ns_controls::listeners, and shutdown_listener().

Referenced by ns_controls_configure(), and ns_controls_shutdown().

Here is the caller graph for this function:

◆ free_controlkey()

static void free_controlkey ( controlkey_t key,
isc_mem_t mctx 
)
static

Definition at line 119 of file controlconf.c.

References isc_mem_free, isc_mem_put, and mctx.

Referenced by free_controlkeylist(), get_rndckey(), and register_keys().

Here is the caller graph for this function:

◆ free_controlkeylist()

static void free_controlkeylist ( controlkeylist_t *  keylist,
isc_mem_t mctx 
)
static

Definition at line 128 of file controlconf.c.

References free_controlkey(), ISC_LIST_EMPTY, ISC_LIST_HEAD, ISC_LIST_UNLINK, keylist, and mctx.

Referenced by controlkeylist_fromcfg(), free_listener(), and update_listener().

Here is the caller graph for this function:

◆ free_listener()

static void free_listener ( controllistener_t *  listener)
static

Definition at line 137 of file controlconf.c.

References dns_acl_detach(), free_controlkeylist(), INSIST, ISC_LIST_EMPTY, isc_mem_putanddetach, and isc_socket_detach().

Referenced by add_listener(), and maybe_free_listener().

Here is the caller graph for this function:

◆ get_key_info()

static void get_key_info ( const cfg_obj_t config,
const cfg_obj_t control,
const cfg_obj_t **  global_keylistp,
const cfg_obj_t **  control_keylistp 
)
static

Definition at line 943 of file controlconf.c.

References cfg_list_first(), cfg_map_get(), cfg_obj_isvoid(), cfg_tuple_get(), ISC_R_SUCCESS, and REQUIRE.

Referenced by add_listener(), and update_listener().

Here is the caller graph for this function:

◆ get_rndckey()

◆ ISC_LIST()

typedef ISC_LIST ( controlkey_t  )

Definition at line 60 of file controlconf.c.

◆ log_invalid()

static void log_invalid ( isccc_ccmsg_t ccmsg,
isc_result_t  result 
)
inlinestatic

Definition at line 314 of file controlconf.c.

References ccmsg, ISC_LOG_ERROR, isc_log_write(), isc_result_totext(), isc_sockaddr_format(), ISC_SOCKADDR_FORMATSIZE, isc_socket_getpeername(), ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_CONTROL, and isccc_ccmsg::sock.

Referenced by control_recvmessage().

Here is the caller graph for this function:

◆ maybe_free_connection()

static void maybe_free_connection ( controlconnection_t *  conn)
static

Definition at line 162 of file controlconf.c.

References conn, isc_buffer_free(), ISC_LIST_UNLINK, isc_mem_put, ISC_SOCKCANCEL_SEND, isc_socket_cancel(), isc_timer_detach(), isccc_ccmsg_cancelread(), named_fuzz_notify(), ns_fuzz_rndc, and ns_g_fuzz_type.

Referenced by control_recvmessage(), control_senddone(), control_timeout(), and shutdown_listener().

Here is the caller graph for this function:

◆ maybe_free_listener()

static void maybe_free_listener ( controllistener_t *  listener)
static

Definition at line 154 of file controlconf.c.

References free_listener(), and ISC_LIST_EMPTY.

Referenced by control_recvmessage(), control_senddone(), and shutdown_listener().

Here is the caller graph for this function:

◆ newconnection()

static isc_result_t newconnection ( controllistener_t *  listener,
isc_socket_t sock 
)
static

◆ ns_controls_configure()

◆ ns_controls_create()

isc_result_t ns_controls_create ( ns_server_t server,
ns_controls_t **  ctrlsp 
)

Definition at line 1501 of file controlconf.c.

References ISC_LIST_INIT, isc_mem_get, isc_mem_put, ISC_R_NOMEMORY, ISC_R_SUCCESS, isccc_cc_createsymtab(), ns_controls::listeners, mctx, server, ns_controls::server, ns_controls::shuttingdown, and ns_controls::symtab.

Referenced by ns_server_create().

Here is the caller graph for this function:

◆ ns_controls_destroy()

void ns_controls_destroy ( ns_controls_t **  ctrlsp)

Definition at line 1522 of file controlconf.c.

References ISC_LIST_EMPTY, isc_mem_put, isccc_symtab_destroy(), ns_controls::listeners, ns_server::mctx, REQUIRE, ns_controls::server, and ns_controls::symtab.

Referenced by ns_server_destroy().

Here is the caller graph for this function:

◆ ns_controls_shutdown()

void ns_controls_shutdown ( ns_controls_t controls)

Definition at line 685 of file controlconf.c.

References controls_shutdown(), and ns_controls::shuttingdown.

Referenced by shutdown_server().

Here is the caller graph for this function:

◆ register_keys()

static void register_keys ( const cfg_obj_t control,
const cfg_obj_t keylist,
controlkeylist_t *  keyids,
isc_mem_t mctx,
const char *  socktext 
)
static

Definition at line 754 of file controlconf.c.

References cfg_map_get(), cfg_obj_asstring(), cfg_obj_log(), cfgkeylist_find(), free_controlkey(), INSIST, isc_base64_decodestring(), isc_buffer_base, isc_buffer_init, isc_buffer_usedlength, ISC_LIST_HEAD, ISC_LIST_NEXT, ISC_LIST_UNLINK, ISC_LOG_WARNING, isc_mem_get, ISC_R_SUCCESS, isc_result_totext(), keydef, keylist, mctx, ns_config_getkeyalgorithm2(), ns_g_lctx, and secret.

Referenced by add_listener(), and update_listener().

Here is the caller graph for this function:

◆ shutdown_listener()

static void shutdown_listener ( controllistener_t *  listener)
static

Definition at line 192 of file controlconf.c.

References conn, ISC_LIST_HEAD, ISC_LIST_NEXT, ISC_LIST_UNLINK, ISC_LOG_NOTICE, isc_log_write(), isc_sockaddr_format(), ISC_SOCKADDR_FORMATSIZE, ISC_SOCKCANCEL_ACCEPT, isc_socket_cancel(), isc_socket_cleanunix(), isc_sockettype_unix, maybe_free_connection(), maybe_free_listener(), ns_g_lctx, NS_LOGCATEGORY_GENERAL, and NS_LOGMODULE_CONTROL.

Referenced by control_newconn(), and controls_shutdown().

Here is the caller graph for this function:

◆ update_listener()

static void update_listener ( ns_controls_t cp,
controllistener_t **  listenerp,
const cfg_obj_t control,
const cfg_obj_t config,
isc_sockaddr_t addr,
cfg_aclconfctx_t aclconfctx,
const char *  socktext,
isc_sockettype_t  type 
)
static
ISC_R_SUCCESS
#define ISC_R_SUCCESS
Definition: dlz_minimal.h:58
cleanup
static void cleanup(void)
Definition: main.c:1345