Home | History | Annotate | Download | only in smallapp

Lines Matching refs:cfg

101  * @param cfg: config
107 print_option(struct config_file* cfg, const char* opt, int final)
110 char *p = fname_after_chroot(cfg->pidfile, cfg, 1);
117 struct config_strlist* s = cfg->auto_trust_anchor_file_list;
119 char *p = fname_after_chroot(s->str, cfg, 1);
126 if(!config_get_option(cfg, opt, config_print_func, stdout))
132 check_mod(struct config_file* cfg, struct module_func_block* fb)
136 env.cfg = cfg;
167 donotquerylocalhostcheck(struct config_file* cfg)
169 if(cfg->donotquery_localhost) {
172 for(p=cfg->forwards; p; p=p->next) {
180 for(p=cfg->stubs; p; p=p->next) {
193 localzonechecks(struct config_file* cfg)
198 if(!local_zones_apply_cfg(zs, cfg))
205 acl_view_tag_checks(struct config_file* cfg, struct views* views)
215 for(acl=cfg->acl_view; acl; acl = acl->next) {
232 for(sb=cfg->acl_tags; sb; sb = sb->next) {
241 for(s3=cfg->acl_tag_actions; s3; s3 = s3->next) {
249 if(find_tag_id(cfg, s3->str2) == -1) {
262 for(s3=cfg->acl_tag_datas; s3; s3 = s3->next) {
272 if(find_tag_id(cfg, s3->str2) == -1) {
293 view_and_respipchecks(struct config_file* cfg)
303 if(!views_apply_cfg(views, cfg))
305 if(!respip_global_apply_cfg(respip, cfg))
307 if(!respip_views_apply_cfg(views, cfg, &have_view_respip_cfg))
310 if(use_response_ip && !strstr(cfg->module_conf, "respip"))
312 acl_view_tag_checks(cfg, views);
341 interfacechecks(struct config_file* cfg)
350 if(cfg->num_ifs != 0) {
351 resif = (char***)calloc(cfg->num_ifs, sizeof(char**));
353 num_resif = (int*)calloc(cfg->num_ifs, sizeof(int));
356 for(i=0; i<cfg->num_ifs; i++) {
359 if(strcmp(cfg->ifs[i], cfg->ifs[i2]) == 0) {
362 cfg->ifs[i]);
365 if(!resolve_interface_names(&cfg->ifs[i], 1, NULL, &resif[i],
368 cfg->ifs[i]);
371 if(if_is_pp2(resif[i][0], cfg->port, cfg->proxy_protocol_port)) {
372 if(if_is_dnscrypt(resif[i][0], cfg->port,
373 cfg->dnscrypt_port)) {
376 } else if(if_is_https(resif[i][0], cfg->port,
377 cfg->https_port)) {
380 } else if(if_is_quic(resif[i][0], cfg->port,
381 cfg->quic_port)) {
388 if(!extstrtoaddr(resif[i][j], &a, &alen, cfg->port)) {
389 if(strcmp(cfg->ifs[i], resif[i][j]) != 0)
391 resif[i][j], cfg->ifs[i]);
394 cfg->ifs[i]);
401 if(strcmp(cfg->ifs[i], resif[i][j]) != 0)
402 snprintf(info1, sizeof(info1), "address %s from interface: %s", resif[i][j], cfg->ifs[i]);
403 else snprintf(info1, sizeof(info1), "interface: %s", cfg->ifs[i]);
404 if(strcmp(cfg->ifs[i2], resif[i2][j2]) != 0)
405 snprintf(info2, sizeof(info2), "address %s from interface: %s", resif[i2][j2], cfg->ifs[i2]);
406 else snprintf(info2, sizeof(info2), "interface: %s", cfg->ifs[i2]);
414 for(i=0; i<cfg->num_ifs; i++) {
420 for(i=0; i<cfg->num_out_ifs; i++) {
421 if(!ipstrtoaddr(cfg->out_ifs[i], UNBOUND_DNS_PORT, &a, &alen) &&
422 !netblockstrtoaddr(cfg->out_ifs[i], UNBOUND_DNS_PORT, &a, &alen, &d)) {
424 "specified as '%s'", cfg->out_ifs[i]);
426 for(j=0; j<cfg->num_out_ifs; j++) {
427 if(i!=j && strcmp(cfg->out_ifs[i], cfg->out_ifs[j])==0)
430 cfg->out_ifs[i]);
459 controlinterfacechecks(struct config_file* cfg)
462 for(p = cfg->control_ifs.first; p; p = p->next) {
477 cfg->control_port)) {
492 aclchecks(struct config_file* cfg)
498 for(acl=cfg->acls; acl; acl = acl->next) {
509 tcpconnlimitchecks(struct config_file* cfg)
515 for(tcl=cfg->tcp_connection_limits; tcl; tcl = tcl->next) {
580 const char* chrootdir, struct config_file* cfg)
584 *ss = fname_after_chroot(str, cfg, 1);
602 const char* chrootdir, struct config_file* cfg)
606 check_chroot_string(desc, &p->str, chrootdir, cfg);
613 const char* chrootdir, struct config_file* cfg)
623 p->str = fname_after_chroot(p->str, cfg, 1);
627 check_chroot_string(desc, &p->str, chrootdir, cfg);
634 ecs_conf_checks(struct config_file* cfg)
639 if(!ecs_whitelist_apply_cfg(whitelist, cfg))
687 morechecks(struct config_file* cfg)
689 warn_hosts("stub-host", cfg->stubs);
690 warn_hosts("forward-host", cfg->forwards);
691 interfacechecks(cfg);
692 ifautomaticportschecks(cfg->if_automatic_ports);
693 aclchecks(cfg);
694 tcpconnlimitchecks(cfg);
696 if(cfg->verbosity < 0)
698 if(cfg->num_threads <= 0 || cfg->num_threads > 10000)
700 if(!cfg->do_ip4 && !cfg->do_ip6)
702 if(!cfg->do_ip4 && cfg->prefer_ip4)
704 if(!cfg->do_ip6 && cfg->prefer_ip6)
706 if(!cfg->do_udp && !cfg->do_tcp)
708 if(cfg->edns_buffer_size > cfg->msg_buffer_size)
712 w_config_adjust_directory(cfg);
714 if(cfg->chrootdir && cfg->chrootdir[0] &&
715 cfg->chrootdir[strlen(cfg->chrootdir)-1] == '/')
717 cfg->chrootdir);
718 if(cfg->chrootdir && cfg->chrootdir[0] &&
719 !is_dir(cfg->chrootdir)) {
722 if(cfg->directory && cfg->directory[0]) {
723 char* ad = fname_after_chroot(cfg->directory, cfg, 0);
728 if( (cfg->chrootdir && cfg->chrootdir[0]) ||
729 (cfg->directory && cfg->directory[0])) {
730 if(cfg->pidfile && cfg->pidfile[0]) {
731 char* ad = (cfg->pidfile[0]=='/')?strdup(cfg->pidfile):
732 fname_after_chroot(cfg->pidfile, cfg, 1);
738 if(cfg->logfile && cfg->logfile[0]) {
739 char* ad = fname_after_chroot(cfg->logfile, cfg, 1);
748 cfg->root_hints, cfg->chrootdir, cfg);
750 cfg->trust_anchor_file_list, cfg->chrootdir, cfg);
752 cfg->auto_trust_anchor_file_list, cfg->chrootdir, cfg);
754 cfg->trusted_keys_file_list, cfg->chrootdir, cfg);
755 if(cfg->disable_edns_do && strstr(cfg->module_conf, "validator")
756 && (cfg->trust_anchor_file_list
757 || cfg->trust_anchor_list
758 || cfg->auto_trust_anchor_file_list
759 || cfg->trusted_keys_file_list)) {
761 if(cfg->auto_trust_anchor_file_list)
762 key = cfg->auto_trust_anchor_file_list->str;
763 if(!key && cfg->trust_anchor_file_list)
764 key = cfg->trust_anchor_file_list->str;
765 if(!key && cfg->trust_anchor_list)
766 key = cfg->trust_anchor_list->str;
767 if(!key && cfg->trusted_keys_file_list)
768 key = cfg->trusted_keys_file_list->str;
773 if(cfg->ipsecmod_enabled && strstr(cfg->module_conf, "ipsecmod")) {
775 check_chroot_string("ipsecmod-hook", &cfg->ipsecmod_hook,
776 cfg->chrootdir, cfg);
780 free(cfg->chrootdir);
781 cfg->chrootdir = NULL;
784 check_modules_exist(cfg->module_conf);
787 if(strcmp(cfg->module_conf, "iterator") != 0
788 && strcmp(cfg->module_conf, "validator iterator") != 0
789 && strcmp(cfg->module_conf, "dns64 validator iterator") != 0
790 && strcmp(cfg->module_conf, "dns64 iterator") != 0
791 && strcmp(cfg->module_conf, "respip iterator") != 0
792 && strcmp(cfg->module_conf, "respip validator iterator") != 0
793 && strcmp(cfg->module_conf, "respip dns64 validator iterator") != 0
794 && strcmp(cfg->module_conf, "respip dns64 iterator") != 0
796 && strcmp(cfg->module_conf, "python iterator") != 0
797 && strcmp(cfg->module_conf, "python respip iterator") != 0
798 && strcmp(cfg->module_conf, "python validator iterator") != 0
799 && strcmp(cfg->module_conf, "python respip validator iterator") != 0
800 && strcmp(cfg->module_conf, "validator python iterator") != 0
801 && strcmp(cfg->module_conf, "dns64 python iterator") != 0
802 && strcmp(cfg->module_conf, "dns64 python validator iterator") != 0
803 && strcmp(cfg->module_conf, "dns64 validator python iterator") != 0
804 && strcmp(cfg->module_conf, "python dns64 iterator") != 0
805 && strcmp(cfg->module_conf, "python dns64 validator iterator") != 0
808 && strcmp(cfg->module_conf, "dynlib iterator") != 0
809 && strcmp(cfg->module_conf, "dynlib dynlib iterator") != 0
810 && strcmp(cfg->module_conf, "dynlib dynlib dynlib iterator") != 0
811 && strcmp(cfg->module_conf, "python dynlib iterator") != 0
812 && strcmp(cfg->module_conf, "python dynlib dynlib iterator") != 0
813 && strcmp(cfg->module_conf, "python dynlib dynlib dynlib iterator") != 0
814 && strcmp(cfg->module_conf, "dynlib respip iterator") != 0
815 && strcmp(cfg->module_conf, "dynlib validator iterator") != 0
816 && strcmp(cfg->module_conf, "dynlib dynlib validator iterator") != 0
817 && strcmp(cfg->module_conf, "dynlib dynlib dynlib validator iterator") != 0
818 && strcmp(cfg->module_conf, "python dynlib validator iterator") != 0
819 && strcmp(cfg->module_conf, "python dynlib dynlib validator iterator") != 0
820 && strcmp(cfg->module_conf, "python dynlib dynlib dynlib validator iterator") != 0
821 && strcmp(cfg->module_conf, "dynlib respip validator iterator") != 0
822 && strcmp(cfg->module_conf, "validator dynlib iterator") != 0
823 && strcmp(cfg->module_conf, "dns64 dynlib iterator") != 0
824 && strcmp(cfg->module_conf, "dns64 dynlib validator iterator") != 0
825 && strcmp(cfg->module_conf, "dns64 validator dynlib iterator") != 0
826 && strcmp(cfg->module_conf, "dynlib dns64 iterator") != 0
827 && strcmp(cfg->module_conf, "dynlib dns64 validator iterator") != 0
828 && strcmp(cfg->module_conf, "dynlib dns64 cachedb iterator") != 0
829 && strcmp(cfg->module_conf, "dynlib dns64 validator cachedb iterator") != 0
830 && strcmp(cfg->module_conf, "dns64 dynlib cachedb iterator") != 0
831 && strcmp(cfg->module_conf, "dns64 dynlib validator cachedb iterator") != 0
832 && strcmp(cfg->module_conf, "dynlib cachedb iterator") != 0
833 && strcmp(cfg->module_conf, "dynlib respip cachedb iterator") != 0
834 && strcmp(cfg->module_conf, "dynlib validator cachedb iterator") != 0
835 && strcmp(cfg->module_conf, "dynlib respip validator cachedb iterator") != 0
836 && strcmp(cfg->module_conf, "cachedb dynlib iterator") != 0
837 && strcmp(cfg->module_conf, "respip cachedb dynlib iterator") != 0
838 && strcmp(cfg->module_conf, "validator cachedb dynlib iterator") != 0
839 && strcmp(cfg->module_conf, "respip validator cachedb dynlib iterator") != 0
840 && strcmp(cfg->module_conf, "validator dynlib cachedb iterator") != 0
841 && strcmp(cfg->module_conf, "respip validator dynlib cachedb iterator") != 0
842 && strcmp(cfg->module_conf, "dynlib subnetcache iterator") != 0
843 && strcmp(cfg->module_conf, "dynlib respip subnetcache iterator") != 0
844 && strcmp(cfg->module_conf, "subnetcache dynlib iterator") != 0
845 && strcmp(cfg->module_conf, "respip subnetcache dynlib iterator") != 0
846 && strcmp(cfg->module_conf, "dynlib subnetcache validator iterator") != 0
847 && strcmp(cfg->module_conf, "dynlib respip subnetcache validator iterator") != 0
848 && strcmp(cfg->module_conf, "subnetcache dynlib validator iterator") != 0
849 && strcmp(cfg->module_conf, "respip subnetcache dynlib validator iterator") != 0
850 && strcmp(cfg->module_conf, "subnetcache validator dynlib iterator") != 0
851 && strcmp(cfg->module_conf, "respip subnetcache validator dynlib iterator") != 0
852 && strcmp(cfg->module_conf, "dynlib ipsecmod iterator") != 0
853 && strcmp(cfg->module_conf, "dynlib ipsecmod respip iterator") != 0
854 && strcmp(cfg->module_conf, "ipsecmod dynlib iterator") != 0
855 && strcmp(cfg->module_conf, "ipsecmod dynlib respip iterator") != 0
856 && strcmp(cfg->module_conf, "ipsecmod validator iterator") != 0
857 && strcmp(cfg->module_conf, "ipsecmod respip validator iterator") != 0
858 && strcmp(cfg->module_conf, "dynlib ipsecmod validator iterator") != 0
859 && strcmp(cfg->module_conf, "dynlib ipsecmod respip validator iterator") != 0
860 && strcmp(cfg->module_conf, "ipsecmod dynlib validator iterator") != 0
861 && strcmp(cfg->module_conf, "ipsecmod dynlib respip validator iterator") != 0
862 && strcmp(cfg->module_conf, "ipsecmod validator dynlib iterator") != 0
863 && strcmp(cfg->module_conf, "ipsecmod respip validator dynlib iterator") != 0
866 && strcmp(cfg->module_conf, "validator cachedb iterator") != 0
867 && strcmp(cfg->module_conf, "respip validator cachedb iterator") != 0
868 && strcmp(cfg->module_conf, "cachedb iterator") != 0
869 && strcmp(cfg->module_conf, "respip cachedb iterator") != 0
870 && strcmp(cfg->module_conf, "dns64 validator cachedb iterator") != 0
871 && strcmp(cfg->module_conf, "dns64 cachedb iterator") != 0
874 && strcmp(cfg->module_conf, "python dns64 cachedb iterator") != 0
875 && strcmp(cfg->module_conf, "python dns64 validator cachedb iterator") != 0
876 && strcmp(cfg->module_conf, "dns64 python cachedb iterator") != 0
877 && strcmp(cfg->module_conf, "dns64 python validator cachedb iterator") != 0
878 && strcmp(cfg->module_conf, "python cachedb iterator") != 0
879 && strcmp(cfg->module_conf, "python respip cachedb iterator") != 0
880 && strcmp(cfg->module_conf, "python validator cachedb iterator") != 0
881 && strcmp(cfg->module_conf, "python respip validator cachedb iterator") != 0
882 && strcmp(cfg->module_conf, "cachedb python iterator") != 0
883 && strcmp(cfg->module_conf, "respip cachedb python iterator") != 0
884 && strcmp(cfg->module_conf, "validator cachedb python iterator") != 0
885 && strcmp(cfg->module_conf, "respip validator cachedb python iterator") != 0
886 && strcmp(cfg->module_conf, "validator python cachedb iterator") != 0
887 && strcmp(cfg->module_conf, "respip validator python cachedb iterator") != 0
890 && strcmp(cfg->module_conf, "respip subnetcache validator cachedb iterator") != 0
891 && strcmp(cfg->module_conf, "subnetcache validator cachedb iterator") != 0
894 && strcmp(cfg->module_conf, "subnetcache iterator") != 0
895 && strcmp(cfg->module_conf, "respip subnetcache iterator") != 0
896 && strcmp(cfg->module_conf, "subnetcache validator iterator") != 0
897 && strcmp(cfg->module_conf, "respip subnetcache validator iterator") != 0
898 && strcmp(cfg->module_conf, "dns64 subnetcache iterator") != 0
899 && strcmp(cfg->module_conf, "dns64 subnetcache validator iterator") != 0
900 && strcmp(cfg->module_conf, "dns64 subnetcache respip iterator") != 0
901 && strcmp(cfg->module_conf, "dns64 subnetcache respip validator iterator") != 0
904 && strcmp(cfg->module_conf, "python subnetcache iterator") != 0
905 && strcmp(cfg->module_conf, "python respip subnetcache iterator") != 0
906 && strcmp(cfg->module_conf, "subnetcache python iterator") != 0
907 && strcmp(cfg->module_conf, "respip subnetcache python iterator") != 0
908 && strcmp(cfg->module_conf, "python subnetcache validator iterator") != 0
909 && strcmp(cfg->module_conf, "python respip subnetcache validator iterator") != 0
910 && strcmp(cfg->module_conf, "subnetcache python validator iterator") != 0
911 && strcmp(cfg->module_conf, "respip subnetcache python validator iterator") != 0
912 && strcmp(cfg->module_conf, "subnetcache validator python iterator") != 0
913 && strcmp(cfg->module_conf, "respip subnetcache validator python iterator") != 0
916 && strcmp(cfg->module_conf, "ipsecmod iterator") != 0
917 && strcmp(cfg->module_conf, "ipsecmod respip iterator") != 0
918 && strcmp(cfg->module_conf, "ipsecmod validator iterator") != 0
919 && strcmp(cfg->module_conf, "ipsecmod respip validator iterator") != 0
922 && strcmp(cfg->module_conf, "python ipsecmod iterator") != 0
923 && strcmp(cfg->module_conf, "python ipsecmod respip iterator") != 0
924 && strcmp(cfg->module_conf, "ipsecmod python iterator") != 0
925 && strcmp(cfg->module_conf, "ipsecmod python respip iterator") != 0
926 && strcmp(cfg->module_conf, "ipsecmod validator iterator") != 0
927 && strcmp(cfg
928 && strcmp(cfg->module_conf, "python ipsecmod validator iterator") != 0
929 && strcmp(cfg->module_conf, "python ipsecmod respip validator iterator") != 0
930 && strcmp(cfg->module_conf, "ipsecmod python validator iterator") != 0
931 && strcmp(cfg->module_conf, "ipsecmod python respip validator iterator") != 0
932 && strcmp(cfg->module_conf, "ipsecmod validator python iterator") != 0
933 && strcmp(cfg->module_conf, "ipsecmod respip validator python iterator") != 0
936 && strcmp(cfg->module_conf, "validator ipset iterator") != 0
937 && strcmp(cfg->module_conf, "validator ipset respip iterator") != 0
938 && strcmp(cfg->module_conf, "ipset iterator") != 0
939 && strcmp(cfg->module_conf, "ipset respip iterator") != 0
943 cfg->module_conf);
947 if(cfg->username && cfg->username[0]) {
948 if(getpwnam(cfg->username) == NULL)
949 fatal_exit("user '%s' does not exist.", cfg->username);
955 if(cfg->remote_control_enable && options_remote_is_address(cfg)
956 && cfg->control_use_cert) {
957 check_chroot_string("server-key-file", &cfg->server_key_file,
958 cfg->chrootdir, cfg);
959 check_chroot_string("server-cert-file", &cfg->server_cert_file,
960 cfg->chrootdir, cfg);
961 if(!is_file(cfg->control_key_file))
963 cfg->control_key_file);
964 if(!is_file(cfg->control_cert_file))
966 cfg->control_cert_file);
968 if(cfg->remote_control_enable)
969 controlinterfacechecks(cfg);
971 donotquerylocalhostcheck(cfg);
972 localzonechecks(cfg);
973 view_and_respipchecks(cfg);
975 ecs_conf_checks(cfg);
981 check_fwd(struct config_file* cfg)
984 if(!fwd || !forwards_apply_cfg(fwd, cfg)) {
992 check_hints(struct config_file* cfg)
995 if(!hints || !hints_apply_cfg(hints, cfg)) {
1003 check_auth(struct config_file* cfg)
1007 if(!az || !auth_zones_apply_cfg(az, cfg, 0, &is_rpz, NULL, NULL)) {
1010 if(is_rpz && !strstr(cfg->module_conf, "respip"))
1020 struct config_file* cfg = config_create();
1021 if(!cfg)
1028 if(!config_read(cfg, cfgfile, NULL)) {
1030 config_delete(cfg);
1036 print_option(cfg, opt, final);
1037 config_delete(cfg);
1040 morechecks(cfg);
1041 check_mod(cfg, iter_get_funcblock());
1042 check_mod(cfg, val_get_funcblock());
1044 if(strstr(cfg->module_conf, "python"))
1045 check_mod(cfg, pythonmod_get_funcblock());
1047 check_fwd(cfg);
1048 check_hints(cfg);
1049 check_auth(cfg);
1051 config_delete(cfg);