Bugfix
This commit is contained in:
@@ -76,7 +76,7 @@ From the comparison, smartdns found the fastest IP address to visit www.baidu.co
|
|||||||
2. **Return the fastest IP address**
|
2. **Return the fastest IP address**
|
||||||
Supports finding the fastest access IP address from the IP address list of the domain name and returning it to the client to avoid DNS pollution and improve network access speed.
|
Supports finding the fastest access IP address from the IP address list of the domain name and returning it to the client to avoid DNS pollution and improve network access speed.
|
||||||
|
|
||||||
3. **Support for multiple query protocols**
|
3. **Support for multiple query protocols**
|
||||||
Support UDP, TCP, TLS queries, and non-53 port queries, effectively avoiding DNS pollution.
|
Support UDP, TCP, TLS queries, and non-53 port queries, effectively avoiding DNS pollution.
|
||||||
|
|
||||||
4. **Domain IP address specification**
|
4. **Domain IP address specification**
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ rtt min/avg/max/mdev = 5.954/6.133/6.313/0.195 ms
|
|||||||
|
|
||||||
## 特性
|
## 特性
|
||||||
|
|
||||||
1. **多DNS上游服务器**
|
1. **多DNS上游服务器**
|
||||||
支持配置多个上游DNS服务器,并同时进行查询,即使其中有DNS服务器异常,也不会影响查询。
|
支持配置多个上游DNS服务器,并同时进行查询,即使其中有DNS服务器异常,也不会影响查询。
|
||||||
|
|
||||||
2. **返回最快IP地址**
|
2. **返回最快IP地址**
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ SERVICE_DAEMONIZE=1
|
|||||||
SERVICE_PID_FILE="/var/run/smartdns.pid"
|
SERVICE_PID_FILE="/var/run/smartdns.pid"
|
||||||
BASECONFIGFILE="/etc/smartdns/smartdns.conf"
|
BASECONFIGFILE="/etc/smartdns/smartdns.conf"
|
||||||
SMARTDNS_CONF_DIR="/etc/smartdns"
|
SMARTDNS_CONF_DIR="/etc/smartdns"
|
||||||
SMARTDNS_CONF="/var/$SMARTDNS_CONF_DIR/smartdns.conf"
|
SMARTDNS_VAR_CONF_DIR="/var/etc/smartdns"
|
||||||
|
SMARTDNS_CONF="$SMARTDNS_VAR_CONF_DIR/smartdns.conf"
|
||||||
ADDRESS_CONF="$SMARTDNS_CONF_DIR/address.conf"
|
ADDRESS_CONF="$SMARTDNS_CONF_DIR/address.conf"
|
||||||
BLACKLIST_IP_CONF="$SMARTDNS_CONF_DIR/blacklist-ip.conf"
|
BLACKLIST_IP_CONF="$SMARTDNS_CONF_DIR/blacklist-ip.conf"
|
||||||
CUSTOM_CONF="$SMARTDNS_CONF_DIR/custom.conf"
|
CUSTOM_CONF="$SMARTDNS_CONF_DIR/custom.conf"
|
||||||
@@ -163,6 +164,11 @@ start_service() {
|
|||||||
local section="$1"
|
local section="$1"
|
||||||
args=""
|
args=""
|
||||||
|
|
||||||
|
mkdir -p $SMARTDNS_VAR_CONF_DIR
|
||||||
|
|
||||||
|
config_get_bool "enabled" "$section" "enabled" '0'
|
||||||
|
[ "$enabled" -gt 0 ] || return 1
|
||||||
|
|
||||||
config_get "server_name" "$section" "server_name" ""
|
config_get "server_name" "$section" "server_name" ""
|
||||||
if [ ! -z "$server_name" ]; then
|
if [ ! -z "$server_name" ]; then
|
||||||
conf_append "server-name" "$server_name"
|
conf_append "server-name" "$server_name"
|
||||||
@@ -191,8 +197,6 @@ start_service() {
|
|||||||
|
|
||||||
SMARTDNS_PORT="$port"
|
SMARTDNS_PORT="$port"
|
||||||
|
|
||||||
mkdir -p $SMARTDNS_CONF_DIR
|
|
||||||
|
|
||||||
config_get "cache_size" "$section" "cache_size" ""
|
config_get "cache_size" "$section" "cache_size" ""
|
||||||
if [ ! -z "$cache_size" ]; then
|
if [ ! -z "$cache_size" ]; then
|
||||||
conf_append "cache-size" "$cache_size"
|
conf_append "cache-size" "$cache_size"
|
||||||
@@ -213,12 +217,12 @@ start_service() {
|
|||||||
conf_append "rr-ttl-max" "$rr_ttl_max"
|
conf_append "rr-ttl-max" "$rr_ttl_max"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
config_get "log_size" "$section" "log_size" "128K"
|
config_get "log_size" "$section" "log_size" "64K"
|
||||||
if [ ! -z "$log_size" ]; then
|
if [ ! -z "$log_size" ]; then
|
||||||
conf_append "log-size" "$log_size"
|
conf_append "log-size" "$log_size"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
config_get "log_num" "$section" "log_num" "3"
|
config_get "log_num" "$section" "log_num" "1"
|
||||||
if [ ! -z "$log_num" ]; then
|
if [ ! -z "$log_num" ]; then
|
||||||
conf_append "log-num" "$log_num"
|
conf_append "log-num" "$log_num"
|
||||||
fi
|
fi
|
||||||
@@ -265,10 +269,8 @@ start_service() {
|
|||||||
echo "conf-file $ADDRESS_CONF" >> $SMARTDNS_CONF_TMP
|
echo "conf-file $ADDRESS_CONF" >> $SMARTDNS_CONF_TMP
|
||||||
echo "conf-file $BLACKLIST_IP_CONF" >> $SMARTDNS_CONF_TMP
|
echo "conf-file $BLACKLIST_IP_CONF" >> $SMARTDNS_CONF_TMP
|
||||||
echo "conf-file $CUSTOM_CONF" >> $SMARTDNS_CONF_TMP
|
echo "conf-file $CUSTOM_CONF" >> $SMARTDNS_CONF_TMP
|
||||||
|
|
||||||
config_get_bool "enabled" "$section" "enabled" '0'
|
|
||||||
mv $SMARTDNS_CONF_TMP $SMARTDNS_CONF
|
mv $SMARTDNS_CONF_TMP $SMARTDNS_CONF
|
||||||
[ "$enabled" -gt 0 ] || return 1
|
|
||||||
if [ "$COREDUMP" = "1" ]; then
|
if [ "$COREDUMP" = "1" ]; then
|
||||||
args="$args -S"
|
args="$args -S"
|
||||||
ulimit -c unlimited
|
ulimit -c unlimited
|
||||||
|
|||||||
@@ -930,7 +930,7 @@ static int _dns_client_process_udp(struct dns_server_info *server_info, struct e
|
|||||||
tlog(TLOG_DEBUG, "recv udp, from %s, ttl: %d", gethost_by_addr(from_host, (struct sockaddr *)&from, from_len), ttl);
|
tlog(TLOG_DEBUG, "recv udp, from %s, ttl: %d", gethost_by_addr(from_host, (struct sockaddr *)&from, from_len), ttl);
|
||||||
|
|
||||||
if ((ttl != server_info->ttl) && (server_info->ttl > 0) && (server_info->result_flag & DNSSERVER_FLAG_CHECK_TTL)) {
|
if ((ttl != server_info->ttl) && (server_info->ttl > 0) && (server_info->result_flag & DNSSERVER_FLAG_CHECK_TTL)) {
|
||||||
tlog(TLOG_DEBUG, "TTL mismatch, from:%d, local %d, discard result", ttl, server_info->ttl);
|
/* tlog(TLOG_DEBUG, "TTL mismatch, from:%d, local %d, discard result", ttl, server_info->ttl); */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user