|
unbound 0.1
|
Main program to start the DNS resolver daemon. More...
#include "config.h"#include <sys/time.h>#include "util/log.h"#include "daemon/daemon.h"#include "daemon/remote.h"#include "util/config_file.h"#include "util/storage/slabhash.h"#include "services/listen_dnsport.h"#include "services/cache/rrset.h"#include "services/cache/infra.h"#include "util/fptr_wlist.h"#include "util/data/msgreply.h"#include "util/module.h"#include "util/net_help.h"#include "util/ub_event.h"#include <signal.h>#include <fcntl.h>#include <openssl/crypto.h>#include <openssl/ssl.h>Functions | |
| static void | print_build_options (void) |
| print build options. | |
| static void | usage (void) |
| print usage. | |
| int | replay_var_compare (const void *ATTR_UNUSED(a), const void *ATTR_UNUSED(b)) |
| static void | checkrlimits (struct config_file *cfg) |
| check file descriptor count | |
| static void | apply_settings (struct daemon *daemon, struct config_file *cfg, int cmdline_verbose, int debug_mode) |
| set verbosity, check rlimits, cache settings | |
| static void | detach (void) |
| detach from command line | |
| static void | setup_sslctx_remote (struct daemon *daemon, struct config_file *cfg) |
| setup the remote and ticket keys | |
| static void | perform_setup (struct daemon *daemon, struct config_file *cfg, int debug_mode, const char **cfgfile, int need_pidfile) |
| daemonize, drop user privileges and chroot if needed | |
| static void | run_daemon (const char *cfgfile, int cmdline_verbose, int debug_mode, int need_pidfile) |
| Run the daemon. | |
| int | main (int argc, char *argv[]) |
| main program. | |
Variables | |
| int | optind |
| getopt global, in case header files fail to declare it. | |
| char * | optarg |
| getopt global, in case header files fail to declare it. | |
Main program to start the DNS resolver daemon.
|
static |
print build options.
References module_list_avail(), print_build_options(), ub_default_event_base(), ub_event_base_free(), and ub_get_event_sys().
Referenced by main(), and print_build_options().
|
static |
|
static |
check file descriptor count
References config_file::auto_trust_anchor_file_list, cfg_has_https(), checkrlimits(), config_file::dnscrypt, config_file::dnscrypt_nonce_cache_size, config_file::dnscrypt_shared_secret_cache_size, config_file::do_ip4, config_file::do_ip6, config_file::do_tcp, config_file::do_udp, fatal_exit(), config_file::http_query_buffer_size, config_file::http_response_buffer_size, config_file::if_automatic, config_file::incoming_num_tcp, config_file::infra_cache_numhosts, config_file::ip_ratelimit, config_file::ip_ratelimit_size, log_err(), log_warn(), config_file::module_conf, config_file::msg_cache_size, config_file::num_ifs, config_file::num_threads, config_file::outgoing_num_ports, config_file::outgoing_num_tcp, config_file::ratelimit, config_file::ratelimit_size, config_file::rrset_cache_size, config_file::stream_wait_size, config_file::trust_anchor_file_list, config_file::trust_anchor_list, config_file::trusted_keys_file_list, ub_event_get_version(), VERB_ALGO, and verbose().
Referenced by apply_settings(), and checkrlimits().
|
static |
set verbosity, check rlimits, cache settings
References apply_settings(), checkrlimits(), daemon_apply_cfg(), config_file::do_daemonize, log_ident_set_or_default(), config_file::log_identity, log_warn(), config_file::logfile, config_file::use_syslog, config_file::use_systemd, config_file::verbosity, and verbosity.
Referenced by apply_settings(), and run_daemon().
|
static |
detach from command line
References detach(), and fatal_exit().
Referenced by detach(), and perform_setup().
|
static |
setup the remote and ticket keys
References daemon_remote_create(), fatal_exit(), daemon::rc, and setup_sslctx_remote().
Referenced by perform_setup(), and setup_sslctx_remote().
|
static |
daemonize, drop user privileges and chroot if needed
References cfg_gid, cfg_uid, daemon::cfgfile, daemon::chroot, config_file::chrootdir, daemon_privileged(), detach(), config_file::directory, config_file::do_daemonize, fatal_exit(), fname_after_chroot(), log_err(), log_init(), log_warn(), config_file::logfile, perform_setup(), config_file::pidfile, daemon::pidfile, setup_sslctx_remote(), config_file::use_syslog, config_file::username, VERB_QUERY, and verbose().
Referenced by perform_setup(), and run_daemon().
|
static |
Run the daemon.
| cfgfile | the config file name. |
| cmdline_verbose | verbosity resulting from commandline -v. These increase verbosity as specified in the config file. |
| debug_mode | if set, do not daemonize. |
| need_pidfile | if false, no pidfile is checked or created. |
References apply_settings(), daemon::cfg, daemon::cfgfile, daemon::chroot, config_file::chrootdir, config_auto_slab_values(), config_create(), config_delete(), config_lookup_uid(), config_read(), daemon_cleanup(), daemon_delete(), daemon_fork(), daemon_init(), daemon_open_shared_ports(), fatal_exit(), log_init(), log_warn(), config_file::logfile, daemon::need_to_exit, perform_setup(), daemon::pidfile, run_daemon(), config_file::use_syslog, VERB_ALGO, VERB_OPS, and verbose().
Referenced by main(), and run_daemon().
| int main | ( | int | argc, |
| char * | argv[] ) |
main program.
Set options given commandline arguments.
| argc | number of commandline arguments. |
| argv | array of commandline arguments. |
References daemon::cfgfile, fatal_exit(), log_get_lock(), log_ident_set(), log_ident_set_default(), log_init(), main, optarg, optind, print_build_options(), run_daemon(), usage(), verbosity, and wsvc_command_option().
|
extern |