#include <config.h>
#include <stdlib.h>
#include <isc/app.h>
#include <isc/buffer.h>
#include <isc/commandline.h>
#include <isc/file.h>
#include <isc/log.h>
#include <isc/net.h>
#include <isc/mem.h>
#include <isc/random.h>
#include <isc/socket.h>
#include <isc/stdtime.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/thread.h>
#include <isc/util.h>
#include <isccfg/namedconf.h>
#include <isccc/alist.h>
#include <isccc/base64.h>
#include <isccc/cc.h>
#include <isccc/ccmsg.h>
#include <isccc/result.h>
#include <isccc/sexpr.h>
#include <isccc/types.h>
#include <isccc/util.h>
#include <dns/name.h>
#include <bind9/getaddresses.h>
#include "util.h"
Go to the source code of this file.
Defines | |
#define | SERVERADDRS 10 |
Functions | |
static void | rndc_startconnect (isc_sockaddr_t *addr, isc_task_t *task) |
static ISC_PLATFORM_NORETURN_PRE void | usage (int status) ISC_PLATFORM_NORETURN_POST |
static void | get_addresses (const char *host, in_port_t port) |
static void | rndc_senddone (isc_task_t *task, isc_event_t *event) |
static void | rndc_recvdone (isc_task_t *task, isc_event_t *event) |
static void | rndc_recvnonce (isc_task_t *task, isc_event_t *event) |
static void | rndc_connected (isc_task_t *task, isc_event_t *event) |
static void | rndc_start (isc_task_t *task, isc_event_t *event) |
static void | parse_config (isc_mem_t *mctx, isc_log_t *log, const char *keyname, cfg_parser_t **pctxp, cfg_obj_t **configp) |
int | main (int argc, char **argv) |
Variables | |
const char * | progname |
isc_boolean_t | verbose |
static const char * | admin_conffile |
static const char * | admin_keyfile |
static const char * | version = VERSION |
static const char * | servername = NULL |
static isc_sockaddr_t | serveraddrs [SERVERADDRS] |
static isc_sockaddr_t | local4 |
static isc_sockaddr_t | local6 |
static isc_boolean_t | local4set = ISC_FALSE |
static isc_boolean_t | local6set = ISC_FALSE |
static int | nserveraddrs |
static int | currentaddr = 0 |
static unsigned int | remoteport = 0 |
static isc_socketmgr_t * | socketmgr = NULL |
static isc_buffer_t * | databuf |
static isccc_ccmsg_t | ccmsg |
static isc_uint32_t | algorithm |
static isccc_region_t | secret |
static isc_boolean_t | failed = ISC_FALSE |
static isc_boolean_t | c_flag = ISC_FALSE |
static isc_mem_t * | rndc_mctx |
static int | sends |
static int | recvs |
static int | connects |
static char * | command |
static char * | args |
static char | program [256] |
static isc_socket_t * | sock = NULL |
static isc_uint32_t | serial |
static isc_boolean_t | quiet = ISC_FALSE |
Definition in file rndc.c.
#define SERVERADDRS 10 |
static void rndc_startconnect | ( | isc_sockaddr_t * | addr, | |
isc_task_t * | task | |||
) | [static] |
Definition at line 447 of file rndc.c.
References AF_INET6, connects, DO, isc_sockaddr_format(), ISC_SOCKADDR_FORMATSIZE, isc_sockaddr_pf(), isc_socket_bind(), isc_socket_connect(), isc_socket_create(), isc_sockettype_tcp, isc_sockettype_unix, notify(), rndc_connected(), and servername.
Referenced by rndc_connected(), and rndc_start().
static void usage | ( | int | status | ) | [static] |
static void get_addresses | ( | const char * | host, | |
in_port_t | port | |||
) | [static] |
Definition at line 200 of file rndc.c.
References bind9_getaddresses(), fatal(), INSIST, ISC_R_SUCCESS, isc_result_totext(), isc_sockaddr_frompath(), nserveraddrs, and SERVERADDRS.
static void rndc_senddone | ( | isc_task_t * | task, | |
isc_event_t * | event | |||
) | [static] |
Definition at line 223 of file rndc.c.
References fatal(), isc_app_shutdown(), isc_event_free(), ISC_R_SUCCESS, isc_result_totext(), isc_socket_detach(), isc_task_shutdown(), recvs, isc_socketevent::result, RUNTIME_CHECK, sends, and UNUSED.
Referenced by rndc_connected(), and rndc_recvnonce().
static void rndc_recvdone | ( | isc_task_t * | task, | |
isc_event_t * | event | |||
) | [static] |
Definition at line 240 of file rndc.c.
References algorithm, isccc_ccmsg::buffer, command, DO, failed, fatal(), isc_app_shutdown(), isc_buffer_base, isc_buffer_used, isc_event_free(), ISC_R_EOF, ISC_R_NOTFOUND, ISC_R_SUCCESS, isc_result_totext(), isc_socket_detach(), isc_task_shutdown(), ISC_TRUE, isccc_alist_lookup(), isccc_cc_fromwire(), isccc_cc_lookupstring(), isccc_sexpr_free(), progname, quiet, recvs, isccc_region::rend, isccc_ccmsg::result, isccc_region::rstart, RUNTIME_CHECK, and sends.
Referenced by rndc_recvnonce().
static void rndc_recvnonce | ( | isc_task_t * | task, | |
isc_event_t * | event | |||
) | [static] |
Definition at line 299 of file rndc.c.
References algorithm, isc_region::base, isc_buffer::base, isccc_ccmsg::buffer, DO, fatal(), isc_buffer_add, isc_buffer_base, isc_buffer_clear, isc_buffer_init, isc_buffer_putuint32, isc_buffer_used, isc_event_free(), ISC_R_EOF, ISC_R_SUCCESS, isc_result_totext(), isc_socket_send(), isc_stdtime_get(), isccc_alist_lookup(), isccc_cc_createmessage(), isccc_cc_definestring(), isccc_cc_defineuint32(), isccc_cc_fromwire(), isccc_cc_lookupuint32(), isccc_cc_towire(), isccc_ccmsg_cancelread(), isccc_ccmsg_readmessage(), isccc_sexpr_free(), isc_region::length, now, r, recvs, isccc_region::rend, isccc_ccmsg::result, rndc_recvdone(), rndc_senddone(), isccc_region::rstart, sends, serial, and isc_buffer::used.
Referenced by rndc_connected().
static void rndc_connected | ( | isc_task_t * | task, | |
isc_event_t * | event | |||
) | [static] |
Definition at line 383 of file rndc.c.
References algorithm, isc_region::base, isc_buffer::base, connects, currentaddr, DO, fatal(), isc_buffer_add, isc_buffer_clear, isc_buffer_init, isc_buffer_putuint32, isc_event_free(), ISC_R_CANCELED, ISC_R_SUCCESS, isc_result_totext(), isc_sockaddr_format(), ISC_SOCKADDR_FORMATSIZE, isc_socket_detach(), isc_socket_send(), isc_stdtime_get(), isccc_alist_lookup(), isccc_cc_createmessage(), isccc_cc_definestring(), isccc_cc_towire(), isccc_ccmsg_init(), isccc_ccmsg_readmessage(), isccc_ccmsg_setmaxsize(), isc_region::length, notify(), now, nserveraddrs, r, recvs, isc_socketevent::result, rndc_recvnonce(), rndc_senddone(), rndc_startconnect(), sends, serial, and isc_buffer::used.
Referenced by rndc_startconnect().
static void rndc_start | ( | isc_task_t * | task, | |
isc_event_t * | event | |||
) | [static] |
Definition at line 480 of file rndc.c.
References currentaddr, isc_event_free(), and rndc_startconnect().
Referenced by main().
static void parse_config | ( | isc_mem_t * | mctx, | |
isc_log_t * | log, | |||
const char * | keyname, | |||
cfg_parser_t ** | pctxp, | |||
cfg_obj_t ** | configp | |||
) | [static] |
Definition at line 488 of file rndc.c.
References admin_conffile, admin_keyfile, algorithm, c_flag, cfg_list_first(), cfg_list_next(), cfg_listelt_value(), cfg_map_get(), cfg_map_getname(), cfg_obj_assockaddr(), cfg_obj_asstring(), cfg_obj_asuint32(), cfg_obj_issockaddr(), cfg_obj_isuint32(), cfg_parse_file(), cfg_parser_create(), cfg_tuple_get(), cfg_type_rndcconf, cfg_type_rndckey, DO, fatal(), get_addresses(), ISC_FALSE, isc_file_exists(), ISC_R_NOTFOUND, ISC_R_SUCCESS, isc_sockaddr_format(), ISC_SOCKADDR_FORMATSIZE, isc_sockaddr_getport(), isc_sockaddr_setport(), ISC_TRUE, ISC_UINT16_MAX, ISCCC_ALG_HMACMD5, ISCCC_ALG_HMACSHA1, ISCCC_ALG_HMACSHA224, ISCCC_ALG_HMACSHA256, ISCCC_ALG_HMACSHA384, ISCCC_ALG_HMACSHA512, isccc_base64_decode(), key, local4set, local6set, name, NS_CONTROL_PORT, nserveraddrs, remoteport, isccc_region::rend, isccc_region::rstart, SERVERADDRS, servername, and servers.
Referenced by main().
int main | ( | int | argc, | |
char ** | argv | |||
) |
Definition at line 742 of file rndc.c.
References admin_conffile, admin_keyfile, AF_INET6, c_flag, cfg_obj_destroy(), cfg_parser_destroy(), command, connects, dns_name_destroy(), DO, failed, fatal(), isc_logdestination::file, get_addresses(), INSIST, isc_app_onrun(), isc_app_run(), isc_app_start(), isc_buffer_allocate(), isc_buffer_free(), isc_commandline_argument, isc_commandline_errprint, isc_commandline_index, isc_commandline_option, isc_commandline_parse(), ISC_FALSE, isc_file_progname(), isc_log_create(), isc_log_createchannel(), isc_log_destroy(), ISC_LOG_INFO, ISC_LOG_PRINTLEVEL, ISC_LOG_PRINTTAG, ISC_LOG_ROLLNEVER, isc_log_setcontext(), isc_log_settag(), ISC_LOG_TOFILEDESC, isc_log_usechannel(), isc_mem_create(), isc_mem_debugging, ISC_MEM_DEBUGTRACE, isc_mem_destroy(), isc_mem_get, isc_mem_put, isc_mem_stats(), ISC_R_NOMEMORY, ISC_R_SUCCESS, isc_random_get(), isc_result_totext(), isc_sockaddr_any(), isc_sockaddr_any6(), isc_sockaddr_fromin(), isc_sockaddr_fromin6(), ISC_SOCKCANCEL_ALL, isc_socket_cancel(), isc_socketmgr_create(), isc_socketmgr_destroy(), isc_task_create(), isc_task_detach(), isc_taskmgr_create(), isc_taskmgr_destroy(), ISC_TRUE, isccc_ccmsg_invalidate(), isccc_result_register(), local4set, local6set, isc_logfile::maximum_size, isc_logfile::name, notify(), nserveraddrs, parse_config(), progname, program, quiet, recvs, remoteport, rndc_start(), sends, serial, servername, isc_logfile::stream, taskmgr, usage(), verbose, and isc_logfile::versions.
const char* admin_conffile [static] |
const char* admin_keyfile [static] |
const char* servername = NULL [static] |
Definition at line 68 of file rndc.c.
Referenced by main(), parse_config(), and rndc_startconnect().
isc_sockaddr_t serveraddrs[SERVERADDRS] [static] |
isc_sockaddr_t local4 [static] |
isc_sockaddr_t local6 [static] |
isc_boolean_t local4set = ISC_FALSE [static] |
isc_boolean_t local6set = ISC_FALSE [static] |
int nserveraddrs [static] |
Definition at line 72 of file rndc.c.
Referenced by get_addresses(), main(), parse_config(), and rndc_connected().
int currentaddr = 0 [static] |
unsigned int remoteport = 0 [static] |
isc_socketmgr_t* socketmgr = NULL [static] |
isc_buffer_t* databuf [static] |
Definition at line 76 of file rndc.c.
Referenced by dns_dnssec_sign(), dns_dnssec_signmessage(), dns_tsig_sign(), dns_tsig_verify(), report(), and tsig_verify_tcp().
isccc_ccmsg_t ccmsg [static] |
isc_uint32_t algorithm [static] |
Definition at line 78 of file rndc.c.
Referenced by bind9_check_key(), control_recvmessage(), fromwire_cdnskey(), fromwire_dnskey(), fromwire_key(), ISC_LIST(), parse_config(), read_confkey(), read_sessionkey(), restore_key(), rndc_connected(), rndc_recvdone(), rndc_recvnonce(), totext_cdnskey(), totext_dnskey(), totext_hip(), totext_key(), totext_keydata(), and update_action().
isccc_region_t secret [static] |
Definition at line 79 of file rndc.c.
Referenced by add_initial_keys(), check_options(), control_recvmessage(), dns_tkey_processdhresponse(), evaluate_key(), get_rndckey(), ISC_LIST(), process_dhtkey(), register_keys(), and setup_keystr().
isc_boolean_t failed = ISC_FALSE [static] |
isc_boolean_t c_flag = ISC_FALSE [static] |
int sends [static] |
Definition at line 83 of file rndc.c.
Referenced by main(), rndc_connected(), rndc_recvdone(), rndc_recvnonce(), and rndc_senddone().
int recvs [static] |
Definition at line 83 of file rndc.c.
Referenced by main(), rndc_connected(), rndc_recvdone(), rndc_recvnonce(), and rndc_senddone().
int connects [static] |
Definition at line 83 of file rndc.c.
Referenced by main(), rndc_connected(), and rndc_startconnect().
char* command [static] |
Definition at line 84 of file rndc.c.
Referenced by main(), ns_control_docommand(), and rndc_recvdone().
isc_socket_t* sock = NULL [static] |
Definition at line 87 of file rndc.c.
Referenced by add_listener(), client_sendpkg(), create_tcp_dispatch(), dispatch_createudp(), dns_dispatchset_cancelall(), dns_request_createraw4(), dns_request_createvia4(), dns_requestmgr_create(), exit_check(), fctx_cancelquery(), get_client(), get_dispsocket(), get_udpsocket(), listener_bind(), open_socket(), req_cancel(), req_getsocket(), req_send(), resquery_send(), and startrecv().
isc_uint32_t serial [static] |
Definition at line 88 of file rndc.c.
Referenced by check_for_more_data(), dash_option(), isccc_cc_createack(), isccc_cc_createresponse(), main(), ns_server_signing(), ns_server_zonestatus(), parse_args(), rndc_connected(), rndc_recvnonce(), and update_soa_serial().
isc_boolean_t quiet = ISC_FALSE [static] |