Deleted Added
full compact
remote.c (266114) remote.c (276605)
1/*
2 * daemon/remote.c - remote control for the unbound daemon.
3 *
4 * Copyright (c) 2008, NLnet Labs. All rights reserved.
5 *
6 * This software is open source.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 24 unchanged lines hidden (view full) ---

33 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 */
35
36/**
37 * \file
38 *
39 * This file contains the remote control functionality for the daemon.
40 * The remote control can be performed using either the commandline
1/*
2 * daemon/remote.c - remote control for the unbound daemon.
3 *
4 * Copyright (c) 2008, NLnet Labs. All rights reserved.
5 *
6 * This software is open source.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 24 unchanged lines hidden (view full) ---

33 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 */
35
36/**
37 * \file
38 *
39 * This file contains the remote control functionality for the daemon.
40 * The remote control can be performed using either the commandline
41 * unbound-control tool, or a SSLv3/TLS capable web browser.
42 * The channel is secured using SSLv3 or TLSv1, and certificates.
41 * unbound-control tool, or a TLS capable web browser.
42 * The channel is secured using TLSv1, and certificates.
43 * Both the server and the client(control tool) have their own keys.
44 */
45#include "config.h"
46#ifdef HAVE_OPENSSL_ERR_H
47#include <openssl/err.h>
48#endif
49#include <ctype.h>
50#include "daemon/remote.h"

--- 98 unchanged lines hidden (view full) ---

149 return rc;
150 }
151 rc->ctx = SSL_CTX_new(SSLv23_server_method());
152 if(!rc->ctx) {
153 log_crypto_err("could not SSL_CTX_new");
154 free(rc);
155 return NULL;
156 }
43 * Both the server and the client(control tool) have their own keys.
44 */
45#include "config.h"
46#ifdef HAVE_OPENSSL_ERR_H
47#include <openssl/err.h>
48#endif
49#include <ctype.h>
50#include "daemon/remote.h"

--- 98 unchanged lines hidden (view full) ---

149 return rc;
150 }
151 rc->ctx = SSL_CTX_new(SSLv23_server_method());
152 if(!rc->ctx) {
153 log_crypto_err("could not SSL_CTX_new");
154 free(rc);
155 return NULL;
156 }
157 /* no SSLv2 because has defects */
157 /* no SSLv2, SSLv3 because has defects */
158 if(!(SSL_CTX_set_options(rc->ctx, SSL_OP_NO_SSLv2) & SSL_OP_NO_SSLv2)){
159 log_crypto_err("could not set SSL_OP_NO_SSLv2");
160 daemon_remote_delete(rc);
161 return NULL;
162 }
158 if(!(SSL_CTX_set_options(rc->ctx, SSL_OP_NO_SSLv2) & SSL_OP_NO_SSLv2)){
159 log_crypto_err("could not set SSL_OP_NO_SSLv2");
160 daemon_remote_delete(rc);
161 return NULL;
162 }
163 if(!(SSL_CTX_set_options(rc->ctx, SSL_OP_NO_SSLv3) & SSL_OP_NO_SSLv3)){
164 log_crypto_err("could not set SSL_OP_NO_SSLv3");
165 daemon_remote_delete(rc);
166 return NULL;
167 }
163 s_cert = fname_after_chroot(cfg->server_cert_file, cfg, 1);
164 s_key = fname_after_chroot(cfg->server_key_file, cfg, 1);
165 if(!s_cert || !s_key) {
166 log_err("out of memory in remote control fname");
167 goto setup_error;
168 }
169 verbose(VERB_ALGO, "setup SSL certificates");
170 if (!SSL_CTX_use_certificate_file(rc->ctx,s_cert,SSL_FILETYPE_PEM)) {

--- 382 unchanged lines hidden (view full) ---

553 return 0;
554}
555
556/** skip whitespace, return new pointer into string */
557static char*
558skipwhite(char* str)
559{
560 /* EOS \0 is not a space */
168 s_cert = fname_after_chroot(cfg->server_cert_file, cfg, 1);
169 s_key = fname_after_chroot(cfg->server_key_file, cfg, 1);
170 if(!s_cert || !s_key) {
171 log_err("out of memory in remote control fname");
172 goto setup_error;
173 }
174 verbose(VERB_ALGO, "setup SSL certificates");
175 if (!SSL_CTX_use_certificate_file(rc->ctx,s_cert,SSL_FILETYPE_PEM)) {

--- 382 unchanged lines hidden (view full) ---

558 return 0;
559}
560
561/** skip whitespace, return new pointer into string */
562static char*
563skipwhite(char* str)
564{
565 /* EOS \0 is not a space */
561 while( isspace(*str) )
566 while( isspace((unsigned char)*str) )
562 str++;
563 return str;
564}
565
566/** send the OK to the control client */
567static void send_ok(SSL* ssl)
568{
569 (void)ssl_printf(ssl, "ok\n");

--- 30 unchanged lines hidden (view full) ---

600 send_ok(ssl);
601}
602
603/** print stats from statinfo */
604static int
605print_stats(SSL* ssl, const char* nm, struct stats_info* s)
606{
607 struct timeval avg;
567 str++;
568 return str;
569}
570
571/** send the OK to the control client */
572static void send_ok(SSL* ssl)
573{
574 (void)ssl_printf(ssl, "ok\n");

--- 30 unchanged lines hidden (view full) ---

605 send_ok(ssl);
606}
607
608/** print stats from statinfo */
609static int
610print_stats(SSL* ssl, const char* nm, struct stats_info* s)
611{
612 struct timeval avg;
608 if(!ssl_printf(ssl, "%s.num.queries"SQ"%u\n", nm,
609 (unsigned)s->svr.num_queries)) return 0;
610 if(!ssl_printf(ssl, "%s.num.cachehits"SQ"%u\n", nm,
611 (unsigned)(s->svr.num_queries
613 if(!ssl_printf(ssl, "%s.num.queries"SQ"%lu\n", nm,
614 (unsigned long)s->svr.num_queries)) return 0;
615 if(!ssl_printf(ssl, "%s.num.cachehits"SQ"%lu\n", nm,
616 (unsigned long)(s->svr.num_queries
612 - s->svr.num_queries_missed_cache))) return 0;
617 - s->svr.num_queries_missed_cache))) return 0;
613 if(!ssl_printf(ssl, "%s.num.cachemiss"SQ"%u\n", nm,
614 (unsigned)s->svr.num_queries_missed_cache)) return 0;
615 if(!ssl_printf(ssl, "%s.num.prefetch"SQ"%u\n", nm,
616 (unsigned)s->svr.num_queries_prefetch)) return 0;
617 if(!ssl_printf(ssl, "%s.num.recursivereplies"SQ"%u\n", nm,
618 (unsigned)s->mesh_replies_sent)) return 0;
618 if(!ssl_printf(ssl, "%s.num.cachemiss"SQ"%lu\n", nm,
619 (unsigned long)s->svr.num_queries_missed_cache)) return 0;
620 if(!ssl_printf(ssl, "%s.num.prefetch"SQ"%lu\n", nm,
621 (unsigned long)s->svr.num_queries_prefetch)) return 0;
622 if(!ssl_printf(ssl, "%s.num.recursivereplies"SQ"%lu\n", nm,
623 (unsigned long)s->mesh_replies_sent)) return 0;
619 if(!ssl_printf(ssl, "%s.requestlist.avg"SQ"%g\n", nm,
620 (s->svr.num_queries_missed_cache+s->svr.num_queries_prefetch)?
621 (double)s->svr.sum_query_list_size/
622 (s->svr.num_queries_missed_cache+
623 s->svr.num_queries_prefetch) : 0.0)) return 0;
624 if(!ssl_printf(ssl, "%s.requestlist.avg"SQ"%g\n", nm,
625 (s->svr.num_queries_missed_cache+s->svr.num_queries_prefetch)?
626 (double)s->svr.sum_query_list_size/
627 (s->svr.num_queries_missed_cache+
628 s->svr.num_queries_prefetch) : 0.0)) return 0;
624 if(!ssl_printf(ssl, "%s.requestlist.max"SQ"%u\n", nm,
625 (unsigned)s->svr.max_query_list_size)) return 0;
626 if(!ssl_printf(ssl, "%s.requestlist.overwritten"SQ"%u\n", nm,
627 (unsigned)s->mesh_jostled)) return 0;
628 if(!ssl_printf(ssl, "%s.requestlist.exceeded"SQ"%u\n", nm,
629 (unsigned)s->mesh_dropped)) return 0;
630 if(!ssl_printf(ssl, "%s.requestlist.current.all"SQ"%u\n", nm,
631 (unsigned)s->mesh_num_states)) return 0;
632 if(!ssl_printf(ssl, "%s.requestlist.current.user"SQ"%u\n", nm,
633 (unsigned)s->mesh_num_reply_states)) return 0;
629 if(!ssl_printf(ssl, "%s.requestlist.max"SQ"%lu\n", nm,
630 (unsigned long)s->svr.max_query_list_size)) return 0;
631 if(!ssl_printf(ssl, "%s.requestlist.overwritten"SQ"%lu\n", nm,
632 (unsigned long)s->mesh_jostled)) return 0;
633 if(!ssl_printf(ssl, "%s.requestlist.exceeded"SQ"%lu\n", nm,
634 (unsigned long)s->mesh_dropped)) return 0;
635 if(!ssl_printf(ssl, "%s.requestlist.current.all"SQ"%lu\n", nm,
636 (unsigned long)s->mesh_num_states)) return 0;
637 if(!ssl_printf(ssl, "%s.requestlist.current.user"SQ"%lu\n", nm,
638 (unsigned long)s->mesh_num_reply_states)) return 0;
634 timeval_divide(&avg, &s->mesh_replies_sum_wait, s->mesh_replies_sent);
635 if(!ssl_printf(ssl, "%s.recursion.time.avg"SQ ARG_LL "d.%6.6d\n", nm,
636 (long long)avg.tv_sec, (int)avg.tv_usec)) return 0;
637 if(!ssl_printf(ssl, "%s.recursion.time.median"SQ"%g\n", nm,
638 s->mesh_time_median)) return 0;
639 return 1;
640}
641

--- 13 unchanged lines hidden (view full) ---

655{
656 if(x > 1024*1024*1024) {
657 /* more than a Gb */
658 size_t front = x / (size_t)1000000;
659 size_t back = x % (size_t)1000000;
660 return ssl_printf(ssl, "%s%u%6.6u\n", desc,
661 (unsigned)front, (unsigned)back);
662 } else {
639 timeval_divide(&avg, &s->mesh_replies_sum_wait, s->mesh_replies_sent);
640 if(!ssl_printf(ssl, "%s.recursion.time.avg"SQ ARG_LL "d.%6.6d\n", nm,
641 (long long)avg.tv_sec, (int)avg.tv_usec)) return 0;
642 if(!ssl_printf(ssl, "%s.recursion.time.median"SQ"%g\n", nm,
643 s->mesh_time_median)) return 0;
644 return 1;
645}
646

--- 13 unchanged lines hidden (view full) ---

660{
661 if(x > 1024*1024*1024) {
662 /* more than a Gb */
663 size_t front = x / (size_t)1000000;
664 size_t back = x % (size_t)1000000;
665 return ssl_printf(ssl, "%s%u%6.6u\n", desc,
666 (unsigned)front, (unsigned)back);
667 } else {
663 return ssl_printf(ssl, "%s%u\n", desc, (unsigned)x);
668 return ssl_printf(ssl, "%s%lu\n", desc, (unsigned long)x);
664 }
665}
666
667/** print mem stats */
668static int
669print_mem(SSL* ssl, struct worker* worker, struct daemon* daemon)
670{
671 int m;

--- 62 unchanged lines hidden (view full) ---

734 hist = timehist_setup();
735 if(!hist) {
736 log_err("out of memory");
737 return 0;
738 }
739 timehist_import(hist, s->svr.hist, NUM_BUCKETS_HIST);
740 for(i=0; i<hist->num; i++) {
741 if(!ssl_printf(ssl,
669 }
670}
671
672/** print mem stats */
673static int
674print_mem(SSL* ssl, struct worker* worker, struct daemon* daemon)
675{
676 int m;

--- 62 unchanged lines hidden (view full) ---

739 hist = timehist_setup();
740 if(!hist) {
741 log_err("out of memory");
742 return 0;
743 }
744 timehist_import(hist, s->svr.hist, NUM_BUCKETS_HIST);
745 for(i=0; i<hist->num; i++) {
746 if(!ssl_printf(ssl,
742 "histogram.%6.6d.%6.6d.to.%6.6d.%6.6d=%u\n",
747 "histogram.%6.6d.%6.6d.to.%6.6d.%6.6d=%lu\n",
743 (int)hist->buckets[i].lower.tv_sec,
744 (int)hist->buckets[i].lower.tv_usec,
745 (int)hist->buckets[i].upper.tv_sec,
746 (int)hist->buckets[i].upper.tv_usec,
748 (int)hist->buckets[i].lower.tv_sec,
749 (int)hist->buckets[i].lower.tv_usec,
750 (int)hist->buckets[i].upper.tv_sec,
751 (int)hist->buckets[i].upper.tv_usec,
747 (unsigned)hist->buckets[i].count)) {
752 (unsigned long)hist->buckets[i].count)) {
748 timehist_delete(hist);
749 return 0;
750 }
751 }
752 timehist_delete(hist);
753 return 1;
754}
755

--- 20 unchanged lines hidden (view full) ---

776 snprintf(nm, sizeof(nm), "MAILA");
777 } else if (i == LDNS_RR_TYPE_MAILB) {
778 snprintf(nm, sizeof(nm), "MAILB");
779 } else if (i == LDNS_RR_TYPE_ANY) {
780 snprintf(nm, sizeof(nm), "ANY");
781 } else {
782 snprintf(nm, sizeof(nm), "TYPE%d", i);
783 }
753 timehist_delete(hist);
754 return 0;
755 }
756 }
757 timehist_delete(hist);
758 return 1;
759}
760

--- 20 unchanged lines hidden (view full) ---

781 snprintf(nm, sizeof(nm), "MAILA");
782 } else if (i == LDNS_RR_TYPE_MAILB) {
783 snprintf(nm, sizeof(nm), "MAILB");
784 } else if (i == LDNS_RR_TYPE_ANY) {
785 snprintf(nm, sizeof(nm), "ANY");
786 } else {
787 snprintf(nm, sizeof(nm), "TYPE%d", i);
788 }
784 if(!ssl_printf(ssl, "num.query.type.%s"SQ"%u\n",
785 nm, (unsigned)s->svr.qtype[i])) return 0;
789 if(!ssl_printf(ssl, "num.query.type.%s"SQ"%lu\n",
790 nm, (unsigned long)s->svr.qtype[i])) return 0;
786 }
787 if(!inhibit_zero || s->svr.qtype_big) {
791 }
792 if(!inhibit_zero || s->svr.qtype_big) {
788 if(!ssl_printf(ssl, "num.query.type.other"SQ"%u\n",
789 (unsigned)s->svr.qtype_big)) return 0;
793 if(!ssl_printf(ssl, "num.query.type.other"SQ"%lu\n",
794 (unsigned long)s->svr.qtype_big)) return 0;
790 }
791 /* CLASS */
792 for(i=0; i<STATS_QCLASS_NUM; i++) {
793 if(inhibit_zero && s->svr.qclass[i] == 0)
794 continue;
795 lt = sldns_lookup_by_id(sldns_rr_classes, i);
796 if(lt && lt->name) {
797 snprintf(nm, sizeof(nm), "%s", lt->name);
798 } else {
799 snprintf(nm, sizeof(nm), "CLASS%d", i);
800 }
795 }
796 /* CLASS */
797 for(i=0; i<STATS_QCLASS_NUM; i++) {
798 if(inhibit_zero && s->svr.qclass[i] == 0)
799 continue;
800 lt = sldns_lookup_by_id(sldns_rr_classes, i);
801 if(lt && lt->name) {
802 snprintf(nm, sizeof(nm), "%s", lt->name);
803 } else {
804 snprintf(nm, sizeof(nm), "CLASS%d", i);
805 }
801 if(!ssl_printf(ssl, "num.query.class.%s"SQ"%u\n",
802 nm, (unsigned)s->svr.qclass[i])) return 0;
806 if(!ssl_printf(ssl, "num.query.class.%s"SQ"%lu\n",
807 nm, (unsigned long)s->svr.qclass[i])) return 0;
803 }
804 if(!inhibit_zero || s->svr.qclass_big) {
808 }
809 if(!inhibit_zero || s->svr.qclass_big) {
805 if(!ssl_printf(ssl, "num.query.class.other"SQ"%u\n",
806 (unsigned)s->svr.qclass_big)) return 0;
810 if(!ssl_printf(ssl, "num.query.class.other"SQ"%lu\n",
811 (unsigned long)s->svr.qclass_big)) return 0;
807 }
808 /* OPCODE */
809 for(i=0; i<STATS_OPCODE_NUM; i++) {
810 if(inhibit_zero && s->svr.qopcode[i] == 0)
811 continue;
812 lt = sldns_lookup_by_id(sldns_opcodes, i);
813 if(lt && lt->name) {
814 snprintf(nm, sizeof(nm), "%s", lt->name);
815 } else {
816 snprintf(nm, sizeof(nm), "OPCODE%d", i);
817 }
812 }
813 /* OPCODE */
814 for(i=0; i<STATS_OPCODE_NUM; i++) {
815 if(inhibit_zero && s->svr.qopcode[i] == 0)
816 continue;
817 lt = sldns_lookup_by_id(sldns_opcodes, i);
818 if(lt && lt->name) {
819 snprintf(nm, sizeof(nm), "%s", lt->name);
820 } else {
821 snprintf(nm, sizeof(nm), "OPCODE%d", i);
822 }
818 if(!ssl_printf(ssl, "num.query.opcode.%s"SQ"%u\n",
819 nm, (unsigned)s->svr.qopcode[i])) return 0;
823 if(!ssl_printf(ssl, "num.query.opcode.%s"SQ"%lu\n",
824 nm, (unsigned long)s->svr.qopcode[i])) return 0;
820 }
821 /* transport */
825 }
826 /* transport */
822 if(!ssl_printf(ssl, "num.query.tcp"SQ"%u\n",
823 (unsigned)s->svr.qtcp)) return 0;
824 if(!ssl_printf(ssl, "num.query.ipv6"SQ"%u\n",
825 (unsigned)s->svr.qipv6)) return 0;
827 if(!ssl_printf(ssl, "num.query.tcp"SQ"%lu\n",
828 (unsigned long)s->svr.qtcp)) return 0;
829 if(!ssl_printf(ssl, "num.query.tcpout"SQ"%lu\n",
830 (unsigned long)s->svr.qtcp_outgoing)) return 0;
831 if(!ssl_printf(ssl, "num.query.ipv6"SQ"%lu\n",
832 (unsigned long)s->svr.qipv6)) return 0;
826 /* flags */
833 /* flags */
827 if(!ssl_printf(ssl, "num.query.flags.QR"SQ"%u\n",
828 (unsigned)s->svr.qbit_QR)) return 0;
829 if(!ssl_printf(ssl, "num.query.flags.AA"SQ"%u\n",
830 (unsigned)s->svr.qbit_AA)) return 0;
831 if(!ssl_printf(ssl, "num.query.flags.TC"SQ"%u\n",
832 (unsigned)s->svr.qbit_TC)) return 0;
833 if(!ssl_printf(ssl, "num.query.flags.RD"SQ"%u\n",
834 (unsigned)s->svr.qbit_RD)) return 0;
835 if(!ssl_printf(ssl, "num.query.flags.RA"SQ"%u\n",
836 (unsigned)s->svr.qbit_RA)) return 0;
837 if(!ssl_printf(ssl, "num.query.flags.Z"SQ"%u\n",
838 (unsigned)s->svr.qbit_Z)) return 0;
839 if(!ssl_printf(ssl, "num.query.flags.AD"SQ"%u\n",
840 (unsigned)s->svr.qbit_AD)) return 0;
841 if(!ssl_printf(ssl, "num.query.flags.CD"SQ"%u\n",
842 (unsigned)s->svr.qbit_CD)) return 0;
843 if(!ssl_printf(ssl, "num.query.edns.present"SQ"%u\n",
844 (unsigned)s->svr.qEDNS)) return 0;
845 if(!ssl_printf(ssl, "num.query.edns.DO"SQ"%u\n",
846 (unsigned)s->svr.qEDNS_DO)) return 0;
834 if(!ssl_printf(ssl, "num.query.flags.QR"SQ"%lu\n",
835 (unsigned long)s->svr.qbit_QR)) return 0;
836 if(!ssl_printf(ssl, "num.query.flags.AA"SQ"%lu\n",
837 (unsigned long)s->svr.qbit_AA)) return 0;
838 if(!ssl_printf(ssl, "num.query.flags.TC"SQ"%lu\n",
839 (unsigned long)s->svr.qbit_TC)) return 0;
840 if(!ssl_printf(ssl, "num.query.flags.RD"SQ"%lu\n",
841 (unsigned long)s->svr.qbit_RD)) return 0;
842 if(!ssl_printf(ssl, "num.query.flags.RA"SQ"%lu\n",
843 (unsigned long)s->svr.qbit_RA)) return 0;
844 if(!ssl_printf(ssl, "num.query.flags.Z"SQ"%lu\n",
845 (unsigned long)s->svr.qbit_Z)) return 0;
846 if(!ssl_printf(ssl, "num.query.flags.AD"SQ"%lu\n",
847 (unsigned long)s->svr.qbit_AD)) return 0;
848 if(!ssl_printf(ssl, "num.query.flags.CD"SQ"%lu\n",
849 (unsigned long)s->svr.qbit_CD)) return 0;
850 if(!ssl_printf(ssl, "num.query.edns.present"SQ"%lu\n",
851 (unsigned long)s->svr.qEDNS)) return 0;
852 if(!ssl_printf(ssl, "num.query.edns.DO"SQ"%lu\n",
853 (unsigned long)s->svr.qEDNS_DO)) return 0;
847
848 /* RCODE */
849 for(i=0; i<STATS_RCODE_NUM; i++) {
854
855 /* RCODE */
856 for(i=0; i<STATS_RCODE_NUM; i++) {
850 if(inhibit_zero && s->svr.ans_rcode[i] == 0)
857 /* Always include RCODEs 0-5 */
858 if(inhibit_zero && i > LDNS_RCODE_REFUSED && s->svr.ans_rcode[i] == 0)
851 continue;
852 lt = sldns_lookup_by_id(sldns_rcodes, i);
853 if(lt && lt->name) {
854 snprintf(nm, sizeof(nm), "%s", lt->name);
855 } else {
856 snprintf(nm, sizeof(nm), "RCODE%d", i);
857 }
859 continue;
860 lt = sldns_lookup_by_id(sldns_rcodes, i);
861 if(lt && lt->name) {
862 snprintf(nm, sizeof(nm), "%s", lt->name);
863 } else {
864 snprintf(nm, sizeof(nm), "RCODE%d", i);
865 }
858 if(!ssl_printf(ssl, "num.answer.rcode.%s"SQ"%u\n",
859 nm, (unsigned)s->svr.ans_rcode[i])) return 0;
866 if(!ssl_printf(ssl, "num.answer.rcode.%s"SQ"%lu\n",
867 nm, (unsigned long)s->svr.ans_rcode[i])) return 0;
860 }
861 if(!inhibit_zero || s->svr.ans_rcode_nodata) {
868 }
869 if(!inhibit_zero || s->svr.ans_rcode_nodata) {
862 if(!ssl_printf(ssl, "num.answer.rcode.nodata"SQ"%u\n",
863 (unsigned)s->svr.ans_rcode_nodata)) return 0;
870 if(!ssl_printf(ssl, "num.answer.rcode.nodata"SQ"%lu\n",
871 (unsigned long)s->svr.ans_rcode_nodata)) return 0;
864 }
865 /* validation */
872 }
873 /* validation */
866 if(!ssl_printf(ssl, "num.answer.secure"SQ"%u\n",
867 (unsigned)s->svr.ans_secure)) return 0;
868 if(!ssl_printf(ssl, "num.answer.bogus"SQ"%u\n",
869 (unsigned)s->svr.ans_bogus)) return 0;
870 if(!ssl_printf(ssl, "num.rrset.bogus"SQ"%u\n",
871 (unsigned)s->svr.rrset_bogus)) return 0;
874 if(!ssl_printf(ssl, "num.answer.secure"SQ"%lu\n",
875 (unsigned long)s->svr.ans_secure)) return 0;
876 if(!ssl_printf(ssl, "num.answer.bogus"SQ"%lu\n",
877 (unsigned long)s->svr.ans_bogus)) return 0;
878 if(!ssl_printf(ssl, "num.rrset.bogus"SQ"%lu\n",
879 (unsigned long)s->svr.rrset_bogus)) return 0;
872 /* threat detection */
880 /* threat detection */
873 if(!ssl_printf(ssl, "unwanted.queries"SQ"%u\n",
874 (unsigned)s->svr.unwanted_queries)) return 0;
875 if(!ssl_printf(ssl, "unwanted.replies"SQ"%u\n",
876 (unsigned)s->svr.unwanted_replies)) return 0;
881 if(!ssl_printf(ssl, "unwanted.queries"SQ"%lu\n",
882 (unsigned long)s->svr.unwanted_queries)) return 0;
883 if(!ssl_printf(ssl, "unwanted.replies"SQ"%lu\n",
884 (unsigned long)s->svr.unwanted_replies)) return 0;
885 /* cache counts */
886 if(!ssl_printf(ssl, "msg.cache.count"SQ"%u\n",
887 (unsigned)s->svr.msg_cache_count)) return 0;
888 if(!ssl_printf(ssl, "rrset.cache.count"SQ"%u\n",
889 (unsigned)s->svr.rrset_cache_count)) return 0;
890 if(!ssl_printf(ssl, "infra.cache.count"SQ"%u\n",
891 (unsigned)s->svr.infra_cache_count)) return 0;
892 if(!ssl_printf(ssl, "key.cache.count"SQ"%u\n",
893 (unsigned)s->svr.key_cache_count)) return 0;
877 return 1;
878}
879
880/** do the stats command */
881static void
882do_stats(SSL* ssl, struct daemon_remote* rc, int reset)
883{
884 struct daemon* daemon = rc->worker->daemon;

--- 188 unchanged lines hidden (view full) ---

1073 rrset_cache_remove(worker->env.rrset_cache, nm, nmlen, t, c, 0);
1074 if(t == LDNS_RR_TYPE_SOA)
1075 rrset_cache_remove(worker->env.rrset_cache, nm, nmlen, t, c,
1076 PACKED_RRSET_SOA_NEG);
1077 k.qname = nm;
1078 k.qname_len = nmlen;
1079 k.qtype = t;
1080 k.qclass = c;
894 return 1;
895}
896
897/** do the stats command */
898static void
899do_stats(SSL* ssl, struct daemon_remote* rc, int reset)
900{
901 struct daemon* daemon = rc->worker->daemon;

--- 188 unchanged lines hidden (view full) ---

1090 rrset_cache_remove(worker->env.rrset_cache, nm, nmlen, t, c, 0);
1091 if(t == LDNS_RR_TYPE_SOA)
1092 rrset_cache_remove(worker->env.rrset_cache, nm, nmlen, t, c,
1093 PACKED_RRSET_SOA_NEG);
1094 k.qname = nm;
1095 k.qname_len = nmlen;
1096 k.qtype = t;
1097 k.qclass = c;
1081 h = query_info_hash(&k);
1098 h = query_info_hash(&k, 0);
1082 slabhash_remove(worker->env.msg_cache, h, &k);
1099 slabhash_remove(worker->env.msg_cache, h, &k);
1100 if(t == LDNS_RR_TYPE_AAAA) {
1101 /* for AAAA also flush dns64 bit_cd packet */
1102 h = query_info_hash(&k, BIT_CD);
1103 slabhash_remove(worker->env.msg_cache, h, &k);
1104 }
1083}
1084
1085/** flush a type */
1086static void
1087do_flush_type(SSL* ssl, struct worker* worker, char* arg)
1088{
1089 uint8_t* nm;
1090 int nmlabs;

--- 190 unchanged lines hidden (view full) ---

1281 /* and validator cache */
1282 if(worker->env.key_cache) {
1283 slabhash_traverse(worker->env.key_cache->slab, 1,
1284 &zone_del_kcache, &inf);
1285 }
1286
1287 free(nm);
1288
1105}
1106
1107/** flush a type */
1108static void
1109do_flush_type(SSL* ssl, struct worker* worker, char* arg)
1110{
1111 uint8_t* nm;
1112 int nmlabs;

--- 190 unchanged lines hidden (view full) ---

1303 /* and validator cache */
1304 if(worker->env.key_cache) {
1305 slabhash_traverse(worker->env.key_cache->slab, 1,
1306 &zone_del_kcache, &inf);
1307 }
1308
1309 free(nm);
1310
1289 (void)ssl_printf(ssl, "ok removed %u rrsets, %u messages "
1290 "and %u key entries\n", (unsigned)inf.num_rrsets,
1291 (unsigned)inf.num_msgs, (unsigned)inf.num_keys);
1311 (void)ssl_printf(ssl, "ok removed %lu rrsets, %lu messages "
1312 "and %lu key entries\n", (unsigned long)inf.num_rrsets,
1313 (unsigned long)inf.num_msgs, (unsigned long)inf.num_keys);
1292}
1293
1294/** callback to delete bogus rrsets */
1295static void
1296bogus_del_rrset(struct lruhash_entry* e, void* arg)
1297{
1298 /* entry is locked */
1299 struct del_info* inf = (struct del_info*)arg;

--- 25 unchanged lines hidden (view full) ---

1325 struct del_info* inf = (struct del_info*)arg;
1326 struct key_entry_data* d = (struct key_entry_data*)e->data;
1327 if(d->isbad) {
1328 d->ttl = inf->expired;
1329 inf->num_keys++;
1330 }
1331}
1332
1314}
1315
1316/** callback to delete bogus rrsets */
1317static void
1318bogus_del_rrset(struct lruhash_entry* e, void* arg)
1319{
1320 /* entry is locked */
1321 struct del_info* inf = (struct del_info*)arg;

--- 25 unchanged lines hidden (view full) ---

1347 struct del_info* inf = (struct del_info*)arg;
1348 struct key_entry_data* d = (struct key_entry_data*)e->data;
1349 if(d->isbad) {
1350 d->ttl = inf->expired;
1351 inf->num_keys++;
1352 }
1353}
1354
1333/** remove all rrsets and keys from zone from cache */
1355/** remove all bogus rrsets, msgs and keys from cache */
1334static void
1335do_flush_bogus(SSL* ssl, struct worker* worker)
1336{
1337 struct del_info inf;
1338 /* what we do is to set them all expired */
1339 inf.worker = worker;
1340 inf.now = *worker->env.now;
1341 inf.expired = *worker->env.now;

--- 7 unchanged lines hidden (view full) ---

1349 slabhash_traverse(worker->env.msg_cache, 1, &bogus_del_msg, &inf);
1350
1351 /* and validator cache */
1352 if(worker->env.key_cache) {
1353 slabhash_traverse(worker->env.key_cache->slab, 1,
1354 &bogus_del_kcache, &inf);
1355 }
1356
1356static void
1357do_flush_bogus(SSL* ssl, struct worker* worker)
1358{
1359 struct del_info inf;
1360 /* what we do is to set them all expired */
1361 inf.worker = worker;
1362 inf.now = *worker->env.now;
1363 inf.expired = *worker->env.now;

--- 7 unchanged lines hidden (view full) ---

1371 slabhash_traverse(worker->env.msg_cache, 1, &bogus_del_msg, &inf);
1372
1373 /* and validator cache */
1374 if(worker->env.key_cache) {
1375 slabhash_traverse(worker->env.key_cache->slab, 1,
1376 &bogus_del_kcache, &inf);
1377 }
1378
1357 (void)ssl_printf(ssl, "ok removed %u rrsets, %u messages "
1358 "and %u key entries\n", (unsigned)inf.num_rrsets,
1359 (unsigned)inf.num_msgs, (unsigned)inf.num_keys);
1379 (void)ssl_printf(ssl, "ok removed %lu rrsets, %lu messages "
1380 "and %lu key entries\n", (unsigned long)inf.num_rrsets,
1381 (unsigned long)inf.num_msgs, (unsigned long)inf.num_keys);
1360}
1361
1382}
1383
1384/** callback to delete negative and servfail rrsets */
1385static void
1386negative_del_rrset(struct lruhash_entry* e, void* arg)
1387{
1388 /* entry is locked */
1389 struct del_info* inf = (struct del_info*)arg;
1390 struct ub_packed_rrset_key* k = (struct ub_packed_rrset_key*)e->key;
1391 struct packed_rrset_data* d = (struct packed_rrset_data*)e->data;
1392 /* delete the parentside negative cache rrsets,
1393 * these are namerserver rrsets that failed lookup, rdata empty */
1394 if((k->rk.flags & PACKED_RRSET_PARENT_SIDE) && d->count == 1 &&
1395 d->rrsig_count == 0 && d->rr_len[0] == 0) {
1396 d->ttl = inf->expired;
1397 inf->num_rrsets++;
1398 }
1399}
1400
1401/** callback to delete negative and servfail messages */
1402static void
1403negative_del_msg(struct lruhash_entry* e, void* arg)
1404{
1405 /* entry is locked */
1406 struct del_info* inf = (struct del_info*)arg;
1407 struct reply_info* d = (struct reply_info*)e->data;
1408 /* rcode not NOERROR: NXDOMAIN, SERVFAIL, ..: an nxdomain or error
1409 * or NOERROR rcode with ANCOUNT==0: a NODATA answer */
1410 if(FLAGS_GET_RCODE(d->flags) != 0 || d->an_numrrsets == 0) {
1411 d->ttl = inf->expired;
1412 inf->num_msgs++;
1413 }
1414}
1415
1416/** callback to delete negative key entries */
1417static void
1418negative_del_kcache(struct lruhash_entry* e, void* arg)
1419{
1420 /* entry is locked */
1421 struct del_info* inf = (struct del_info*)arg;
1422 struct key_entry_data* d = (struct key_entry_data*)e->data;
1423 /* could be bad because of lookup failure on the DS, DNSKEY, which
1424 * was nxdomain or servfail, and thus a result of negative lookups */
1425 if(d->isbad) {
1426 d->ttl = inf->expired;
1427 inf->num_keys++;
1428 }
1429}
1430
1431/** remove all negative(NODATA,NXDOMAIN), and servfail messages from cache */
1432static void
1433do_flush_negative(SSL* ssl, struct worker* worker)
1434{
1435 struct del_info inf;
1436 /* what we do is to set them all expired */
1437 inf.worker = worker;
1438 inf.now = *worker->env.now;
1439 inf.expired = *worker->env.now;
1440 inf.expired -= 3; /* handle 3 seconds skew between threads */
1441 inf.num_rrsets = 0;
1442 inf.num_msgs = 0;
1443 inf.num_keys = 0;
1444 slabhash_traverse(&worker->env.rrset_cache->table, 1,
1445 &negative_del_rrset, &inf);
1446
1447 slabhash_traverse(worker->env.msg_cache, 1, &negative_del_msg, &inf);
1448
1449 /* and validator cache */
1450 if(worker->env.key_cache) {
1451 slabhash_traverse(worker->env.key_cache->slab, 1,
1452 &negative_del_kcache, &inf);
1453 }
1454
1455 (void)ssl_printf(ssl, "ok removed %lu rrsets, %lu messages "
1456 "and %lu key entries\n", (unsigned long)inf.num_rrsets,
1457 (unsigned long)inf.num_msgs, (unsigned long)inf.num_keys);
1458}
1459
1362/** remove name rrset from cache */
1363static void
1364do_flush_name(SSL* ssl, struct worker* w, char* arg)
1365{
1366 uint8_t* nm;
1367 int nmlabs;
1368 size_t nmlen;
1369 if(!parse_arg_name(ssl, arg, &nm, &nmlen, &nmlabs))

--- 20 unchanged lines hidden (view full) ---

1390{
1391 char buf[257];
1392 struct delegpt_ns* ns;
1393 struct delegpt_addr* a;
1394 int f = 0;
1395 if(str) { /* print header for forward, stub */
1396 char* c = sldns_wire2str_class(dclass);
1397 dname_str(nm, buf);
1460/** remove name rrset from cache */
1461static void
1462do_flush_name(SSL* ssl, struct worker* w, char* arg)
1463{
1464 uint8_t* nm;
1465 int nmlabs;
1466 size_t nmlen;
1467 if(!parse_arg_name(ssl, arg, &nm, &nmlen, &nmlabs))

--- 20 unchanged lines hidden (view full) ---

1488{
1489 char buf[257];
1490 struct delegpt_ns* ns;
1491 struct delegpt_addr* a;
1492 int f = 0;
1493 if(str) { /* print header for forward, stub */
1494 char* c = sldns_wire2str_class(dclass);
1495 dname_str(nm, buf);
1398 if(!ssl_printf(ssl, "%s %s %s: ", buf, (c?c:"CLASS??"), str)) {
1496 if(!ssl_printf(ssl, "%s %s %s ", buf, (c?c:"CLASS??"), str)) {
1399 free(c);
1400 return 0;
1401 }
1402 free(c);
1403 }
1404 for(ns = dp->nslist; ns; ns = ns->next) {
1405 dname_str(ns->name, buf);
1406 if(!ssl_printf(ssl, "%s%s", (f?" ":""), buf))

--- 318 unchanged lines hidden (view full) ---

1725 if(!ssl_printf(ssl, " %s", worker->daemon->mods.mod[i]->name))
1726 return;
1727 }
1728 if(!ssl_printf(ssl, " ]\n"))
1729 return;
1730 uptime = (time_t)time(NULL) - (time_t)worker->daemon->time_boot.tv_sec;
1731 if(!ssl_printf(ssl, "uptime: " ARG_LL "d seconds\n", (long long)uptime))
1732 return;
1497 free(c);
1498 return 0;
1499 }
1500 free(c);
1501 }
1502 for(ns = dp->nslist; ns; ns = ns->next) {
1503 dname_str(ns->name, buf);
1504 if(!ssl_printf(ssl, "%s%s", (f?" ":""), buf))

--- 318 unchanged lines hidden (view full) ---

1823 if(!ssl_printf(ssl, " %s", worker->daemon->mods.mod[i]->name))
1824 return;
1825 }
1826 if(!ssl_printf(ssl, " ]\n"))
1827 return;
1828 uptime = (time_t)time(NULL) - (time_t)worker->daemon->time_boot.tv_sec;
1829 if(!ssl_printf(ssl, "uptime: " ARG_LL "d seconds\n", (long long)uptime))
1830 return;
1831 if(!ssl_printf(ssl, "options:%s%s\n" ,
1832 (worker->daemon->reuseport?" reuseport":""),
1833 (worker->daemon->rc->accept_list?" control(ssl)":"")))
1834 return;
1733 if(!ssl_printf(ssl, "unbound (pid %d) is running...\n",
1734 (int)getpid()))
1735 return;
1736}
1737
1738/** get age for the mesh state */
1739static void
1740get_mesh_age(struct mesh_state* m, char* buf, size_t len,

--- 106 unchanged lines hidden (view full) ---

1847/** structure for argument data for dump infra host */
1848struct infra_arg {
1849 /** the infra cache */
1850 struct infra_cache* infra;
1851 /** the SSL connection */
1852 SSL* ssl;
1853 /** the time now */
1854 time_t now;
1835 if(!ssl_printf(ssl, "unbound (pid %d) is running...\n",
1836 (int)getpid()))
1837 return;
1838}
1839
1840/** get age for the mesh state */
1841static void
1842get_mesh_age(struct mesh_state* m, char* buf, size_t len,

--- 106 unchanged lines hidden (view full) ---

1949/** structure for argument data for dump infra host */
1950struct infra_arg {
1951 /** the infra cache */
1952 struct infra_cache* infra;
1953 /** the SSL connection */
1954 SSL* ssl;
1955 /** the time now */
1956 time_t now;
1957 /** ssl failure? stop writing and skip the rest. If the tcp
1958 * connection is broken, and writes fail, we then stop writing. */
1959 int ssl_failed;
1855};
1856
1857/** callback for every host element in the infra cache */
1858static void
1859dump_infra_host(struct lruhash_entry* e, void* arg)
1860{
1861 struct infra_arg* a = (struct infra_arg*)arg;
1862 struct infra_key* k = (struct infra_key*)e->key;
1863 struct infra_data* d = (struct infra_data*)e->data;
1864 char ip_str[1024];
1865 char name[257];
1960};
1961
1962/** callback for every host element in the infra cache */
1963static void
1964dump_infra_host(struct lruhash_entry* e, void* arg)
1965{
1966 struct infra_arg* a = (struct infra_arg*)arg;
1967 struct infra_key* k = (struct infra_key*)e->key;
1968 struct infra_data* d = (struct infra_data*)e->data;
1969 char ip_str[1024];
1970 char name[257];
1971 if(a->ssl_failed)
1972 return;
1866 addr_to_str(&k->addr, k->addrlen, ip_str, sizeof(ip_str));
1867 dname_str(k->zonename, name);
1868 /* skip expired stuff (only backed off) */
1869 if(d->ttl < a->now) {
1870 if(d->rtt.rto >= USEFUL_SERVER_TOP_TIMEOUT) {
1871 if(!ssl_printf(a->ssl, "%s %s expired rto %d\n", ip_str,
1973 addr_to_str(&k->addr, k->addrlen, ip_str, sizeof(ip_str));
1974 dname_str(k->zonename, name);
1975 /* skip expired stuff (only backed off) */
1976 if(d->ttl < a->now) {
1977 if(d->rtt.rto >= USEFUL_SERVER_TOP_TIMEOUT) {
1978 if(!ssl_printf(a->ssl, "%s %s expired rto %d\n", ip_str,
1872 name, d->rtt.rto)) return;
1979 name, d->rtt.rto)) {
1980 a->ssl_failed = 1;
1981 return;
1982 }
1873 }
1874 return;
1875 }
1983 }
1984 return;
1985 }
1876 if(!ssl_printf(a->ssl, "%s %s ttl %d ping %d var %d rtt %d rto %d "
1986 if(!ssl_printf(a->ssl, "%s %s ttl %lu ping %d var %d rtt %d rto %d "
1877 "tA %d tAAAA %d tother %d "
1878 "ednsknown %d edns %d delay %d lame dnssec %d rec %d A %d "
1987 "tA %d tAAAA %d tother %d "
1988 "ednsknown %d edns %d delay %d lame dnssec %d rec %d A %d "
1879 "other %d\n", ip_str, name, (int)(d->ttl - a->now),
1989 "other %d\n", ip_str, name, (unsigned long)(d->ttl - a->now),
1880 d->rtt.srtt, d->rtt.rttvar, rtt_notimeout(&d->rtt), d->rtt.rto,
1881 d->timeout_A, d->timeout_AAAA, d->timeout_other,
1882 (int)d->edns_lame_known, (int)d->edns_version,
1883 (int)(a->now<d->probedelay?d->probedelay-a->now:0),
1884 (int)d->isdnsseclame, (int)d->rec_lame, (int)d->lame_type_A,
1990 d->rtt.srtt, d->rtt.rttvar, rtt_notimeout(&d->rtt), d->rtt.rto,
1991 d->timeout_A, d->timeout_AAAA, d->timeout_other,
1992 (int)d->edns_lame_known, (int)d->edns_version,
1993 (int)(a->now<d->probedelay?d->probedelay-a->now:0),
1994 (int)d->isdnsseclame, (int)d->rec_lame, (int)d->lame_type_A,
1885 (int)d->lame_other))
1995 (int)d->lame_other)) {
1996 a->ssl_failed = 1;
1886 return;
1997 return;
1998 }
1887}
1888
1889/** do the dump_infra command */
1890static void
1891do_dump_infra(SSL* ssl, struct worker* worker)
1892{
1893 struct infra_arg arg;
1894 arg.infra = worker->env.infra_cache;
1895 arg.ssl = ssl;
1896 arg.now = *worker->env.now;
1999}
2000
2001/** do the dump_infra command */
2002static void
2003do_dump_infra(SSL* ssl, struct worker* worker)
2004{
2005 struct infra_arg arg;
2006 arg.infra = worker->env.infra_cache;
2007 arg.ssl = ssl;
2008 arg.now = *worker->env.now;
2009 arg.ssl_failed = 0;
1897 slabhash_traverse(arg.infra->hosts, 0, &dump_infra_host, (void*)&arg);
1898}
1899
1900/** do the log_reopen command */
1901static void
1902do_log_reopen(SSL* ssl, struct worker* worker)
1903{
1904 struct config_file* cfg = worker->env.cfg;

--- 36 unchanged lines hidden (view full) ---

1941
1942/** do the list_forwards command */
1943static void
1944do_list_forwards(SSL* ssl, struct worker* worker)
1945{
1946 /* since its a per-worker structure no locks needed */
1947 struct iter_forwards* fwds = worker->env.fwds;
1948 struct iter_forward_zone* z;
2010 slabhash_traverse(arg.infra->hosts, 0, &dump_infra_host, (void*)&arg);
2011}
2012
2013/** do the log_reopen command */
2014static void
2015do_log_reopen(SSL* ssl, struct worker* worker)
2016{
2017 struct config_file* cfg = worker->env.cfg;

--- 36 unchanged lines hidden (view full) ---

2054
2055/** do the list_forwards command */
2056static void
2057do_list_forwards(SSL* ssl, struct worker* worker)
2058{
2059 /* since its a per-worker structure no locks needed */
2060 struct iter_forwards* fwds = worker->env.fwds;
2061 struct iter_forward_zone* z;
2062 struct trust_anchor* a;
2063 int insecure;
1949 RBTREE_FOR(z, struct iter_forward_zone*, fwds->tree) {
1950 if(!z->dp) continue; /* skip empty marker for stub */
2064 RBTREE_FOR(z, struct iter_forward_zone*, fwds->tree) {
2065 if(!z->dp) continue; /* skip empty marker for stub */
1951 if(!ssl_print_name_dp(ssl, "forward", z->name, z->dclass,
1952 z->dp))
2066
2067 /* see if it is insecure */
2068 insecure = 0;
2069 if(worker->env.anchors &&
2070 (a=anchor_find(worker->env.anchors, z->name,
2071 z->namelabs, z->namelen, z->dclass))) {
2072 if(!a->keylist && !a->numDS && !a->numDNSKEY)
2073 insecure = 1;
2074 lock_basic_unlock(&a->lock);
2075 }
2076
2077 if(!ssl_print_name_dp(ssl, (insecure?"forward +i":"forward"),
2078 z->name, z->dclass, z->dp))
1953 return;
1954 }
1955}
1956
1957/** do the list_stubs command */
1958static void
1959do_list_stubs(SSL* ssl, struct worker* worker)
1960{
1961 struct iter_hints_stub* z;
2079 return;
2080 }
2081}
2082
2083/** do the list_stubs command */
2084static void
2085do_list_stubs(SSL* ssl, struct worker* worker)
2086{
2087 struct iter_hints_stub* z;
2088 struct trust_anchor* a;
2089 int insecure;
2090 char str[32];
1962 RBTREE_FOR(z, struct iter_hints_stub*, &worker->env.hints->tree) {
2091 RBTREE_FOR(z, struct iter_hints_stub*, &worker->env.hints->tree) {
1963 if(!ssl_print_name_dp(ssl,
1964 z->noprime?"stub noprime":"stub prime", z->node.name,
2092
2093 /* see if it is insecure */
2094 insecure = 0;
2095 if(worker->env.anchors &&
2096 (a=anchor_find(worker->env.anchors, z->node.name,
2097 z->node.labs, z->node.len, z->node.dclass))) {
2098 if(!a->keylist && !a->numDS && !a->numDNSKEY)
2099 insecure = 1;
2100 lock_basic_unlock(&a->lock);
2101 }
2102
2103 snprintf(str, sizeof(str), "stub %sprime%s",
2104 (z->noprime?"no":""), (insecure?" +i":""));
2105 if(!ssl_print_name_dp(ssl, str, z->node.name,
1965 z->node.dclass, z->dp))
1966 return;
1967 }
1968}
1969
1970/** do the list_local_zones command */
1971static void
1972do_list_local_zones(SSL* ssl, struct worker* worker)
1973{
1974 struct local_zones* zones = worker->daemon->local_zones;
1975 struct local_zone* z;
1976 char buf[257];
1977 lock_rw_rdlock(&zones->lock);
1978 RBTREE_FOR(z, struct local_zone*, &zones->ztree) {
1979 lock_rw_rdlock(&z->lock);
1980 dname_str(z->name, buf);
2106 z->node.dclass, z->dp))
2107 return;
2108 }
2109}
2110
2111/** do the list_local_zones command */
2112static void
2113do_list_local_zones(SSL* ssl, struct worker* worker)
2114{
2115 struct local_zones* zones = worker->daemon->local_zones;
2116 struct local_zone* z;
2117 char buf[257];
2118 lock_rw_rdlock(&zones->lock);
2119 RBTREE_FOR(z, struct local_zone*, &zones->ztree) {
2120 lock_rw_rdlock(&z->lock);
2121 dname_str(z->name, buf);
1981 (void)ssl_printf(ssl, "%s %s\n", buf,
1982 local_zone_type2str(z->type));
2122 if(!ssl_printf(ssl, "%s %s\n", buf,
2123 local_zone_type2str(z->type))) {
2124 /* failure to print */
2125 lock_rw_unlock(&z->lock);
2126 lock_rw_unlock(&zones->lock);
2127 return;
2128 }
1983 lock_rw_unlock(&z->lock);
1984 }
1985 lock_rw_unlock(&zones->lock);
1986}
1987
1988/** do the list_local_data command */
1989static void
1990do_list_local_data(SSL* ssl, struct worker* worker)

--- 177 unchanged lines hidden (view full) ---

2168 } else if(cmdcmp(p, "log_reopen", 10)) {
2169 do_log_reopen(ssl, worker);
2170 } else if(cmdcmp(p, "set_option", 10)) {
2171 do_set_option(ssl, worker, skipwhite(p+10));
2172 } else if(cmdcmp(p, "get_option", 10)) {
2173 do_get_option(ssl, worker, skipwhite(p+10));
2174 } else if(cmdcmp(p, "flush_bogus", 11)) {
2175 do_flush_bogus(ssl, worker);
2129 lock_rw_unlock(&z->lock);
2130 }
2131 lock_rw_unlock(&zones->lock);
2132}
2133
2134/** do the list_local_data command */
2135static void
2136do_list_local_data(SSL* ssl, struct worker* worker)

--- 177 unchanged lines hidden (view full) ---

2314 } else if(cmdcmp(p, "log_reopen", 10)) {
2315 do_log_reopen(ssl, worker);
2316 } else if(cmdcmp(p, "set_option", 10)) {
2317 do_set_option(ssl, worker, skipwhite(p+10));
2318 } else if(cmdcmp(p, "get_option", 10)) {
2319 do_get_option(ssl, worker, skipwhite(p+10));
2320 } else if(cmdcmp(p, "flush_bogus", 11)) {
2321 do_flush_bogus(ssl, worker);
2322 } else if(cmdcmp(p, "flush_negative", 14)) {
2323 do_flush_negative(ssl, worker);
2176 } else {
2177 (void)ssl_printf(ssl, "error unknown command '%s'\n", p);
2178 }
2179}
2180
2181void
2182daemon_remote_exec(struct worker* worker)
2183{

--- 129 unchanged lines hidden ---
2324 } else {
2325 (void)ssl_printf(ssl, "error unknown command '%s'\n", p);
2326 }
2327}
2328
2329void
2330daemon_remote_exec(struct worker* worker)
2331{

--- 129 unchanged lines hidden ---