main.c File Reference

#include <config.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <isc/app.h>
#include <isc/backtrace.h>
#include <isc/commandline.h>
#include <isc/dir.h>
#include <isc/entropy.h>
#include <isc/file.h>
#include <isc/hash.h>
#include <isc/os.h>
#include <isc/platform.h>
#include <isc/print.h>
#include <isc/resource.h>
#include <isc/stdio.h>
#include <isc/task.h>
#include <isc/timer.h>
#include <isc/util.h>
#include <isccc/result.h>
#include <dns/dispatch.h>
#include <dns/name.h>
#include <dns/result.h>
#include <dns/view.h>
#include <dst/result.h>
#include <dlz/dlz_dlopen_driver.h>
#include <named/builtin.h>
#include <named/control.h>
#include <named/globals.h>
#include <named/interfacemgr.h>
#include <named/log.h>
#include <named/os.h>
#include <named/server.h>
#include <named/lwresd.h>
#include <named/main.h>
#include <named/seccomp.h>

Go to the source code of this file.

Data Structures

struct  flag_def

Defines

#define NS_MAIN   1
#define BACKTRACE_MAXFRAME   128

Functions

void ns_main_earlywarning (const char *format,...)
void ns_main_earlyfatal (const char *format,...)
static
ISC_PLATFORM_NORETURN_PRE void 
assertion_failed (const char *file, int line, isc_assertiontype_t type, const char *cond) ISC_PLATFORM_NORETURN_POST
static
ISC_PLATFORM_NORETURN_PRE void 
library_fatal_error (const char *file, int line, const char *format, va_list args) ISC_FORMAT_PRINTF(3
static void library_unexpected_error (const char *file, int line, const char *format, va_list args) ISC_FORMAT_PRINTF(3
static void lwresd_usage (void)
static void usage (void)
static void save_command_line (int argc, char *argv[])
static int parse_int (char *arg, const char *desc)
static void set_flags (const char *arg, struct flag_def *defs, unsigned int *ret)
static void parse_command_line (int argc, char *argv[])
static isc_result_t create_managers (void)
static void destroy_managers (void)
static void dump_symboltable (void)
static void setup (void)
static void cleanup (void)
void ns_main_setmemstats (const char *filename)
int main (int argc, char *argv[])

Variables

int isc_dscp_check_value
unsigned int dns_zone_mkey_hour
unsigned int dns_zone_mkey_day
unsigned int dns_zone_mkey_month
static isc_boolean_t want_stats = ISC_FALSE
static char program_name [ISC_DIR_NAMEMAX] = "named"
static char absolute_conffile [ISC_DIR_PATHMAX]
static char saved_command_line [512]
static char version [512]
static unsigned int maxsocks = 0
static int maxudp = 0
static
ISC_PLATFORM_NORETURN_PRE void 
ISC_PLATFORM_NORETURN_POST
static struct flag_def mem_debug_flags []
static char * memstats = NULL


Detailed Description

Definition in file main.c.


Define Documentation

#define NS_MAIN   1

Definition at line 66 of file main.c.

#define BACKTRACE_MAXFRAME   128

Definition at line 104 of file main.c.


Function Documentation

void ns_main_earlywarning ( const char *  format,
  ... 
)

Definition at line 121 of file main.c.

References isc_log_vwrite(), ISC_LOG_WARNING, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN, and program_name.

void ns_main_earlyfatal ( const char *  format,
  ... 
)

Definition at line 139 of file main.c.

References ISC_LOG_CRITICAL, isc_log_vwrite(), isc_log_write(), NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN, and program_name.

static void assertion_failed ( const char *  file,
int  line,
isc_assertiontype_t  type,
const char *  cond 
) [static]

Definition at line 166 of file main.c.

References BACKTRACE_MAXFRAME, isc_assertion_setcallback(), isc_assertion_typetotext(), isc_backtrace_getsymbol(), isc_backtrace_gettrace(), ISC_LOG_CRITICAL, isc_log_write(), ISC_R_SUCCESS, NS_LOGCATEGORY_GENERAL, and NS_LOGMODULE_MAIN.

Referenced by main().

static void library_fatal_error ( const char *  file,
int  line,
const char *  format,
va_list  args 
) [static]

Definition at line 240 of file main.c.

References isc_error_setfatal(), ISC_LOG_CRITICAL, isc_log_vwrite(), isc_log_write(), NS_LOGCATEGORY_GENERAL, and NS_LOGMODULE_MAIN.

Referenced by main().

static void static void library_unexpected_error ( const char *  file,
int  line,
const char *  format,
va_list  args 
) [static]

Definition at line 280 of file main.c.

References ISC_LOG_ERROR, isc_log_vwrite(), isc_log_write(), NS_LOGCATEGORY_GENERAL, and NS_LOGMODULE_MAIN.

Referenced by main().

static void lwresd_usage ( void   )  [static]

Definition at line 303 of file main.c.

Referenced by usage().

static void usage ( void   )  [static]

Definition at line 314 of file main.c.

References lwresd_usage().

static void save_command_line ( int  argc,
char *  argv[] 
) [static]

Definition at line 328 of file main.c.

References INSIST, ISC_FALSE, ISC_TRUE, and saved_command_line.

Referenced by parse_command_line().

static int parse_int ( char *  arg,
const char *  desc 
) [static]

Definition at line 371 of file main.c.

References ns_main_earlyfatal().

Referenced by parse_command_line().

static void set_flags ( const char *  arg,
struct flag_def defs,
unsigned int *  ret 
) [static]

Definition at line 399 of file main.c.

References ISC_FALSE, ISC_TRUE, flag_def::name, ns_main_earlyfatal(), and flag_def::value.

Referenced by parse_command_line().

static void parse_command_line ( int  argc,
char *  argv[] 
) [static]

Definition at line 430 of file main.c.

References dns_zone_mkey_day, dns_zone_mkey_hour, dns_zone_mkey_month, isc_commandline_argument, isc_commandline_errprint, isc_commandline_index, isc_commandline_option, isc_commandline_parse(), isc_dscp_check_value, ISC_FALSE, isc_mem_debugging, isc_mem_defaultflags, isc_net_disableipv4(), isc_net_disableipv6(), isc_net_probeipv4(), isc_net_probeipv6(), ISC_R_SUCCESS, ISC_TRUE, maxsocks, maxudp, mem_debug_flags, NS_MAIN_ARGS, ns_main_earlyfatal(), parse_int(), port, POST, save_command_line(), set_flags(), usage(), and want_stats.

Referenced by main().

static isc_result_t create_managers ( void   )  [static]

Definition at line 721 of file main.c.

References DNS_NAME_MAXWIRE, isc__socketmgr_maxudp(), isc_entropy_create(), isc_hash_create(), ISC_LOG_INFO, isc_log_write(), ISC_R_SUCCESS, ISC_R_UNEXPECTED, isc_result_totext(), isc_socketmgr_create2(), isc_socketmgr_getmaxsockets(), isc_taskmgr_create(), isc_timermgr_create(), maxsocks, maxudp, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER, and UNEXPECTED_ERROR.

static void destroy_managers ( void   )  [static]

Definition at line 806 of file main.c.

References isc_hash_destroy(), isc_socketmgr_destroy(), isc_taskmgr_destroy(), isc_timermgr_destroy(), and ns_lwresd_shutdown().

Referenced by cleanup().

static void dump_symboltable ( void   )  [static]

Definition at line 825 of file main.c.

References isc__backtrace_nsymbols, isc_backtrace_getsymbolfromindex(), ISC_LOG_DEBUG, isc_log_wouldlog(), isc_log_write(), ISC_R_SUCCESS, NS_LOGCATEGORY_GENERAL, and NS_LOGMODULE_MAIN.

Referenced by setup().

static void setup ( void   )  [static]

Definition at line 907 of file main.c.

References absolute_conffile, create_managers(), dlz_dlopen_init(), dump_symboltable(), isc_app_start(), isc_entropy_create(), isc_entropy_createfilesource(), isc_entropy_detach(), isc_file_absolutepath(), isc_file_isabsolute(), ISC_LOG_NOTICE, isc_log_write(), isc_mem_free, isc_os_ncpus(), ISC_PRINT_QUADFORMAT, ISC_R_SUCCESS, isc_resource_coresize, isc_resource_datasize, isc_resource_getlimit(), isc_resource_openfiles, isc_resource_stacksize, isc_result_totext(), ISC_TF, isc_time_now(), ns_builtin_init(), ns_g_boottime, ns_log_init(), NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN, ns_main_earlyfatal(), ns_main_earlywarning(), ns_os_adjustnofile(), ns_os_chroot(), ns_os_daemonize(), ns_os_inituserinfo(), ns_os_minprivs(), ns_os_opendevnull(), ns_os_tzset(), ns_server_create(), ns_smf_get_instance(), program_name, and saved_command_line.

Referenced by main().

static void cleanup ( void   )  [static]

Definition at line 1132 of file main.c.

References destroy_managers(), dlz_dlopen_clear(), dns_name_destroy(), isc_entropy_detach(), ISC_LOG_NOTICE, isc_log_write(), ns_builtin_deinit(), ns_log_shutdown(), NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN, and ns_server_destroy().

Referenced by acache_cleaner_init(), add_comment(), add_keydata_zone(), add_listener(), add_ns(), add_soa(), addclosest(), addnoqname(), cache_cleaner_init(), cfg_acl_fromconfig2(), cfg_aclconfctx_create(), cfg_create_list(), cfg_create_tuple(), cfg_parse_astring(), cfg_parse_boolean(), cfg_parse_bracketed_list(), cfg_parse_buffer(), cfg_parse_dscp(), cfg_parse_enum(), cfg_parse_file(), cfg_parse_kv_tuple(), cfg_parse_listelt(), cfg_parse_map(), cfg_parse_mapbody(), cfg_parse_netprefix(), cfg_parse_qstring(), cfg_parse_rawaddr(), cfg_parse_rawport(), cfg_parse_rpz_policy(), cfg_parse_spacelist(), cfg_parse_special(), cfg_parse_sstring(), cfg_parse_tuple(), cfg_parse_uint32(), cfg_parser_create(), cfg_parser_mapadd(), cfg_peektoken(), check_dbtype(), check_hints(), check_node(), check_nsec3param(), check_ttls(), check_viewconf(), cleartree(), client_request(), configure_alternates(), configure_forward(), configure_peer(), configure_rrl(), configure_session_key(), configure_staticstub(), configure_view(), configure_view_dnsseckeys(), configure_view_nametable(), configure_zone(), configure_zone_ssutable(), control_newconn(), control_recvmessage(), controlkeylist_fromcfg(), create_empty_zone(), create_managers(), create_map(), create_query(), create_string(), create_tcp_dispatch(), disable_algorithms(), disable_ds_digests(), dns64_reverse(), dns64_ttl(), dns_acache_create(), dns_acl_create(), dns_adb_cancelfind(), dns_badcache_add(), dns_badcache_init(), dns_client_addtrustedkey(), dns_client_create(), dns_client_createx2(), dns_client_setdlv(), dns_client_startrequest(), dns_client_startresolve(), dns_diff_print(), dns_dispatchmgr_setudp(), dns_dlz_writeablezone(), dns_fwdtable_add(), dns_fwdtable_addfwd(), dns_iptable_create(), dns_journal_print(), dns_keytable_totext(), dns_master_dump3(), dns_master_dumpinc3(), dns_master_loadbuffer(), dns_master_loadbufferinc(), dns_master_loadfile5(), dns_master_loadfileinc5(), dns_master_loadstream(), dns_master_loadstreaminc(), dns_message_buildopt(), dns_message_create(), dns_message_setopt(), dns_message_setquerytsig(), dns_ntatable_save(), dns_ntatable_totext(), dns_rbt_deserialize_tree(), dns_rbt_serialize_tree(), dns_request_createraw4(), dns_request_createvia4(), dns_resolver_disable_algorithm(), dns_resolver_disable_ds_digest(), dns_resolver_setmustbesecure(), dns_root_checkhints(), dns_test_begin(), dns_test_makeview(), dns_test_makezone(), dns_view_find2(), dns_view_findzonecut2(), dns_view_loadnta(), dns_view_saventa(), dns_zone_forwardupdate(), dns_zt_apply2(), do_addzone(), do_modzone(), dst_gssapi_acquirecred(), dst_key_read_public(), dst_lib_destroy(), dstkey_fromconfig(), dumpctx_create(), dumpdone(), dumptostreaminc(), fetch_name(), generate(), generate_session_key(), get_rndckey(), getquestions(), getsection(), got_transfer_quota(), grow_entries(), grow_names(), integrity_checks(), isc__app_ctxstart(), isc_httpdmgr_create(), isc_test_begin(), keyfetch_done(), list_keynames(), load_configuration(), load_new_zones(), load_raw(), load_text(), load_view_keys(), load_zone(), load_zones(), loadzonekeys(), log_nsid(), main(), mkey_dumpzone(), mkey_refresh(), mkey_status(), modrdataset(), mustbesecure(), ncache_summary(), newconnection(), newzone_parse(), notify_createmessage(), notify_send(), notify_send_toaddr(), ns_add_reserved_dispatch(), ns_config_getipandkeylist(), ns_listenlist_default(), ns_listenlist_fromconfig(), ns_log_configure(), ns_log_init(), ns_log_setdefaultcategory(), ns_log_setdefaultchannels(), ns_log_setsafechannels(), ns_lwresd_configure(), ns_lwresd_parseeresolvconf(), ns_query(), ns_server_changezone(), ns_server_delzone(), ns_server_dumpdb(), ns_server_dumprecursing(), ns_server_dumpsecroots(), ns_server_dumpstats(), ns_server_mkeys(), ns_server_nta(), ns_server_showzone(), ns_server_signing(), ns_server_status(), ns_server_sync(), ns_server_testgen(), ns_server_tsigdelete(), ns_server_tsiglist(), ns_server_validation(), ns_server_zonestatus(), nzf_append(), nzf_remove(), opentmp(), parse2(), parse_addrmatchelt(), parse_any_named_map(), parse_boolorauto(), parse_enum_or_other(), parse_eof(), parse_list(), parse_logfile(), parse_logseverity(), parse_masterselement(), parse_matchname(), parse_matchtype(), parse_maybe_optional_keyvalue(), parse_netaddr(), parse_optional_class(), parse_optional_facility(), parse_optional_uint32(), parse_port(), parse_portrange(), parse_qstringornone(), parse_querysource(), parse_semicolon(), parse_server_key_kludge(), parse_serverid(), parse_sizeval(), parse_sockaddrnameport(), parse_sockaddrsub(), parse_symtab_elt(), parse_token(), parse_ttlval(), parse_unsupported(), parse_updatepolicy(), parse_ustring(), parser_openfile(), pk11_rand_seed_fromfile(), printmessage(), process_opt(), pushfile(), query_addadditional(), query_addadditional2(), query_addbestns(), query_addds(), query_addnoqnameproof(), query_addns(), query_addsoa(), query_addwildcardproof(), query_dns64(), query_filter64(), query_find(), query_iscachevalid(), read_confkey(), read_sessionkey(), reconfig(), record_found(), reload(), req_render(), resume_addnsec3chain(), resume_dslookup(), resume_signingwithkey(), rpz_rewrite(), serialize_node(), serialize_nodes(), set_nsec3params(), set_resigntime(), setsoaserial(), soa_query(), synczone(), tostruct_any_tsig(), tostruct_hinfo(), tostruct_hip(), tostruct_in_px(), tostruct_isdn(), tostruct_minfo(), tostruct_naptr(), tostruct_nsec(), tostruct_nsec3(), tostruct_nxt(), tostruct_openpgpkey(), tostruct_rp(), tostruct_rrsig(), tostruct_sig(), tostruct_soa(), tostruct_tkey(), towiresorted(), treefix(), validate_masters(), write_header(), zone_addnsec3chain(), zone_asyncload(), zone_check_dnskeys(), zone_from_args(), zone_load(), zone_nsec3chain(), zone_postload(), zone_saveunique(), zone_sign(), and zone_startload().

void ns_main_setmemstats ( const char *  filename  ) 

Definition at line 1171 of file main.c.

References free().

Referenced by load_configuration(), and main().

int main ( int  argc,
char *  argv[] 
)

Definition at line 1252 of file main.c.

References assertion_failed(), cleanup(), dns_result_register(), dst_result_register(), isc_app_finish(), isc_app_run(), isc_assertion_setcallback(), isc_error_setfatal(), isc_error_setunexpected(), isc_file_progname(), isc_mem_checkdestroyed(), isc_mem_create(), isc_mem_destroy(), isc_mem_free, isc_mem_setname(), isc_mem_stats(), isc_mutex_stats, ISC_R_RELOAD, ISC_R_SUCCESS, isc_result_totext(), isc_stdio_close(), isc_stdio_open(), ISC_TRUE, isccc_result_register(), library_fatal_error(), library_unexpected_error(), ns_main_earlyfatal(), ns_main_earlywarning(), ns_main_setmemstats(), ns_os_closedevnull(), ns_os_init(), ns_os_shutdown(), ns_server_reloadwanted(), ns_smf_get_instance(), parse_command_line(), pk11_result_register(), program_name, setup(), UNEXPECTED_ERROR, VERSION, version, and want_stats.


Variable Documentation

int isc_dscp_check_value

Definition at line 142 of file socket.c.

Referenced by build_msghdr_send(), and parse_command_line().

unsigned int dns_zone_mkey_hour

Definition at line 721 of file zone.c.

Referenced by keyfetch_done(), parse_command_line(), refresh_time(), and zone_refreshkeys().

unsigned int dns_zone_mkey_day

Definition at line 722 of file zone.c.

Referenced by parse_command_line(), and refresh_time().

unsigned int dns_zone_mkey_month

Definition at line 723 of file zone.c.

Referenced by keyfetch_done(), and parse_command_line().

isc_boolean_t want_stats = ISC_FALSE [static]

Definition at line 112 of file main.c.

Referenced by main(), and parse_command_line().

char program_name[ISC_DIR_NAMEMAX] = "named" [static]

Definition at line 113 of file main.c.

Referenced by main(), ns_main_earlyfatal(), ns_main_earlywarning(), and setup().

char absolute_conffile[ISC_DIR_PATHMAX] [static]

Definition at line 114 of file main.c.

Referenced by setup().

char saved_command_line[512] [static]

Definition at line 115 of file main.c.

Referenced by save_command_line(), and setup().

char version[512] [static]

Definition at line 116 of file main.c.

Referenced by allocate_version(), ATF_TC_BODY(), check_nsec3param(), check_ttls(), closeversion(), currentversion(), dash_option(), delete(), dump_done(), dumptostream(), fromtext_loc(), greatest_version(), isccc_cc_fromwire(), main(), newversion(), notify_createmessage(), parse_args(), pre_parse_args(), query_addadditional(), query_addadditional2(), query_addbestns(), query_find(), rbt_datawriter(), receive_secure_db(), redirect2(), resquery_response(), resquery_send(), resume_addnsec3chain(), resume_signingwithkey(), save_nsec3param(), serialize(), tostruct_loc(), usage(), zone_addnsec3chain(), zone_check_dnskeys(), zone_dump(), zone_get_from_db(), zone_gotwritehandle(), zone_notify(), zone_nsec3chain(), zone_resigninc(), and zone_sign().

unsigned int maxsocks = 0 [static]

Definition at line 117 of file main.c.

Referenced by create_managers(), load_configuration(), and parse_command_line().

int maxudp = 0 [static]

Definition at line 118 of file main.c.

Referenced by create_managers(), and parse_command_line().

ISC_PLATFORM_NORETURN_PRE void ISC_PLATFORM_NORETURN_POST

Definition at line 237 of file main.c.

struct flag_def mem_debug_flags[] [static]

Referenced by parse_command_line().

char* memstats = NULL [static]

Definition at line 1168 of file main.c.


Generated on Tue Apr 28 17:41:07 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha