00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include "dprint.h"
00034 #ifdef USE_DST_BLACKLIST
00035 #include "dst_blacklist.h"
00036 #endif
00037 #include "resolve.h"
00038 #ifdef USE_DNS_CACHE
00039 #include "dns_cache.h"
00040 #endif
00041 #if defined PKG_MALLOC || defined SHM_MEM
00042 #include "pt.h"
00043 #endif
00044 #include "msg_translator.h"
00045 #include "cfg/cfg.h"
00046 #include "cfg_core.h"
00047
00048 struct cfg_group_core default_core_cfg = {
00049 L_WARN,
00050 LOG_DAEMON,
00051 #ifdef USE_DST_BLACKLIST
00052
00053 0,
00054 DEFAULT_BLST_TIMEOUT,
00055 DEFAULT_BLST_MAX_MEM,
00056 #endif
00057
00058 #ifdef USE_IPV6
00059 1,
00060 #else
00061 0,
00062 #endif
00063 0,
00064 30,
00065 20,
00066 10,
00067 20,
00068 -1,
00069 -1,
00070 -1,
00071 1,
00072 1,
00073 0,
00074
00075 #ifdef USE_DNS_CACHE
00076 1,
00077 0,
00078 0,
00079 0,
00080 DEFAULT_DNS_NEG_CACHE_TTL,
00081 DEFAULT_DNS_CACHE_MIN_TTL,
00082 DEFAULT_DNS_CACHE_MAX_TTL,
00083 DEFAULT_DNS_MAX_MEM,
00084 0,
00085 #endif
00086 #ifdef PKG_MALLOC
00087 0,
00088 #endif
00089 #ifdef SHM_MEM
00090 0,
00091 #endif
00092 0,
00093 0,
00094 0
00095 };
00096
00097 void *core_cfg = &default_core_cfg;
00098
00099 cfg_def_t core_cfg_def[] = {
00100 {"debug", CFG_VAR_INT|CFG_ATOMIC, 0, 0, 0, 0,
00101 "debug level"},
00102 {"log_facility", CFG_VAR_INT|CFG_INPUT_STRING, 0, 0, log_facility_fixup, 0,
00103 "syslog facility, see \"man 3 syslog\""},
00104 #ifdef USE_DST_BLACKLIST
00105
00106 {"use_dst_blacklist", CFG_VAR_INT, 0, 1, use_dst_blacklist_fixup, 0,
00107 "enable/disable destination blacklisting"},
00108 {"dst_blacklist_expire", CFG_VAR_INT, 0, 0, 0, 0,
00109 "how much time (in s) a blacklisted destination is kept in the list"},
00110 {"dst_blacklist_mem", CFG_VAR_INT, 0, 0, blst_max_mem_fixup, 0,
00111 "maximum shared memory amount (in KB) used for keeping the blacklisted destinations"},
00112 #endif
00113
00114 #ifdef USE_DNS_CACHE
00115 {"dns_try_ipv6", CFG_VAR_INT, 0, 1, dns_try_ipv6_fixup, fix_dns_flags,
00116 #else
00117 {"dns_try_ipv6", CFG_VAR_INT, 0, 1, dns_try_ipv6_fixup, 0,
00118 #endif
00119 "enable/disable IPv6 DNS lookups"},
00120 #ifdef USE_DNS_CACHE
00121 {"dns_try_naptr", CFG_VAR_INT, 0, 1, 0, fix_dns_flags,
00122 #else
00123 {"dns_try_naptr", CFG_VAR_INT, 0, 1, 0, 0,
00124 #endif
00125 "enable/disable NAPTR DNS lookups"},
00126 {"dns_udp_pref", CFG_VAR_INT, 0, 0, 0, reinit_naptr_proto_prefs,
00127 "udp protocol preference when doing NAPTR lookups"},
00128 {"dns_tcp_pref", CFG_VAR_INT, 0, 0, 0, reinit_naptr_proto_prefs,
00129 "tcp protocol preference when doing NAPTR lookups"},
00130 {"dns_tls_pref", CFG_VAR_INT, 0, 0, 0, reinit_naptr_proto_prefs,
00131 "tls protocol preference when doing NAPTR lookups"},
00132 {"dns_sctp_pref", CFG_VAR_INT, 0, 0, 0, reinit_naptr_proto_prefs,
00133 "sctp protocol preference when doing NAPTR lookups"},
00134 {"dns_retr_time", CFG_VAR_INT, 0, 0, 0, resolv_reinit,
00135 "time in s before retrying a dns request"},
00136 {"dns_retr_no", CFG_VAR_INT, 0, 0, 0, resolv_reinit,
00137 "number of dns retransmissions before giving up"},
00138 {"dns_servers_no", CFG_VAR_INT, 0, 0, 0, resolv_reinit,
00139 "how many dns servers from the ones defined in "
00140 "/etc/resolv.conf will be used"},
00141 {"dns_use_search_list", CFG_VAR_INT, 0, 1, 0, resolv_reinit,
00142 "if set to 0, the search list in /etc/resolv.conf is ignored"},
00143 {"dns_search_full_match", CFG_VAR_INT, 0, 1, 0, 0,
00144 "enable/disable domain name checks against the search list "
00145 "in DNS answers"},
00146 {"dns_reinit", CFG_VAR_INT|CFG_INPUT_INT, 1, 1, dns_reinit_fixup, resolv_reinit,
00147 "set to 1 in order to reinitialize the DNS resolver"},
00148
00149 #ifdef USE_DNS_CACHE
00150 {"use_dns_cache", CFG_VAR_INT, 0, 1, use_dns_cache_fixup, 0,
00151 "enable/disable the dns cache"},
00152 {"dns_cache_flags", CFG_VAR_INT, 0, 4, 0, fix_dns_flags,
00153 "dns cache specific resolver flags "
00154 "(1=ipv4 only, 2=ipv6 only, 4=prefer ipv6"},
00155 {"use_dns_failover", CFG_VAR_INT, 0, 1, use_dns_failover_fixup, 0,
00156 "enable/disable dns failover in case the destination "
00157 "resolves to multiple ip addresses and/or multiple SRV records "
00158 "(depends on use_dns_cache)"},
00159 {"dns_srv_lb", CFG_VAR_INT, 0, 1, 0, fix_dns_flags,
00160 "enable/disable load balancing to different srv records "
00161 "of the same priority based on the srv records weights "
00162 "(depends on dns_failover)"},
00163 {"dns_cache_negative_ttl", CFG_VAR_INT, 0, 0, 0, 0,
00164 "time to live for negative results (\"not found\") "
00165 "in seconds. Use 0 to disable"},
00166 {"dns_cache_min_ttl", CFG_VAR_INT, 0, 0, 0, 0,
00167 "minimum accepted time to live for a record, in seconds"},
00168 {"dns_cache_max_ttl", CFG_VAR_INT, 0, 0, 0, 0,
00169 "maximum accepted time to live for a record, in seconds"},
00170 {"dns_cache_mem", CFG_VAR_INT, 0, 0, dns_cache_max_mem_fixup, 0,
00171 "maximum memory used for the dns cache in Kb"},
00172 {"dns_cache_del_nonexp", CFG_VAR_INT, 0, 1, 0, 0,
00173 "allow deletion of non-expired records from the cache when "
00174 "there is no more space left for new ones"},
00175 #endif
00176 #ifdef PKG_MALLOC
00177 {"mem_dump_pkg", CFG_VAR_INT, 0, 0, 0, mem_dump_pkg_cb,
00178 "dump process memory status, parameter: pid_number"},
00179 #endif
00180 #ifdef SHM_MEM
00181 {"mem_dump_shm", CFG_VAR_INT, 0, 0, mem_dump_shm_fixup, 0,
00182 "dump shared memory status"},
00183 #endif
00184 {"udp_mtu", CFG_VAR_INT|CFG_ATOMIC, 0, 65535, 0, 0,
00185 "fallback to a congestion controlled protocol if send size"
00186 " exceeds udp_mtu"},
00187 {"udp_mtu_try_proto", CFG_VAR_INT, 1, 4, 0, fix_global_req_flags,
00188 "if send size > udp_mtu use proto (1 udp, 2 tcp, 3 tls, 4 sctp)"},
00189 {"force_rport", CFG_VAR_INT, 0, 1, 0, fix_global_req_flags,
00190 "force rport for all the received messages" },
00191 {0, 0, 0, 0, 0, 0}
00192 };