This file contains the remote control functionality for the daemon. More...
#include "util/locks.h"
Data Structures | |
struct | rc_state |
a busy control command connection, SSL state More... | |
struct | daemon_remote |
The remote control tool state. More... | |
struct | remote_stream |
Connection to print to, either SSL or plain over fd. More... | |
struct | fast_reload_printq |
Fast reload printout queue. More... | |
struct | fast_reload_auth_change |
Fast reload auth zone change. More... | |
struct | fast_reload_thread |
Fast reload thread structure. More... | |
Macros | |
#define | REMOTE_CONTROL_TCP_TIMEOUT 120000 |
number of milliseconds timeout on incoming remote control handshake | |
Typedefs | |
typedef struct remote_stream | RES |
Enumerations | |
enum | fast_reload_notification { fast_reload_notification_none = 0 , fast_reload_notification_done = 1 , fast_reload_notification_done_error = 2 , fast_reload_notification_exit = 3 , fast_reload_notification_exited = 4 , fast_reload_notification_printout = 5 , fast_reload_notification_reload_stop = 6 , fast_reload_notification_reload_ack = 7 , fast_reload_notification_reload_start = 8 , fast_reload_notification_reload_nopause_poll = 9 } |
Notification status. More... | |
Functions | |
struct daemon_remote * | daemon_remote_create (struct config_file *cfg) |
Create new remote control state for the daemon. | |
void | daemon_remote_delete (struct daemon_remote *rc) |
remote control state to delete. | |
void | daemon_remote_clear (struct daemon_remote *rc) |
remote control state to clear up. | |
struct listen_port * | daemon_remote_open_ports (struct config_file *cfg) |
Open and create listening ports for remote control. | |
int | daemon_remote_open_accept (struct daemon_remote *rc, struct listen_port *ports, struct worker *worker) |
Setup comm points for accepting remote control connections. | |
void | daemon_remote_stop_accept (struct daemon_remote *rc) |
Stop accept handlers for TCP (until enabled again) | |
void | daemon_remote_start_accept (struct daemon_remote *rc) |
Stop accept handlers for TCP (until enabled again) | |
void | daemon_remote_exec (struct worker *worker) |
Handle nonthreaded remote cmd execution. | |
void | fast_reload_thread_start (RES *ssl, struct worker *worker, struct rc_state *s, int fr_verb, int fr_nopause, int fr_drop_mesh) |
Start fast reload thread. | |
void | fast_reload_thread_stop (struct fast_reload_thread *fast_reload_thread) |
Stop fast reload thread. | |
void | fast_reload_service_cb (int fd, short bits, void *arg) |
fast reload thread commands to remote service thread event callback | |
int | fast_reload_client_callback (struct comm_point *c, void *arg, int err, struct comm_reply *rep) |
fast reload callback for the remote control client connection | |
void | fast_reload_printq_list_delete (struct fast_reload_printq *list) |
fast reload printq delete list | |
void | fast_reload_worker_pickup_changes (struct worker *worker) |
Pick up per worker changes after a fast reload. | |
This file contains the remote control functionality for the daemon.
The remote control can be performed using either the commandline unbound-control tool, or a SSLv3/TLS capable web browser. The channel is secured using SSLv3 or TLSv1, and certificates. Both the server and the client(control tool) have their own keys.
Notification status.
This is exchanged between the fast reload thread and the server thread, over the commpair sockets.
struct daemon_remote * daemon_remote_create | ( | struct config_file * | cfg | ) |
Create new remote control state for the daemon.
cfg | config file with key file settings. |
References config_file::control_ifs, config_file::control_use_cert, daemon_remote_delete(), config_strlist_head::first, log_err(), log_warn(), daemon_remote::max_active, config_strlist::next, options_remote_is_address(), config_file::remote_control_enable, and config_strlist::str.
Referenced by service_init().
void daemon_remote_delete | ( | struct daemon_remote * | rc | ) |
remote control state to delete.
rc | state to delete. |
References daemon_remote_clear(), and rc_state::rc.
Referenced by daemon_delete(), and daemon_remote_create().
void daemon_remote_clear | ( | struct daemon_remote * | rc | ) |
remote control state to clear up.
Busy and accept points are closed. Does not delete the rc itself, or the ssl context (with its keys).
rc | state to clear. |
References daemon_remote::accept_list, daemon_remote::active, daemon_remote::busy_list, rc_state::c, comm_point_delete(), listen_list_delete(), rc_state::next, rc_state::rc, and daemon_remote::worker.
Referenced by daemon_cleanup(), and daemon_remote_delete().
struct listen_port * daemon_remote_open_ports | ( | struct config_file * | cfg | ) |
Open and create listening ports for remote control.
cfg | config options. |
References add_open(), config_del_strarray(), config_file::control_ifs, config_file::control_port, config_file::do_ip4, config_file::do_ip6, config_strlist_head::first, listening_ports_free(), log_assert, config_file::remote_control_enable, and resolve_interface_names().
Referenced by daemon_open_shared_ports().
int daemon_remote_open_accept | ( | struct daemon_remote * | rc, |
struct listen_port * | ports, | ||
struct worker * | worker | ||
) |
Setup comm points for accepting remote control connections.
rc | state |
ports | already opened ports. |
worker | worker with communication base. and links to command channels. |
References accept_open(), listen_port::fd, log_err(), listen_port::next, and daemon_remote::worker.
Referenced by worker_init().
void daemon_remote_stop_accept | ( | struct daemon_remote * | rc | ) |
Stop accept handlers for TCP (until enabled again)
rc | state |
References daemon_remote::accept_list, listen_list::com, and listen_list::next.
Referenced by worker_stop_accept().
void daemon_remote_start_accept | ( | struct daemon_remote * | rc | ) |
Stop accept handlers for TCP (until enabled again)
rc | state |
References daemon_remote::accept_list, listen_list::com, and listen_list::next.
Referenced by worker_start_accept().
void daemon_remote_exec | ( | struct worker * | worker | ) |
Handle nonthreaded remote cmd execution.
worker | this worker (the remote worker). |
References worker::cmd, execute_cmd(), log_err(), tube_read_msg(), VERB_ALGO, and verbose().
void fast_reload_thread_start | ( | RES * | ssl, |
struct worker * | worker, | ||
struct rc_state * | s, | ||
int | fr_verb, | ||
int | fr_nopause, | ||
int | fr_drop_mesh | ||
) |
Start fast reload thread.
ssl | the RES connection to print to. |
worker | the remote servicing worker. |
s | the rc_state that is servicing the remote control connection to the remote control client. It needs to be moved away to stay connected while the fast reload is running. |
fr_verb | verbosity to print output at. 0 is nothing, 1 is some and 2 is more detail. |
fr_nopause | option to not pause threads during reload. |
fr_drop_mesh | option to drop mesh queries. |
References daemon_remote::active, worker::base, daemon_remote::busy_list, rc_state::c, fast_reload_printq::client_cp, fast_reload_thread::commpair, worker::daemon, daemon::fast_reload_thread, fast_reload_thread_desetup(), fast_reload_thread_main(), fast_reload_thread_setup(), comm_point::fd, fd_set_nonblock(), fr_printq_create(), log_assert, log_err(), fast_reload_thread::printq, rc_state::rc, fast_reload_printq::remote, fast_reload_thread::service_event, fast_reload_thread::service_event_is_added, ssl_printf(), fast_reload_thread::started, state_list_remove_elem(), fast_reload_thread::tid, UB_EV_PERSIST, UB_EV_READ, ub_event_add(), and ub_event_new().
Referenced by do_fast_reload().
void fast_reload_thread_stop | ( | struct fast_reload_thread * | fast_reload_thread | ) |
Stop fast reload thread.
fast_reload_thread | the thread struct. |
References worker::daemon, daemon::fast_reload_thread, fr_main_perform_done(), fr_send_stop(), and fast_reload_thread::worker.
Referenced by daemon_cleanup().