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)
302 if(!views_apply_cfg(views, cfg))
304 if(!respip_global_apply_cfg(respip, cfg))
306 if(!respip_views_apply_cfg(views, cfg, &ignored))
308 acl_view_tag_checks(cfg, views);
337 interfacechecks(struct config_file* cfg)
346 if(cfg->num_ifs != 0) {
347 resif = (char***)calloc(cfg->num_ifs, sizeof(char**));
349 num_resif = (int*)calloc(cfg->num_ifs, sizeof(int));
352 for(i=0; i<cfg->num_ifs; i++) {
355 if(strcmp(cfg->ifs[i], cfg->ifs[i2]) == 0) {
358 cfg->ifs[i]);
361 if(!resolve_interface_names(&cfg->ifs[i], 1, NULL, &resif[i],
364 cfg->ifs[i]);
367 if(if_is_pp2(resif[i][0], cfg->port, cfg->proxy_protocol_port)) {
368 if(if_is_dnscrypt(resif[i][0], cfg->port,
369 cfg->dnscrypt_port)) {
372 } else if(if_is_https(resif[i][0], cfg->port,
373 cfg->https_port)) {
376 } else if(if_is_quic(resif[i][0], cfg->port,
377 cfg->quic_port)) {
384 if(!extstrtoaddr(resif[i][j], &a, &alen, cfg->port)) {
385 if(strcmp(cfg->ifs[i], resif[i][j]) != 0)
387 resif[i][j], cfg->ifs[i]);
390 cfg->ifs[i]);
397 if(strcmp(cfg->ifs[i], resif[i][j]) != 0)
398 snprintf(info1, sizeof(info1), "address %s from interface: %s", resif[i][j], cfg->ifs[i]);
399 else snprintf(info1, sizeof(info1), "interface: %s", cfg->ifs[i]);
400 if(strcmp(cfg->ifs[i2], resif[i2][j2]) != 0)
401 snprintf(info2, sizeof(info2), "address %s from interface: %s", resif[i2][j2], cfg->ifs[i2]);
402 else snprintf(info2, sizeof(info2), "interface: %s", cfg->ifs[i2]);
410 for(i=0; i<cfg->num_ifs; i++) {
416 for(i=0; i<cfg->num_out_ifs; i++) {
417 if(!ipstrtoaddr(cfg->out_ifs[i], UNBOUND_DNS_PORT, &a, &alen) &&
418 !netblockstrtoaddr(cfg->out_ifs[i], UNBOUND_DNS_PORT, &a, &alen, &d)) {
420 "specified as '%s'", cfg->out_ifs[i]);
422 for(j=0; j<cfg->num_out_ifs; j++) {
423 if(i!=j && strcmp(cfg->out_ifs[i], cfg->out_ifs[j])==0)
426 cfg->out_ifs[i]);
455 aclchecks(struct config_file* cfg)
461 for(acl=cfg->acls; acl; acl = acl->next) {
472 tcpconnlimitchecks(struct config_file* cfg)
478 for(tcl=cfg->tcp_connection_limits; tcl; tcl = tcl->next) {
543 const char* chrootdir, struct config_file* cfg)
547 *ss = fname_after_chroot(str, cfg, 1);
565 const char* chrootdir, struct config_file* cfg)
569 check_chroot_string(desc, &p->str, chrootdir, cfg);
576 const char* chrootdir, struct config_file* cfg)
586 p->str = fname_after_chroot(p->str, cfg, 1);
590 check_chroot_string(desc, &p->str, chrootdir, cfg);
597 ecs_conf_checks(struct config_file* cfg)
602 if(!ecs_whitelist_apply_cfg(whitelist, cfg))
648 morechecks(struct config_file* cfg)
650 warn_hosts("stub-host", cfg->stubs);
651 warn_hosts("forward-host", cfg->forwards);
652 interfacechecks(cfg);
653 ifautomaticportschecks(cfg->if_automatic_ports);
654 aclchecks(cfg);
655 tcpconnlimitchecks(cfg);
657 if(cfg->verbosity < 0)
659 if(cfg->num_threads <= 0 || cfg->num_threads > 10000)
661 if(!cfg->do_ip4 && !cfg->do_ip6)
663 if(!cfg->do_ip4 && cfg->prefer_ip4)
665 if(!cfg->do_ip6 && cfg->prefer_ip6)
667 if(!cfg->do_udp && !cfg->do_tcp)
669 if(cfg->edns_buffer_size > cfg->msg_buffer_size)
673 w_config_adjust_directory(cfg);
675 if(cfg->chrootdir && cfg->chrootdir[0] &&
676 cfg->chrootdir[strlen(cfg->chrootdir)-1] == '/')
678 cfg->chrootdir);
679 if(cfg->chrootdir && cfg->chrootdir[0] &&
680 !is_dir(cfg->chrootdir)) {
683 if(cfg->directory && cfg->directory[0]) {
684 char* ad = fname_after_chroot(cfg->directory, cfg, 0);
689 if( (cfg->chrootdir && cfg->chrootdir[0]) ||
690 (cfg->directory && cfg->directory[0])) {
691 if(cfg->pidfile && cfg->pidfile[0]) {
692 char* ad = (cfg->pidfile[0]=='/')?strdup(cfg->pidfile):
693 fname_after_chroot(cfg->pidfile, cfg, 1);
699 if(cfg->logfile && cfg->logfile[0]) {
700 char* ad = fname_after_chroot(cfg->logfile, cfg, 1);
709 cfg->root_hints, cfg->chrootdir, cfg);
711 cfg->trust_anchor_file_list, cfg->chrootdir, cfg);
713 cfg->auto_trust_anchor_file_list, cfg->chrootdir, cfg);
715 cfg->trusted_keys_file_list, cfg->chrootdir, cfg);
716 if(cfg->disable_edns_do && strstr(cfg->module_conf, "validator")
717 && (cfg->trust_anchor_file_list
718 || cfg->trust_anchor_list
719 || cfg->auto_trust_anchor_file_list
720 || cfg->trusted_keys_file_list)) {
722 if(cfg->auto_trust_anchor_file_list)
723 key = cfg->auto_trust_anchor_file_list->str;
724 if(!key && cfg->trust_anchor_file_list)
725 key = cfg->trust_anchor_file_list->str;
726 if(!key && cfg->trust_anchor_list)
727 key = cfg->trust_anchor_list->str;
728 if(!key && cfg->trusted_keys_file_list)
729 key = cfg->trusted_keys_file_list->str;
734 if(cfg->ipsecmod_enabled && strstr(cfg->module_conf, "ipsecmod")) {
736 check_chroot_string("ipsecmod-hook", &cfg->ipsecmod_hook,
737 cfg->chrootdir, cfg);
741 free(cfg->chrootdir);
742 cfg->chrootdir = NULL;
745 check_modules_exist(cfg->module_conf);
748 if(strcmp(cfg->module_conf, "iterator") != 0
749 && strcmp(cfg->module_conf, "validator iterator") != 0
750 && strcmp(cfg->module_conf, "dns64 validator iterator") != 0
751 && strcmp(cfg->module_conf, "dns64 iterator") != 0
752 && strcmp(cfg->module_conf, "respip iterator") != 0
753 && strcmp(cfg->module_conf, "respip validator iterator") != 0
754 && strcmp(cfg->module_conf, "respip dns64 validator iterator") != 0
755 && strcmp(cfg->module_conf, "respip dns64 iterator") != 0
757 && strcmp(cfg->module_conf, "python iterator") != 0
758 && strcmp(cfg->module_conf, "python respip iterator") != 0
759 && strcmp(cfg->module_conf, "python validator iterator") != 0
760 && strcmp(cfg->module_conf, "python respip validator iterator") != 0
761 && strcmp(cfg->module_conf, "validator python iterator") != 0
762 && strcmp(cfg->module_conf, "dns64 python iterator") != 0
763 && strcmp(cfg->module_conf, "dns64 python validator iterator") != 0
764 && strcmp(cfg->module_conf, "dns64 validator python iterator") != 0
765 && strcmp(cfg->module_conf, "python dns64 iterator") != 0
766 && strcmp(cfg->module_conf, "python dns64 validator iterator") != 0
769 && strcmp(cfg->module_conf, "dynlib iterator") != 0
770 && strcmp(cfg->module_conf, "dynlib dynlib iterator") != 0
771 && strcmp(cfg->module_conf, "dynlib dynlib dynlib iterator") != 0
772 && strcmp(cfg->module_conf, "python dynlib iterator") != 0
773 && strcmp(cfg->module_conf, "python dynlib dynlib iterator") != 0
774 && strcmp(cfg->module_conf, "python dynlib dynlib dynlib iterator") != 0
775 && strcmp(cfg->module_conf, "dynlib respip iterator") != 0
776 && strcmp(cfg->module_conf, "dynlib validator iterator") != 0
777 && strcmp(cfg->module_conf, "dynlib dynlib validator iterator") != 0
778 && strcmp(cfg->module_conf, "dynlib dynlib dynlib validator iterator") != 0
779 && strcmp(cfg->module_conf, "python dynlib validator iterator") != 0
780 && strcmp(cfg->module_conf, "python dynlib dynlib validator iterator") != 0
781 && strcmp(cfg->module_conf, "python dynlib dynlib dynlib validator iterator") != 0
782 && strcmp(cfg->module_conf, "dynlib respip validator iterator") != 0
783 && strcmp(cfg->module_conf, "validator dynlib iterator") != 0
784 && strcmp(cfg->module_conf, "dns64 dynlib iterator") != 0
785 && strcmp(cfg->module_conf, "dns64 dynlib validator iterator") != 0
786 && strcmp(cfg->module_conf, "dns64 validator dynlib iterator") != 0
787 && strcmp(cfg->module_conf, "dynlib dns64 iterator") != 0
788 && strcmp(cfg->module_conf, "dynlib dns64 validator iterator") != 0
789 && strcmp(cfg->module_conf, "dynlib dns64 cachedb iterator") != 0
790 && strcmp(cfg->module_conf, "dynlib dns64 validator cachedb iterator") != 0
791 && strcmp(cfg->module_conf, "dns64 dynlib cachedb iterator") != 0
792 && strcmp(cfg->module_conf, "dns64 dynlib validator cachedb iterator") != 0
793 && strcmp(cfg->module_conf, "dynlib cachedb iterator") != 0
794 && strcmp(cfg->module_conf, "dynlib respip cachedb iterator") != 0
795 && strcmp(cfg->module_conf, "dynlib validator cachedb iterator") != 0
796 && strcmp(cfg->module_conf, "dynlib respip validator cachedb iterator") != 0
797 && strcmp(cfg->module_conf, "cachedb dynlib iterator") != 0
798 && strcmp(cfg->module_conf, "respip cachedb dynlib iterator") != 0
799 && strcmp(cfg->module_conf, "validator cachedb dynlib iterator") != 0
800 && strcmp(cfg->module_conf, "respip validator cachedb dynlib iterator") != 0
801 && strcmp(cfg->module_conf, "validator dynlib cachedb iterator") != 0
802 && strcmp(cfg->module_conf, "respip validator dynlib cachedb iterator") != 0
803 && strcmp(cfg->module_conf, "dynlib subnetcache iterator") != 0
804 && strcmp(cfg->module_conf, "dynlib respip subnetcache iterator") != 0
805 && strcmp(cfg->module_conf, "subnetcache dynlib iterator") != 0
806 && strcmp(cfg->module_conf, "respip subnetcache dynlib iterator") != 0
807 && strcmp(cfg->module_conf, "dynlib subnetcache validator iterator") != 0
808 && strcmp(cfg->module_conf, "dynlib respip subnetcache validator iterator") != 0
809 && strcmp(cfg->module_conf, "subnetcache dynlib validator iterator") != 0
810 && strcmp(cfg->module_conf, "respip subnetcache dynlib validator iterator") != 0
811 && strcmp(cfg->module_conf, "subnetcache validator dynlib iterator") != 0
812 && strcmp(cfg->module_conf, "respip subnetcache validator dynlib iterator") != 0
813 && strcmp(cfg->module_conf, "dynlib ipsecmod iterator") != 0
814 && strcmp(cfg->module_conf, "dynlib ipsecmod respip iterator") != 0
815 && strcmp(cfg->module_conf, "ipsecmod dynlib iterator") != 0
816 && strcmp(cfg->module_conf, "ipsecmod dynlib respip iterator") != 0
817 && strcmp(cfg->module_conf, "ipsecmod validator iterator") != 0
818 && strcmp(cfg->module_conf, "ipsecmod respip validator iterator") != 0
819 && strcmp(cfg->module_conf, "dynlib ipsecmod validator iterator") != 0
820 && strcmp(cfg->module_conf, "dynlib ipsecmod respip validator iterator") != 0
821 && strcmp(cfg->module_conf, "ipsecmod dynlib validator iterator") != 0
822 && strcmp(cfg->module_conf, "ipsecmod dynlib respip validator iterator") != 0
823 && strcmp(cfg->module_conf, "ipsecmod validator dynlib iterator") != 0
824 && strcmp(cfg->module_conf, "ipsecmod respip validator dynlib iterator") != 0
827 && strcmp(cfg->module_conf, "validator cachedb iterator") != 0
828 && strcmp(cfg->module_conf, "respip validator cachedb iterator") != 0
829 && strcmp(cfg->module_conf, "cachedb iterator") != 0
830 && strcmp(cfg->module_conf, "respip cachedb iterator") != 0
831 && strcmp(cfg->module_conf, "dns64 validator cachedb iterator") != 0
832 && strcmp(cfg->module_conf, "dns64 cachedb iterator") != 0
835 && strcmp(cfg->module_conf, "python dns64 cachedb iterator") != 0
836 && strcmp(cfg->module_conf, "python dns64 validator cachedb iterator") != 0
837 && strcmp(cfg->module_conf, "dns64 python cachedb iterator") != 0
838 && strcmp(cfg->module_conf, "dns64 python validator cachedb iterator") != 0
839 && strcmp(cfg->module_conf, "python cachedb iterator") != 0
840 && strcmp(cfg->module_conf, "python respip cachedb iterator") != 0
841 && strcmp(cfg->module_conf, "python validator cachedb iterator") != 0
842 && strcmp(cfg->module_conf, "python respip validator cachedb iterator") != 0
843 && strcmp(cfg->module_conf, "cachedb python iterator") != 0
844 && strcmp(cfg->module_conf, "respip cachedb python iterator") != 0
845 && strcmp(cfg->module_conf, "validator cachedb python iterator") != 0
846 && strcmp(cfg->module_conf, "respip validator cachedb python iterator") != 0
847 && strcmp(cfg->module_conf, "validator python cachedb iterator") != 0
848 && strcmp(cfg->module_conf, "respip validator python cachedb iterator") != 0
851 && strcmp(cfg->module_conf, "respip subnetcache validator cachedb iterator") != 0
852 && strcmp(cfg->module_conf, "subnetcache validator cachedb iterator") != 0
855 && strcmp(cfg->module_conf, "subnetcache iterator") != 0
856 && strcmp(cfg->module_conf, "respip subnetcache iterator") != 0
857 && strcmp(cfg->module_conf, "subnetcache validator iterator") != 0
858 && strcmp(cfg->module_conf, "respip subnetcache validator iterator") != 0
859 && strcmp(cfg->module_conf, "dns64 subnetcache iterator") != 0
860 && strcmp(cfg->module_conf, "dns64 subnetcache validator iterator") != 0
861 && strcmp(cfg->module_conf, "dns64 subnetcache respip iterator") != 0
862 && strcmp(cfg->module_conf, "dns64 subnetcache respip validator iterator") != 0
865 && strcmp(cfg->module_conf, "python subnetcache iterator") != 0
866 && strcmp(cfg->module_conf, "python respip subnetcache iterator") != 0
867 && strcmp(cfg->module_conf, "subnetcache python iterator") != 0
868 && strcmp(cfg->module_conf, "respip subnetcache python iterator") != 0
869 && strcmp(cfg->module_conf, "python subnetcache validator iterator") != 0
870 && strcmp(cfg->module_conf, "python respip subnetcache validator iterator") != 0
871 && strcmp(cfg->module_conf, "subnetcache python validator iterator") != 0
872 && strcmp(cfg->module_conf, "respip subnetcache python validator iterator") != 0
873 && strcmp(cfg->module_conf, "subnetcache validator python iterator") != 0
874 && strcmp(cfg->module_conf, "respip subnetcache validator python iterator") != 0
877 && strcmp(cfg->module_conf, "ipsecmod iterator") != 0
878 && strcmp(cfg->module_conf, "ipsecmod respip iterator") != 0
879 && strcmp(cfg->module_conf, "ipsecmod validator iterator") != 0
880 && strcmp(cfg->module_conf, "ipsecmod respip validator iterator") != 0
883 && strcmp(cfg->module_conf, "python ipsecmod iterator") != 0
884 && strcmp(cfg->module_conf, "python ipsecmod respip iterator") != 0
885 && strcmp(cfg->module_conf, "ipsecmod python iterator") != 0
886 && strcmp(cfg->module_conf, "ipsecmod python respip iterator") != 0
887 && strcmp(cfg->module_conf, "ipsecmod validator iterator") != 0
888 && strcmp(cfg->module_conf, "ipsecmod respip validator iterator") != 0
889 && strcmp(cfg->module_conf, "python ipsecmod validator iterator") != 0
890 && strcmp(cfg->module_conf, "python ipsecmod respip validator iterator") != 0
891 && strcmp(cfg->module_conf, "ipsecmod python validator iterator") != 0
892 && strcmp(cfg->module_conf, "ipsecmod python respip validator iterator") != 0
893 && strcmp(cfg->module_conf, "ipsecmod validator python iterator") != 0
894 && strcmp(cfg->module_conf, "ipsecmod respip validator python iterator") != 0
897 && strcmp(cfg->module_conf, "validator ipset iterator") != 0
898 && strcmp(cfg->module_conf, "validator ipset respip iterator") != 0
899 && strcmp(cfg->module_conf, "ipset iterator") != 0
900 && strcmp(cfg->module_conf, "ipset respip iterator") != 0
904 cfg->module_conf);
908 if(cfg->username && cfg->username[0]) {
909 if(getpwnam(cfg->username) == NULL)
910 fatal_exit("user '%s' does not exist.", cfg->username);
916 if(cfg->remote_control_enable && options_remote_is_address(cfg)
917 && cfg->control_use_cert) {
918 check_chroot_string("server-key-file", &cfg->server_key_file,
919 cfg->chrootdir, cfg);
920 check_chroot_string("server-cert-file", &cfg->server_cert_file,
921 cfg->chrootdir, cfg);
922 if(!is_file(cfg->control_key_file))
924 cfg->control_key_file);
925 if(!is_file(cfg->control_cert_file))
927 cfg->control_cert_file);
930 donotquerylocalhostcheck(cfg);
931 localzonechecks(cfg);
932 view_and_respipchecks(cfg);
934 ecs_conf_checks(cfg);
940 check_fwd(struct config_file* cfg)
943 if(!fwd || !forwards_apply_cfg(fwd, cfg)) {
951 check_hints(struct config_file* cfg)
954 if(!hints || !hints_apply_cfg(hints, cfg)) {
962 check_auth(struct config_file* cfg)
966 if(!az || !auth_zones_apply_cfg(az, cfg, 0, &is_rpz, NULL, NULL)) {
977 struct config_file* cfg = config_create();
978 if(!cfg)
985 if(!config_read(cfg, cfgfile, NULL)) {
987 config_delete(cfg);
993 print_option(cfg, opt, final);
994 config_delete(cfg);
997 morechecks(cfg);
998 check_mod(cfg, iter_get_funcblock());
999 check_mod(cfg, val_get_funcblock());
1001 if(strstr(cfg->module_conf, "python"))
1002 check_mod(cfg, pythonmod_get_funcblock());
1004 check_fwd(cfg);
1005 check_hints(cfg);
1006 check_auth(cfg);
1008 config_delete(cfg);