diff --git a/luci-app-ssr-plus/root/etc/init.d/shadowsocksr b/luci-app-ssr-plus/root/etc/init.d/shadowsocksr index 3dd79ca87..edf2a4205 100755 --- a/luci-app-ssr-plus/root/etc/init.d/shadowsocksr +++ b/luci-app-ssr-plus/root/etc/init.d/shadowsocksr @@ -81,7 +81,15 @@ get_host_ip() { fi fi [ -z "$ip" ] || uci_set_by_name $1 ip $ip - echo ${ip:="$(uci_get_by_name $1 ip "ERROR")"} + [ -n "$ip" ] || ip="$(uci_get_by_name $1 ip "ERROR")" + + local chinadns="$(uci_get_by_type global chinadns_forward)" + if [ -n "$chinadns" ] && [ "$ip" != "$host" ]; then + grep -q "$host" "$TMP_DNSMASQ_PATH/chinadns_fixed_server.conf" 2>"/dev/null" || \ + echo -e "address=/$host/$ip" >> "$TMP_DNSMASQ_PATH/chinadns_fixed_server.conf" + fi + + echo $ip } clean_log() { @@ -186,6 +194,7 @@ start_dns() { pdnsd_enable_flag=2 ;; esac + if [ "$run_mode" = "router" ]; then local chinadns="$(uci_get_by_type global chinadns_forward)" if [ -n "$chinadns" ]; then