Lines Matching refs:ssl
214 if(p->ssl) in daemon_remote_clear()
215 SSL_free(p->ssl); in daemon_remote_clear()
467 n->ssl = SSL_new(rc->ctx); in remote_accept_callback()
468 if(!n->ssl) { in remote_accept_callback()
474 SSL_set_accept_state(n->ssl); in remote_accept_callback()
475 (void)SSL_set_mode(n->ssl, (long)SSL_MODE_AUTO_RETRY); in remote_accept_callback()
476 if(!SSL_set_fd(n->ssl, newfd)) { in remote_accept_callback()
478 SSL_free(n->ssl); in remote_accept_callback()
484 n->ssl = NULL; in remote_accept_callback()
517 if(s->ssl) { in clean_point()
518 SSL_shutdown(s->ssl); in clean_point()
519 SSL_free(s->ssl); in clean_point()
531 if(res->ssl) { in ssl_print_text()
533 if((r=SSL_write(res->ssl, text, (int)strlen(text))) <= 0) { in ssl_print_text()
535 if((r2=SSL_get_error(res->ssl, r)) == SSL_ERROR_ZERO_RETURN) { in ssl_print_text()
562 ssl_print_vmsg(RES* ssl, const char* format, va_list args) in ssl_print_vmsg() argument
566 return ssl_print_text(ssl, msg); in ssl_print_vmsg()
570 int ssl_printf(RES* ssl, const char* format, ...) in ssl_printf() argument
575 ret = ssl_print_vmsg(ssl, format, args); in ssl_printf()
588 if(res->ssl) { in ssl_read_line()
590 if((r=SSL_read(res->ssl, buf+len, 1)) <= 0) { in ssl_read_line()
592 if((r2=SSL_get_error(res->ssl, r)) == SSL_ERROR_ZERO_RETURN) { in ssl_read_line()
639 static void send_ok(RES* ssl) in send_ok() argument
641 (void)ssl_printf(ssl, "ok\n"); in send_ok()
646 distribute_cmd(struct daemon_remote* rc, RES* ssl, char* cmd) in distribute_cmd() argument
649 if(!cmd || !ssl) in distribute_cmd()
657 (void)ssl_printf(ssl, "error could not distribute cmd\n"); in distribute_cmd()
665 do_stop(RES* ssl, struct worker* worker) in do_stop() argument
669 send_ok(ssl); in do_stop()
674 do_reload(RES* ssl, struct worker* worker, int reuse_cache) in do_reload() argument
679 send_ok(ssl); in do_reload()
684 do_verbosity(RES* ssl, char* str) in do_verbosity() argument
688 ssl_printf(ssl, "error in verbosity number syntax: %s\n", str); in do_verbosity()
692 send_ok(ssl); in do_verbosity()
697 print_stats(RES* ssl, const char* nm, struct ub_stats_info* s) in print_stats() argument
700 if(!ssl_printf(ssl, "%s.num.queries"SQ"%lu\n", nm, in print_stats()
702 if(!ssl_printf(ssl, "%s.num.queries_ip_ratelimited"SQ"%lu\n", nm, in print_stats()
704 if(!ssl_printf(ssl, "%s.num.queries_cookie_valid"SQ"%lu\n", nm, in print_stats()
706 if(!ssl_printf(ssl, "%s.num.queries_cookie_client"SQ"%lu\n", nm, in print_stats()
708 if(!ssl_printf(ssl, "%s.num.queries_cookie_invalid"SQ"%lu\n", nm, in print_stats()
710 if(!ssl_printf(ssl, "%s.num.cachehits"SQ"%lu\n", nm, in print_stats()
713 if(!ssl_printf(ssl, "%s.num.cachemiss"SQ"%lu\n", nm, in print_stats()
715 if(!ssl_printf(ssl, "%s.num.prefetch"SQ"%lu\n", nm, in print_stats()
717 if(!ssl_printf(ssl, "%s.num.queries_timed_out"SQ"%lu\n", nm, in print_stats()
719 if(!ssl_printf(ssl, "%s.query.queue_time_us.max"SQ"%lu\n", nm, in print_stats()
721 if(!ssl_printf(ssl, "%s.num.expired"SQ"%lu\n", nm, in print_stats()
723 if(!ssl_printf(ssl, "%s.num.recursivereplies"SQ"%lu\n", nm, in print_stats()
726 if(!ssl_printf(ssl, "%s.num.dnscrypt.crypted"SQ"%lu\n", nm, in print_stats()
728 if(!ssl_printf(ssl, "%s.num.dnscrypt.cert"SQ"%lu\n", nm, in print_stats()
730 if(!ssl_printf(ssl, "%s.num.dnscrypt.cleartext"SQ"%lu\n", nm, in print_stats()
732 if(!ssl_printf(ssl, "%s.num.dnscrypt.malformed"SQ"%lu\n", nm, in print_stats()
735 if(!ssl_printf(ssl, "%s.requestlist.avg"SQ"%g\n", nm, in print_stats()
740 if(!ssl_printf(ssl, "%s.requestlist.max"SQ"%lu\n", nm, in print_stats()
742 if(!ssl_printf(ssl, "%s.requestlist.overwritten"SQ"%lu\n", nm, in print_stats()
744 if(!ssl_printf(ssl, "%s.requestlist.exceeded"SQ"%lu\n", nm, in print_stats()
746 if(!ssl_printf(ssl, "%s.requestlist.current.all"SQ"%lu\n", nm, in print_stats()
748 if(!ssl_printf(ssl, "%s.requestlist.current.user"SQ"%lu\n", nm, in print_stats()
755 if(!ssl_printf(ssl, "%s.recursion.time.avg"SQ ARG_LL "d.%6.6d\n", nm, in print_stats()
757 if(!ssl_printf(ssl, "%s.recursion.time.median"SQ"%g\n", nm, in print_stats()
759 if(!ssl_printf(ssl, "%s.tcpusage"SQ"%lu\n", nm, in print_stats()
766 print_thread_stats(RES* ssl, int i, struct ub_stats_info* s) in print_thread_stats() argument
771 return print_stats(ssl, nm, s); in print_thread_stats()
776 print_longnum(RES* ssl, const char* desc, size_t x) in print_longnum() argument
782 return ssl_printf(ssl, "%s%u%6.6u\n", desc, in print_longnum()
785 return ssl_printf(ssl, "%s%lu\n", desc, (unsigned long)x); in print_longnum()
791 print_mem(RES* ssl, struct worker* worker, struct daemon* daemon, in print_mem() argument
830 if(!print_longnum(ssl, "mem.cache.rrset"SQ, rrset)) in print_mem()
832 if(!print_longnum(ssl, "mem.cache.message"SQ, msg)) in print_mem()
834 if(!print_longnum(ssl, "mem.mod.iterator"SQ, iter)) in print_mem()
836 if(!print_longnum(ssl, "mem.mod.validator"SQ, val)) in print_mem()
838 if(!print_longnum(ssl, "mem.mod.respip"SQ, respip)) in print_mem()
841 if(!print_longnum(ssl, "mem.mod.subnet"SQ, subnet)) in print_mem()
845 if(!print_longnum(ssl, "mem.mod.ipsecmod"SQ, ipsecmod)) in print_mem()
849 if(!print_longnum(ssl, "mem.cache.dnscrypt_shared_secret"SQ, in print_mem()
852 if(!print_longnum(ssl, "mem.cache.dnscrypt_nonce"SQ, in print_mem()
857 if(!print_longnum(ssl, "mem.mod.dynlibmod"SQ, dynlib)) in print_mem()
860 if(!print_longnum(ssl, "mem.streamwait"SQ, in print_mem()
863 if(!print_longnum(ssl, "mem.http.query_buffer"SQ, in print_mem()
866 if(!print_longnum(ssl, "mem.http.response_buffer"SQ, in print_mem()
870 if(!print_longnum(ssl, "mem.quic"SQ, (size_t)s->svr.mem_quic)) in print_mem()
878 print_uptime(RES* ssl, struct worker* worker, int reset) in print_uptime() argument
886 if(!ssl_printf(ssl, "time.now"SQ ARG_LL "d.%6.6d\n", in print_uptime()
888 if(!ssl_printf(ssl, "time.up"SQ ARG_LL "d.%6.6d\n", in print_uptime()
890 if(!ssl_printf(ssl, "time.elapsed"SQ ARG_LL "d.%6.6d\n", in print_uptime()
897 print_hist(RES* ssl, struct ub_stats_info* s) in print_hist() argument
908 if(!ssl_printf(ssl, in print_hist()
925 print_ext(RES* ssl, struct ub_stats_info* s, int inhibit_zero) in print_ext() argument
951 if(!ssl_printf(ssl, "num.query.type.%s"SQ"%lu\n", in print_ext()
955 if(!ssl_printf(ssl, "num.query.type.other"SQ"%lu\n", in print_ext()
968 if(!ssl_printf(ssl, "num.query.class.%s"SQ"%lu\n", in print_ext()
972 if(!ssl_printf(ssl, "num.query.class.other"SQ"%lu\n", in print_ext()
985 if(!ssl_printf(ssl, "num.query.opcode.%s"SQ"%lu\n", in print_ext()
989 if(!ssl_printf(ssl, "num.query.tcp"SQ"%lu\n", in print_ext()
991 if(!ssl_printf(ssl, "num.query.tcpout"SQ"%lu\n", in print_ext()
993 if(!ssl_printf(ssl, "num.query.udpout"SQ"%lu\n", in print_ext()
995 if(!ssl_printf(ssl, "num.query.tls"SQ"%lu\n", in print_ext()
997 if(!ssl_printf(ssl, "num.query.tls.resume"SQ"%lu\n", in print_ext()
999 if(!ssl_printf(ssl, "num.query.ipv6"SQ"%lu\n", in print_ext()
1001 if(!ssl_printf(ssl, "num.query.https"SQ"%lu\n", in print_ext()
1004 if(!ssl_printf(ssl, "num.query.quic"SQ"%lu\n", in print_ext()
1008 if(!ssl_printf(ssl, "num.query.flags.QR"SQ"%lu\n", in print_ext()
1010 if(!ssl_printf(ssl, "num.query.flags.AA"SQ"%lu\n", in print_ext()
1012 if(!ssl_printf(ssl, "num.query.flags.TC"SQ"%lu\n", in print_ext()
1014 if(!ssl_printf(ssl, "num.query.flags.RD"SQ"%lu\n", in print_ext()
1016 if(!ssl_printf(ssl, "num.query.flags.RA"SQ"%lu\n", in print_ext()
1018 if(!ssl_printf(ssl, "num.query.flags.Z"SQ"%lu\n", in print_ext()
1020 if(!ssl_printf(ssl, "num.query.flags.AD"SQ"%lu\n", in print_ext()
1022 if(!ssl_printf(ssl, "num.query.flags.CD"SQ"%lu\n", in print_ext()
1024 if(!ssl_printf(ssl, "num.query.edns.present"SQ"%lu\n", in print_ext()
1026 if(!ssl_printf(ssl, "num.query.edns.DO"SQ"%lu\n", in print_ext()
1040 if(!ssl_printf(ssl, "num.answer.rcode.%s"SQ"%lu\n", in print_ext()
1044 if(!ssl_printf(ssl, "num.answer.rcode.nodata"SQ"%lu\n", in print_ext()
1048 if(!ssl_printf(ssl, "num.query.ratelimited"SQ"%lu\n", in print_ext()
1051 if(!ssl_printf(ssl, "num.answer.secure"SQ"%lu\n", in print_ext()
1053 if(!ssl_printf(ssl, "num.answer.bogus"SQ"%lu\n", in print_ext()
1055 if(!ssl_printf(ssl, "num.rrset.bogus"SQ"%lu\n", in print_ext()
1057 if(!ssl_printf(ssl, "num.query.aggressive.NOERROR"SQ"%lu\n", in print_ext()
1059 if(!ssl_printf(ssl, "num.query.aggressive.NXDOMAIN"SQ"%lu\n", in print_ext()
1062 if(!ssl_printf(ssl, "unwanted.queries"SQ"%lu\n", in print_ext()
1064 if(!ssl_printf(ssl, "unwanted.replies"SQ"%lu\n", in print_ext()
1067 if(!ssl_printf(ssl, "msg.cache.count"SQ"%u\n", in print_ext()
1069 if(!ssl_printf(ssl, "rrset.cache.count"SQ"%u\n", in print_ext()
1071 if(!ssl_printf(ssl, "infra.cache.count"SQ"%u\n", in print_ext()
1073 if(!ssl_printf(ssl, "key.cache.count"SQ"%u\n", in print_ext()
1076 if(!ssl_printf(ssl, "msg.cache.max_collisions"SQ"%u\n", in print_ext()
1078 if(!ssl_printf(ssl, "rrset.cache.max_collisions"SQ"%u\n", in print_ext()
1086 if(!ssl_printf(ssl, "num.rpz.action.%s"SQ"%lu\n", in print_ext()
1091 if(!ssl_printf(ssl, "dnscrypt_shared_secret.cache.count"SQ"%u\n", in print_ext()
1093 if(!ssl_printf(ssl, "dnscrypt_nonce.cache.count"SQ"%u\n", in print_ext()
1095 if(!ssl_printf(ssl, "num.query.dnscrypt.shared_secret.cachemiss"SQ"%lu\n", in print_ext()
1097 if(!ssl_printf(ssl, "num.query.dnscrypt.replay"SQ"%lu\n", in print_ext()
1100 if(!ssl_printf(ssl, "num.query.authzone.up"SQ"%lu\n", in print_ext()
1102 if(!ssl_printf(ssl, "num.query.authzone.down"SQ"%lu\n", in print_ext()
1105 if(!ssl_printf(ssl, "num.query.subnet"SQ"%lu\n", in print_ext()
1107 if(!ssl_printf(ssl, "num.query.subnet_cache"SQ"%lu\n", in print_ext()
1111 if(!ssl_printf(ssl, "num.query.cachedb"SQ"%lu\n", in print_ext()
1119 do_stats(RES* ssl, struct worker* worker, int reset) in do_stats() argument
1130 if(!print_thread_stats(ssl, i, &s)) in do_stats()
1138 if(!print_stats(ssl, "total", &total)) in do_stats()
1140 if(!print_uptime(ssl, worker, reset)) in do_stats()
1143 if(!print_mem(ssl, worker, daemon, &total)) in do_stats()
1145 if(!print_hist(ssl, &total)) in do_stats()
1147 if(!print_ext(ssl, &total, daemon->cfg->stat_inhibit_zero)) in do_stats()
1154 parse_arg_name(RES* ssl, char* str, uint8_t** res, size_t* len, int* labs) in parse_arg_name() argument
1163 ssl_printf(ssl, "error: this option requires a domain name\n"); in parse_arg_name()
1168 ssl_printf(ssl, "error cannot parse name %s at %d: %s\n", str, in parse_arg_name()
1175 ssl_printf(ssl, "error out of memory\n"); in parse_arg_name()
1184 find_arg2(RES* ssl, char* arg, char** arg2) in find_arg2() argument
1200 ssl_printf(ssl, "error could not find next argument " in find_arg2()
1209 perform_zone_add(RES* ssl, struct local_zones* zones, char* arg) in perform_zone_add() argument
1217 if(!find_arg2(ssl, arg, &arg2)) in perform_zone_add()
1219 if(!parse_arg_name(ssl, arg, &nm, &nmlen, &nmlabs)) in perform_zone_add()
1222 ssl_printf(ssl, "error not a zone type. %s\n", arg2); in perform_zone_add()
1240 ssl_printf(ssl, "error out of memory\n"); in perform_zone_add()
1249 do_zone_add(RES* ssl, struct local_zones* zones, char* arg) in do_zone_add() argument
1251 if(!perform_zone_add(ssl, zones, arg)) in do_zone_add()
1253 send_ok(ssl); in do_zone_add()
1258 do_zones_add(struct daemon_remote* rc, RES* ssl, struct worker* worker) in do_zones_add() argument
1263 while(ssl_read_line(ssl, buf+cmd_len, MAX_STDIN_STRLINE)) { in do_zones_add()
1269 if(rc) distribute_cmd(rc, ssl, buf); in do_zones_add()
1273 if(!perform_zone_add(ssl, worker->daemon->local_zones, in do_zones_add()
1275 if(!ssl_printf(ssl, "error for input line: %s\n", in do_zones_add()
1281 (void)ssl_printf(ssl, "added %d zones\n", num); in do_zones_add()
1286 perform_zone_remove(RES* ssl, struct local_zones* zones, char* arg) in perform_zone_remove() argument
1292 if(!parse_arg_name(ssl, arg, &nm, &nmlen, &nmlabs)) in perform_zone_remove()
1307 do_zone_remove(RES* ssl, struct local_zones* zones, char* arg) in do_zone_remove() argument
1309 if(!perform_zone_remove(ssl, zones, arg)) in do_zone_remove()
1311 send_ok(ssl); in do_zone_remove()
1316 do_zones_remove(struct daemon_remote* rc, RES* ssl, struct worker* worker) in do_zones_remove() argument
1321 while(ssl_read_line(ssl, buf+cmd_len, MAX_STDIN_STRLINE)) { in do_zones_remove()
1327 if(rc) distribute_cmd(rc, ssl, buf); in do_zones_remove()
1331 if(!perform_zone_remove(ssl, worker->daemon->local_zones, in do_zones_remove()
1333 if(!ssl_printf(ssl, "error for input line: %s\n", in do_zones_remove()
1339 (void)ssl_printf(ssl, "removed %d zones\n", num); in do_zones_remove()
1344 check_RR_syntax(RES* ssl, char* str, int line) in check_RR_syntax() argument
1355 if(!ssl_printf(ssl, "error parsing local-data at %sposition %d '%s': %s\n", in check_RR_syntax()
1366 perform_data_add(RES* ssl, struct local_zones* zones, char* arg, int line) in perform_data_add() argument
1368 if(!check_RR_syntax(ssl, arg, line)) { in perform_data_add()
1372 ssl_printf(ssl,"error in syntax or out of memory, %s\n", arg); in perform_data_add()
1380 do_data_add(RES* ssl, struct local_zones* zones, char* arg) in do_data_add() argument
1382 if(!perform_data_add(ssl, zones, arg, 0)) in do_data_add()
1384 send_ok(ssl); in do_data_add()
1389 do_datas_add(struct daemon_remote* rc, RES* ssl, struct worker* worker) in do_datas_add() argument
1394 while(ssl_read_line(ssl, buf+cmd_len, MAX_STDIN_STRLINE)) { in do_datas_add()
1400 if(rc) distribute_cmd(rc, ssl, buf); in do_datas_add()
1405 if(perform_data_add(ssl, worker->daemon->local_zones, in do_datas_add()
1409 (void)ssl_printf(ssl, "added %d datas\n", num); in do_datas_add()
1414 perform_data_remove(RES* ssl, struct local_zones* zones, char* arg) in perform_data_remove() argument
1419 if(!parse_arg_name(ssl, arg, &nm, &nmlen, &nmlabs)) in perform_data_remove()
1429 do_data_remove(RES* ssl, struct local_zones* zones, char* arg) in do_data_remove() argument
1431 if(!perform_data_remove(ssl, zones, arg)) in do_data_remove()
1433 send_ok(ssl); in do_data_remove()
1438 do_datas_remove(struct daemon_remote* rc, RES* ssl, struct worker* worker) in do_datas_remove() argument
1443 while(ssl_read_line(ssl, buf+cmd_len, MAX_STDIN_STRLINE)) { in do_datas_remove()
1449 if(rc) distribute_cmd(rc, ssl, buf); in do_datas_remove()
1453 if(!perform_data_remove(ssl, worker->daemon->local_zones, in do_datas_remove()
1455 if(!ssl_printf(ssl, "error for input line: %s\n", in do_datas_remove()
1461 (void)ssl_printf(ssl, "removed %d datas\n", num); in do_datas_remove()
1466 do_view_zone_add(RES* ssl, struct worker* worker, char* arg) in do_view_zone_add() argument
1470 if(!find_arg2(ssl, arg, &arg2)) in do_view_zone_add()
1475 ssl_printf(ssl,"no view with name: %s\n", arg); in do_view_zone_add()
1481 ssl_printf(ssl,"error out of memory\n"); in do_view_zone_add()
1493 do_zone_add(ssl, v->local_zones, arg2); in do_view_zone_add()
1499 do_view_zone_remove(RES* ssl, struct worker* worker, char* arg) in do_view_zone_remove() argument
1503 if(!find_arg2(ssl, arg, &arg2)) in do_view_zone_remove()
1508 ssl_printf(ssl,"no view with name: %s\n", arg); in do_view_zone_remove()
1513 send_ok(ssl); in do_view_zone_remove()
1516 do_zone_remove(ssl, v->local_zones, arg2); in do_view_zone_remove()
1522 do_view_data_add(RES* ssl, struct worker* worker, char* arg) in do_view_data_add() argument
1526 if(!find_arg2(ssl, arg, &arg2)) in do_view_data_add()
1531 ssl_printf(ssl,"no view with name: %s\n", arg); in do_view_data_add()
1537 ssl_printf(ssl,"error out of memory\n"); in do_view_data_add()
1541 do_data_add(ssl, v->local_zones, arg2); in do_view_data_add()
1547 do_view_datas_add(struct daemon_remote* rc, RES* ssl, struct worker* worker, in do_view_datas_add() argument
1557 ssl_printf(ssl,"no view with name: %s\n", arg); in do_view_datas_add()
1563 ssl_printf(ssl,"error out of memory\n"); in do_view_datas_add()
1570 while(ssl_read_line(ssl, buf+cmd_len, MAX_STDIN_STRLINE)) { in do_view_datas_add()
1576 if(rc) distribute_cmd(rc, ssl, buf); in do_view_datas_add()
1581 if(perform_data_add(ssl, v->local_zones, buf+cmd_len, line)) in do_view_datas_add()
1585 (void)ssl_printf(ssl, "added %d datas\n", num); in do_view_datas_add()
1590 do_view_data_remove(RES* ssl, struct worker* worker, char* arg) in do_view_data_remove() argument
1594 if(!find_arg2(ssl, arg, &arg2)) in do_view_data_remove()
1599 ssl_printf(ssl,"no view with name: %s\n", arg); in do_view_data_remove()
1604 send_ok(ssl); in do_view_data_remove()
1607 do_data_remove(ssl, v->local_zones, arg2); in do_view_data_remove()
1613 do_view_datas_remove(struct daemon_remote* rc, RES* ssl, struct worker* worker, in do_view_datas_remove() argument
1623 ssl_printf(ssl,"no view with name: %s\n", arg); in do_view_datas_remove()
1628 ssl_printf(ssl, "removed 0 datas\n"); in do_view_datas_remove()
1634 while(ssl_read_line(ssl, buf+cmd_len, MAX_STDIN_STRLINE)) { in do_view_datas_remove()
1640 if(rc) distribute_cmd(rc, ssl, buf); in do_view_datas_remove()
1644 if(!perform_data_remove(ssl, v->local_zones, buf+cmd_len)) { in do_view_datas_remove()
1645 if(!ssl_printf(ssl, "error for input line: %s\n", in do_view_datas_remove()
1652 (void)ssl_printf(ssl, "removed %d datas\n", num); in do_view_datas_remove()
1657 do_lookup(RES* ssl, struct worker* worker, char* arg) in do_lookup() argument
1662 if(!parse_arg_name(ssl, arg, &nm, &nmlen, &nmlabs)) in do_lookup()
1664 (void)print_deleg_lookup(ssl, worker, nm, nmlen, nmlabs); in do_lookup()
1701 parse_remcachedb(RES* ssl, char** arg, int* pc) in parse_remcachedb() argument
1707 if(!find_arg2(ssl, *arg, &arg2)) in parse_remcachedb()
1718 do_flush_type(RES* ssl, struct worker* worker, char* arg) in do_flush_type() argument
1726 if(!parse_remcachedb(ssl, &arg, &pc)) in do_flush_type()
1728 if(!find_arg2(ssl, arg, &arg2)) in do_flush_type()
1730 if(!parse_arg_name(ssl, arg, &nm, &nmlen, &nmlabs)) in do_flush_type()
1734 (void)ssl_printf(ssl, "error parsing RRset type: '%s'\n", arg2); in do_flush_type()
1741 send_ok(ssl); in do_flush_type()
1746 do_flush_stats(RES* ssl, struct worker* worker) in do_flush_stats() argument
1749 send_ok(ssl); in do_flush_stats()
1803 do_flush_infra(RES* ssl, struct worker* worker, char* arg) in do_flush_infra() argument
1810 send_ok(ssl); in do_flush_infra()
1814 (void)ssl_printf(ssl, "error parsing ip addr: '%s'\n", arg); in do_flush_infra()
1833 send_ok(ssl); in do_flush_infra()
1838 do_flush_requestlist(RES* ssl, struct worker* worker) in do_flush_requestlist() argument
1841 send_ok(ssl); in do_flush_requestlist()
1901 do_flush_zone(RES* ssl, struct worker* worker, char* arg) in do_flush_zone() argument
1908 if(!parse_remcachedb(ssl, &arg, &pc)) in do_flush_zone()
1910 if(!parse_arg_name(ssl, arg, &nm, &nmlen, &nmlabs)) in do_flush_zone()
1937 (void)ssl_printf(ssl, "ok removed %lu rrsets, %lu messages " in do_flush_zone()
1990 do_flush_bogus(RES* ssl, struct worker* worker, char* arg) in do_flush_bogus() argument
1994 if(!parse_remcachedb(ssl, &arg, &pc)) in do_flush_bogus()
2015 (void)ssl_printf(ssl, "ok removed %lu rrsets, %lu messages " in do_flush_bogus()
2076 do_flush_negative(RES* ssl, struct worker* worker, char* arg) in do_flush_negative() argument
2080 if(!parse_remcachedb(ssl, &arg, &pc)) in do_flush_negative()
2101 (void)ssl_printf(ssl, "ok removed %lu rrsets, %lu messages " in do_flush_negative()
2108 do_flush_name(RES* ssl, struct worker* w, char* arg) in do_flush_name() argument
2114 if(!parse_remcachedb(ssl, &arg, &pc)) in do_flush_name()
2116 if(!parse_arg_name(ssl, arg, &nm, &nmlen, &nmlabs)) in do_flush_name()
2132 send_ok(ssl); in do_flush_name()
2137 ssl_print_name_dp(RES* ssl, const char* str, uint8_t* nm, uint16_t dclass, in ssl_print_name_dp() argument
2147 if(!ssl_printf(ssl, "%s %s %s ", buf, (c?c:"CLASS??"), str)) { in ssl_print_name_dp()
2155 if(!ssl_printf(ssl, "%s%s", (f?" ":""), buf)) in ssl_print_name_dp()
2161 if(!ssl_printf(ssl, "%s%s", (f?" ":""), buf)) in ssl_print_name_dp()
2165 return ssl_printf(ssl, "\n"); in ssl_print_name_dp()
2171 print_root_fwds(RES* ssl, struct iter_forwards* fwds, uint8_t* root) in print_root_fwds() argument
2177 return ssl_printf(ssl, "off (using root hints)\n"); in print_root_fwds()
2181 if(!ssl_print_name_dp(ssl, NULL, root, LDNS_RR_CLASS_IN, dp)) { in print_root_fwds()
2191 parse_delegpt(RES* ssl, char* args, uint8_t* nm) in parse_delegpt() argument
2201 (void)ssl_printf(ssl, "error out of memory\n"); in parse_delegpt()
2217 (void)ssl_printf(ssl, "error cannot parse" in parse_delegpt()
2228 (void)ssl_printf(ssl, "error out of memory\n"); in parse_delegpt()
2242 (void)ssl_printf(ssl, "error out of memory\n"); in parse_delegpt()
2254 do_forward(RES* ssl, struct worker* worker, char* args) in do_forward() argument
2260 (void)ssl_printf(ssl, "error: structure not allocated\n"); in do_forward()
2264 (void)print_root_fwds(ssl, fwd, root); in do_forward()
2275 if(!(dp = parse_delegpt(ssl, args, root))) in do_forward()
2278 (void)ssl_printf(ssl, "error out of memory\n"); in do_forward()
2282 send_ok(ssl); in do_forward()
2286 parse_fs_args(RES* ssl, char* args, uint8_t** nm, struct delegpt** dp, in parse_fs_args() argument
2295 if(!find_arg2(ssl, args, &rest)) in parse_fs_args()
2305 (void)ssl_printf(ssl, "error: unknown option %s\n", args); in parse_fs_args()
2313 if(!find_arg2(ssl, args, &rest)) in parse_fs_args()
2318 if(!parse_arg_name(ssl, zonename, nm, &nmlen, &nmlabs)) in parse_fs_args()
2323 if(!(*dp = parse_delegpt(ssl, args, *nm))) { in parse_fs_args()
2333 do_forward_add(RES* ssl, struct worker* worker, char* args) in do_forward_add() argument
2340 if(!parse_fs_args(ssl, args, &nm, &dp, &insecure, NULL, &tls)) in do_forward_add()
2350 (void)ssl_printf(ssl, "error out of memory\n"); in do_forward_add()
2358 (void)ssl_printf(ssl, "error out of memory\n"); in do_forward_add()
2364 send_ok(ssl); in do_forward_add()
2369 do_forward_remove(RES* ssl, struct worker* worker, char* args) in do_forward_remove() argument
2375 if(!parse_fs_args(ssl, args, &nm, NULL, &insecure, NULL, NULL)) in do_forward_remove()
2385 send_ok(ssl); in do_forward_remove()
2390 do_stub_add(RES* ssl, struct worker* worker, char* args) in do_stub_add() argument
2397 if(!parse_fs_args(ssl, args, &nm, &dp, &insecure, &prime, &tls)) in do_stub_add()
2409 (void)ssl_printf(ssl, "error out of memory\n"); in do_stub_add()
2421 (void)ssl_printf(ssl, "error out of memory\n"); in do_stub_add()
2428 (void)ssl_printf(ssl, "error out of memory\n"); in do_stub_add()
2441 send_ok(ssl); in do_stub_add()
2446 do_stub_remove(RES* ssl, struct worker* worker, char* args) in do_stub_remove() argument
2452 if(!parse_fs_args(ssl, args, &nm, NULL, &insecure, NULL, NULL)) in do_stub_remove()
2465 send_ok(ssl); in do_stub_remove()
2470 do_insecure_add(RES* ssl, struct worker* worker, char* arg) in do_insecure_add() argument
2475 if(!parse_arg_name(ssl, arg, &nm, &nmlen, &nmlabs)) in do_insecure_add()
2480 (void)ssl_printf(ssl, "error out of memory\n"); in do_insecure_add()
2486 send_ok(ssl); in do_insecure_add()
2491 do_insecure_remove(RES* ssl, struct worker* worker, char* arg) in do_insecure_remove() argument
2496 if(!parse_arg_name(ssl, arg, &nm, &nmlen, &nmlabs)) in do_insecure_remove()
2502 send_ok(ssl); in do_insecure_remove()
2506 do_insecure_list(RES* ssl, struct worker* worker) in do_insecure_list() argument
2514 ssl_printf(ssl, "%s\n", buf); in do_insecure_list()
2522 do_status(RES* ssl, struct worker* worker) in do_status() argument
2526 if(!ssl_printf(ssl, "version: %s\n", PACKAGE_VERSION)) in do_status()
2528 if(!ssl_printf(ssl, "verbosity: %d\n", verbosity)) in do_status()
2530 if(!ssl_printf(ssl, "threads: %d\n", worker->daemon->num)) in do_status()
2532 if(!ssl_printf(ssl, "modules: %d [", worker->daemon->mods.num)) in do_status()
2535 if(!ssl_printf(ssl, " %s", worker->daemon->mods.mod[i]->name)) in do_status()
2538 if(!ssl_printf(ssl, " ]\n")) in do_status()
2541 if(!ssl_printf(ssl, "uptime: " ARG_LL "d seconds\n", (long long)uptime)) in do_status()
2543 if(!ssl_printf(ssl, "options:%s%s%s%s\n" , in do_status()
2550 if(!ssl_printf(ssl, "unbound (pid %d) is running...\n", in do_status()
2630 do_dump_requestlist(RES* ssl, struct worker* worker) in do_dump_requestlist() argument
2638 if(!ssl_printf(ssl, "thread #%d\n", worker->thread_num)) in do_dump_requestlist()
2640 if(!ssl_printf(ssl, "# type cl name seconds module status\n")) in do_dump_requestlist()
2651 if(!ssl_printf(ssl, "%3d %4s %2s %s %s %s\n", in do_dump_requestlist()
2669 RES* ssl; member
2699 if(!ssl_printf(a->ssl, "%s %s expired rto %d\n", ip_str, in dump_infra_host()
2707 if(!ssl_printf(a->ssl, "%s %s ttl %lu ping %d var %d rtt %d rto %d " in dump_infra_host()
2724 do_dump_infra(RES* ssl, struct worker* worker) in do_dump_infra() argument
2728 arg.ssl = ssl; in do_dump_infra()
2736 do_log_reopen(RES* ssl, struct worker* worker) in do_log_reopen() argument
2739 send_ok(ssl); in do_log_reopen()
2745 do_auth_zone_reload(RES* ssl, struct worker* worker, char* arg) in do_auth_zone_reload() argument
2754 if(!parse_arg_name(ssl, arg, &nm, &nmlen, &nmlabs)) in do_auth_zone_reload()
2773 (void)ssl_printf(ssl, "error no auth-zone %s\n", arg); in do_auth_zone_reload()
2781 (void)ssl_printf(ssl, "error failed to read %s\n", arg); in do_auth_zone_reload()
2792 (void)ssl_printf(ssl, "zone %s has no contents\n", arg); in do_auth_zone_reload()
2797 (void)ssl_printf(ssl, "error: no SOA in zone after read %s\n", arg); in do_auth_zone_reload()
2809 (void)ssl_printf(ssl, "error zonemd for %s failed: %s\n", in do_auth_zone_reload()
2815 (void)ssl_printf(ssl, "%s: %s\n", arg, reason); in do_auth_zone_reload()
2819 send_ok(ssl); in do_auth_zone_reload()
2824 do_auth_zone_transfer(RES* ssl, struct worker* worker, char* arg) in do_auth_zone_transfer() argument
2830 if(!parse_arg_name(ssl, arg, &nm, &nmlen, &nmlabs)) in do_auth_zone_transfer()
2834 (void)ssl_printf(ssl, "error zone xfr task not found %s\n", arg); in do_auth_zone_transfer()
2839 send_ok(ssl); in do_auth_zone_transfer()
2844 do_set_option(RES* ssl, struct worker* worker, char* arg) in do_set_option() argument
2847 if(!find_arg2(ssl, arg, &arg2)) in do_set_option()
2850 (void)ssl_printf(ssl, "error setting option\n"); in do_set_option()
2861 send_ok(ssl); in do_set_option()
2867 RES* ssl = (RES*)arg; in remote_get_opt_ssl() local
2868 (void)ssl_printf(ssl, "%s\n", line); in remote_get_opt_ssl()
2873 do_get_option(RES* ssl, struct worker* worker, char* arg) in do_get_option() argument
2876 r = config_get_option(worker->env.cfg, arg, remote_get_opt_ssl, ssl); in do_get_option()
2878 (void)ssl_printf(ssl, "error unknown option\n"); in do_get_option()
2885 do_list_forwards(RES* ssl, struct worker* worker) in do_list_forwards() argument
2906 if(!ssl_print_name_dp(ssl, (insecure?"forward +i":"forward"), in do_list_forwards()
2917 do_list_stubs(RES* ssl, struct worker* worker) in do_list_stubs() argument
2938 if(!ssl_print_name_dp(ssl, str, z->node.name, in do_list_stubs()
2949 do_list_auth_zones(RES* ssl, struct auth_zones* az) in do_list_auth_zones() argument
2966 if(!ssl_printf(ssl, "%s\t%s\n", buf, buf2)) { in do_list_auth_zones()
2979 do_list_local_zones(RES* ssl, struct local_zones* zones) in do_list_local_zones() argument
2987 if(!ssl_printf(ssl, "%s %s\n", buf, in do_list_local_zones()
3001 do_list_local_data(RES* ssl, struct worker* worker, struct local_zones* zones) in do_list_local_data() argument
3019 if(!ssl_printf(ssl, "BADRR\n")) { in do_list_local_data()
3025 if(!ssl_printf(ssl, "%s\n", s)) { in do_list_local_data()
3040 do_view_list_local_zones(RES* ssl, struct worker* worker, char* arg) in do_view_list_local_zones() argument
3045 ssl_printf(ssl,"no view with name: %s\n", arg); in do_view_list_local_zones()
3049 do_list_local_zones(ssl, v->local_zones); in do_view_list_local_zones()
3056 do_view_list_local_data(RES* ssl, struct worker* worker, char* arg) in do_view_list_local_data() argument
3061 ssl_printf(ssl,"no view with name: %s\n", arg); in do_view_list_local_data()
3065 do_list_local_data(ssl, worker, v->local_zones); in do_view_list_local_data()
3075 RES* ssl; member
3101 ssl_printf(a->ssl, "%s %d limit %d\n", buf, max, lim); in rate_list()
3119 ssl_printf(a->ssl, "%s %d limit %d\n", ip, max, lim); in ip_rate_list()
3124 do_ratelimit_list(RES* ssl, struct worker* worker, char* arg) in do_ratelimit_list() argument
3130 a.ssl = ssl; in do_ratelimit_list()
3143 do_ip_ratelimit_list(RES* ssl, struct worker* worker, char* arg) in do_ip_ratelimit_list() argument
3149 a.ssl = ssl; in do_ip_ratelimit_list()
3162 do_rpz_enable_disable(RES* ssl, struct worker* worker, char* arg, int enable) { in do_rpz_enable_disable() argument
3168 if (!parse_arg_name(ssl, arg, &nm, &nmlen, &nmlabs)) in do_rpz_enable_disable()
3180 (void) ssl_printf(ssl, "error no auth-zone %s\n", arg); in do_rpz_enable_disable()
3184 (void) ssl_printf(ssl, "error auth-zone %s not RPZ\n", arg); in do_rpz_enable_disable()
3194 send_ok(ssl); in do_rpz_enable_disable()
3199 do_rpz_enable(RES* ssl, struct worker* worker, char* arg) in do_rpz_enable() argument
3201 do_rpz_enable_disable(ssl, worker, arg, 1); in do_rpz_enable()
3206 do_rpz_disable(RES* ssl, struct worker* worker, char* arg) in do_rpz_disable() argument
3208 do_rpz_enable_disable(ssl, worker, arg, 0); in do_rpz_disable()
3214 cookie_secret_file_dump(RES* ssl, struct worker* worker) { in cookie_secret_file_dump() argument
3221 (void)ssl_printf(ssl, "error: no cookie secret file configured\n"); in cookie_secret_file_dump()
3228 (void)ssl_printf(ssl, "unable to open cookie secret file %s: %s", in cookie_secret_file_dump()
3256 do_activate_cookie_secret(RES* ssl, struct worker* worker) { in do_activate_cookie_secret() argument
3261 (void)ssl_printf(ssl, "error: no cookie secret file configured\n"); in do_activate_cookie_secret()
3265 (void)ssl_printf(ssl, "error: there are no cookie_secrets."); in do_activate_cookie_secret()
3272 (void)ssl_printf(ssl, "error: no staging cookie secret to activate\n"); in do_activate_cookie_secret()
3276 if(worker->thread_num == 0 && !cookie_secret_file_dump(ssl, worker)) { in do_activate_cookie_secret()
3278 (void)ssl_printf(ssl, "error: writing to cookie secret file: \"%s\"\n", in do_activate_cookie_secret()
3284 (void)cookie_secret_file_dump(ssl, worker); in do_activate_cookie_secret()
3286 send_ok(ssl); in do_activate_cookie_secret()
3291 do_drop_cookie_secret(RES* ssl, struct worker* worker) { in do_drop_cookie_secret() argument
3296 (void)ssl_printf(ssl, "error: no cookie secret file configured\n"); in do_drop_cookie_secret()
3300 (void)ssl_printf(ssl, "error: there are no cookie_secrets."); in do_drop_cookie_secret()
3307 (void)ssl_printf(ssl, "error: can not drop the currently active cookie secret\n"); in do_drop_cookie_secret()
3311 if(worker->thread_num == 0 && !cookie_secret_file_dump(ssl, worker)) { in do_drop_cookie_secret()
3313 (void)ssl_printf(ssl, "error: writing to cookie secret file: \"%s\"\n", in do_drop_cookie_secret()
3319 (void)cookie_secret_file_dump(ssl, worker); in do_drop_cookie_secret()
3321 send_ok(ssl); in do_drop_cookie_secret()
3326 do_add_cookie_secret(RES* ssl, struct worker* worker, char* arg) { in do_add_cookie_secret() argument
3332 (void)ssl_printf(ssl, "error: no cookie secret file configured\n"); in do_add_cookie_secret()
3338 (void)ssl_printf(ssl, "error: out of memory"); in do_add_cookie_secret()
3347 (void)ssl_printf(ssl, "error: missing argument (cookie_secret)\n"); in do_add_cookie_secret()
3353 (void)ssl_printf(ssl, "invalid cookie secret: invalid argument length\n"); in do_add_cookie_secret()
3354 (void)ssl_printf(ssl, "please provide a 128bit hex encoded secret\n"); in do_add_cookie_secret()
3362 (void)ssl_printf(ssl, "invalid cookie secret: parse error\n"); in do_add_cookie_secret()
3363 (void)ssl_printf(ssl, "please provide a 128bit hex encoded secret\n"); in do_add_cookie_secret()
3367 if(worker->thread_num == 0 && !cookie_secret_file_dump(ssl, worker)) { in do_add_cookie_secret()
3371 (void)ssl_printf(ssl, "error: writing to cookie secret file: \"%s\"\n", in do_add_cookie_secret()
3378 (void)cookie_secret_file_dump(ssl, worker); in do_add_cookie_secret()
3381 send_ok(ssl); in do_add_cookie_secret()
3386 do_print_cookie_secrets(RES* ssl, struct worker* worker) { in do_print_cookie_secrets() argument
3404 (void)ssl_printf(ssl, "active : %s\n", secret_hex); in do_print_cookie_secrets()
3406 (void)ssl_printf(ssl, "staging: %s\n", secret_hex); in do_print_cookie_secrets()
3408 (void)ssl_printf(ssl, "staging[%d]: %s\n", i, in do_print_cookie_secrets()
3424 execute_cmd(struct daemon_remote* rc, RES* ssl, char* cmd, in execute_cmd() argument
3430 do_stop(ssl, worker); in execute_cmd()
3433 do_reload(ssl, worker, 1); in execute_cmd()
3436 do_reload(ssl, worker, 0); in execute_cmd()
3439 do_stats(ssl, worker, 0); in execute_cmd()
3442 do_stats(ssl, worker, 1); in execute_cmd()
3445 do_status(ssl, worker); in execute_cmd()
3450 (void)ssl_printf(ssl, "dump_cache/load_cache is not " in execute_cmd()
3455 (void)dump_cache(ssl, worker); in execute_cmd()
3465 if(load_cache(ssl, worker)) send_ok(ssl); in execute_cmd()
3468 do_list_forwards(ssl, worker); in execute_cmd()
3471 do_list_stubs(ssl, worker); in execute_cmd()
3474 do_insecure_list(ssl, worker); in execute_cmd()
3477 do_list_local_zones(ssl, worker->daemon->local_zones); in execute_cmd()
3480 do_list_local_data(ssl, worker, worker->daemon->local_zones); in execute_cmd()
3483 do_view_list_local_zones(ssl, worker, skipwhite(p+21)); in execute_cmd()
3486 do_view_list_local_data(ssl, worker, skipwhite(p+20)); in execute_cmd()
3489 do_ratelimit_list(ssl, worker, p+14); in execute_cmd()
3492 do_ip_ratelimit_list(ssl, worker, p+17); in execute_cmd()
3495 do_list_auth_zones(ssl, worker->env.auth_zones); in execute_cmd()
3498 do_auth_zone_reload(ssl, worker, skipwhite(p+16)); in execute_cmd()
3501 do_auth_zone_transfer(ssl, worker, skipwhite(p+18)); in execute_cmd()
3505 if(rc) distribute_cmd(rc, ssl, cmd); in execute_cmd()
3506 do_insecure_add(ssl, worker, skipwhite(p+12)); in execute_cmd()
3510 if(rc) distribute_cmd(rc, ssl, cmd); in execute_cmd()
3511 do_insecure_remove(ssl, worker, skipwhite(p+15)); in execute_cmd()
3515 if(rc) distribute_cmd(rc, ssl, cmd); in execute_cmd()
3516 do_flush_stats(ssl, worker); in execute_cmd()
3520 if(rc) distribute_cmd(rc, ssl, cmd); in execute_cmd()
3521 do_flush_requestlist(ssl, worker); in execute_cmd()
3524 do_lookup(ssl, worker, skipwhite(p+6)); in execute_cmd()
3530 do_zones_remove(rc, ssl, worker); in execute_cmd()
3533 do_zones_add(rc, ssl, worker); in execute_cmd()
3536 do_datas_remove(rc, ssl, worker); in execute_cmd()
3539 do_datas_add(rc, ssl, worker); in execute_cmd()
3542 do_view_datas_remove(rc, ssl, worker, skipwhite(p+23)); in execute_cmd()
3545 do_view_datas_add(rc, ssl, worker, skipwhite(p+16)); in execute_cmd()
3548 do_print_cookie_secrets(ssl, worker); in execute_cmd()
3557 distribute_cmd(rc, ssl, cmd); in execute_cmd()
3561 do_verbosity(ssl, skipwhite(p+9)); in execute_cmd()
3563 do_zone_remove(ssl, worker->daemon->local_zones, skipwhite(p+17)); in execute_cmd()
3565 do_zone_add(ssl, worker->daemon->local_zones, skipwhite(p+10)); in execute_cmd()
3567 do_data_remove(ssl, worker->daemon->local_zones, skipwhite(p+17)); in execute_cmd()
3569 do_data_add(ssl, worker->daemon->local_zones, skipwhite(p+10)); in execute_cmd()
3571 do_forward_add(ssl, worker, skipwhite(p+11)); in execute_cmd()
3573 do_forward_remove(ssl, worker, skipwhite(p+14)); in execute_cmd()
3575 do_forward(ssl, worker, skipwhite(p+7)); in execute_cmd()
3577 do_stub_add(ssl, worker, skipwhite(p+8)); in execute_cmd()
3579 do_stub_remove(ssl, worker, skipwhite(p+11)); in execute_cmd()
3581 do_view_zone_remove(ssl, worker, skipwhite(p+22)); in execute_cmd()
3583 do_view_zone_add(ssl, worker, skipwhite(p+15)); in execute_cmd()
3585 do_view_data_remove(ssl, worker, skipwhite(p+22)); in execute_cmd()
3587 do_view_data_add(ssl, worker, skipwhite(p+15)); in execute_cmd()
3589 do_flush_zone(ssl, worker, skipwhite(p+10)); in execute_cmd()
3591 do_flush_type(ssl, worker, skipwhite(p+10)); in execute_cmd()
3593 do_flush_infra(ssl, worker, skipwhite(p+11)); in execute_cmd()
3595 do_flush_name(ssl, worker, skipwhite(p+5)); in execute_cmd()
3597 do_dump_requestlist(ssl, worker); in execute_cmd()
3599 do_dump_infra(ssl, worker); in execute_cmd()
3601 do_log_reopen(ssl, worker); in execute_cmd()
3603 do_set_option(ssl, worker, skipwhite(p+10)); in execute_cmd()
3605 do_get_option(ssl, worker, skipwhite(p+10)); in execute_cmd()
3607 do_flush_bogus(ssl, worker, skipwhite(p+11)); in execute_cmd()
3609 do_flush_negative(ssl, worker, skipwhite(p+14)); in execute_cmd()
3611 do_rpz_enable(ssl, worker, skipwhite(p+10)); in execute_cmd()
3613 do_rpz_disable(ssl, worker, skipwhite(p+11)); in execute_cmd()
3615 do_add_cookie_secret(ssl, worker, skipwhite(p+17)); in execute_cmd()
3617 do_drop_cookie_secret(ssl, worker); in execute_cmd()
3619 do_activate_cookie_secret(ssl, worker); in execute_cmd()
3621 (void)ssl_printf(ssl, "error unknown command '%s'\n", p); in execute_cmd()
3656 if(res->ssl) { in handle_req()
3658 if((r=SSL_read(res->ssl, magic, (int)sizeof(magic)-1)) <= 0) { in handle_req()
3660 if((r2=SSL_get_error(res->ssl, r)) == SSL_ERROR_ZERO_RETURN) in handle_req()
3748 if(s->ssl) { in remote_control_callback()
3751 r = SSL_do_handshake(s->ssl); in remote_control_callback()
3753 int r2 = SSL_get_error(s->ssl, r); in remote_control_callback()
3762 } else if(SSL_get_verify_result(s->ssl) == X509_V_OK) { in remote_control_callback()
3764 X509* x = SSL_get1_peer_certificate(s->ssl); in remote_control_callback()
3766 X509* x = SSL_get_peer_certificate(s->ssl); in remote_control_callback()
3784 res.ssl = s->ssl; in remote_control_callback()