Modify the detection method of smartdns

This commit is contained in:
Nick Peng
2019-12-21 11:28:37 +08:00
parent aaeae7167b
commit 982002e836
4 changed files with 50 additions and 38 deletions

View File

@@ -252,16 +252,16 @@ https://github.com/pymumu/smartdns/releases
1. 检测服务是否配置成功。
使用`nslookup -querytype=ptr 0.0.0.0`查询域名
使用`nslookup -querytype=ptr smartdns`查询域名
看命令结果中的`name`项目是否显示为`smartdns`或`主机名`,如`smartdns`则表示生效
```shell
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr 0.0.0.0
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr smartdns
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
0.0.0.0.in-addr.arpa name = smartdns.
smartdns name = smartdns.
```
### openwrt/LEDE
@@ -296,16 +296,16 @@ https://github.com/pymumu/smartdns/releases
* **检测转发服务是否配置成功**
使用`nslookup -querytype=ptr 0.0.0.0`查询域名
使用`nslookup -querytype=ptr smartdns`查询域名
看命令结果中的`name`项目是否显示为`smartdns`或`主机名`,如`smartdns`则表示生效
```shell
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr 0.0.0.0
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr smartdns
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
0.0.0.0.in-addr.arpa name = smartdns.
smartdns name = smartdns.
```
* **界面提示重定向失败**
@@ -329,16 +329,16 @@ https://github.com/pymumu/smartdns/releases
* **检测上游服务是否配置成功**
* 方法一:使用`nslookup -querytype=ptr 0.0.0.0`查询域名
* 方法一:使用`nslookup -querytype=ptr smartdns`查询域名
看命令结果中的`name`项目是否显示为`smartdns`或`主机名`,如`smartdns`则表示生效
```shell
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr 0.0.0.0
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr smartdns
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
0.0.0.0.in-addr.arpa name = smartdns.
smartdns name = smartdns.
```
* 方法二:使用`nslookup`查询`www.baidu.com`域名查看结果中百度的IP地址是否`只有一个`如有多个IP地址返回则表示未生效请多尝试几个域名检查。
@@ -393,16 +393,16 @@ https://github.com/pymumu/smartdns/releases
1. 重启路由器生效服务
待路由器启动后,使用`nslookup -querytype=ptr 0.0.0.0`查询域名
待路由器启动后,使用`nslookup -querytype=ptr smartdns`查询域名
看命令结果中的`name`项目是否显示为`smartdns`或`主机名`,如`smartdns`则表示生效
```shell
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr 0.0.0.0
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr smartdns
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
0.0.0.0.in-addr.arpa name = smartdns.
smartdns name = smartdns.
```
1. 额外说明
@@ -469,16 +469,16 @@ https://github.com/pymumu/smartdns/releases
1. 重启路由器生效服务
待路由器启动后,使用`nslookup -querytype=ptr 0.0.0.0`查询域名
待路由器启动后,使用`nslookup -querytype=ptr smartdns`查询域名
看命令结果中的`name`项目是否显示为`smartdns`或`主机名`,如`smartdns`则表示生效
```shell
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr 0.0.0.0
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr smartdns
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
0.0.0.0.in-addr.arpa name = smartdns.
smartdns name = smartdns.
```
注意若服务没有自动启动则需要设置optwre/entware自动启动具体方法参考optware/entware的文档。
@@ -526,16 +526,16 @@ https://github.com/pymumu/smartdns/releases
1. 检测服务是否配置成功。
使用`nslookup -querytype=ptr 0.0.0.0`查询域名
使用`nslookup -querytype=ptr smartdns`查询域名
看命令结果中的`name`项目是否显示为`smartdns`或`主机名`,如`smartdns`则表示生效
```shell
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr 0.0.0.0
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr smartdns
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
0.0.0.0.in-addr.arpa name = smartdns.
smartdns name = smartdns.
```
## 配置参数

View File

@@ -247,16 +247,16 @@ https://github.com/pymumu/smartdns/releases
1. Check if the service is configured successfully
Query domain name with `nslookup -querytype=ptr 0.0.0.0`
Query domain name with `nslookup -querytype=ptr smartdns`
Check if the `name` item in the command result is displayed as `smartdns` or `hostname`, such as `smartdns`
```shell
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr 0.0.0.0
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr smartdns
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
0.0.0.0.in-addr.arpa name = smartdns.
smartdns name = smartdns.
```
### openwrt/LEDE
@@ -291,16 +291,16 @@ https://github.com/pymumu/smartdns/releases
* **Check if the service is configured successfully**
Query domain name with `nslookup -querytype=ptr 0.0.0.0`
Query domain name with `nslookup -querytype=ptr smartdns`
See if the `name` item in the command result is displayed as `smartdns` or `hostname`, such as `smartdns`
```shell
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr 0.0.0.0
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr smartdns
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
0.0.0.0.in-addr.arpa name = smartdns.
smartdns name = smartdns.
```
* **The interface prompts that the redirect failed**
@@ -328,12 +328,12 @@ https://github.com/pymumu/smartdns/releases
See if the `name` item in the command result is displayed as `smartdns` or `hostname`, such as `smartdns`
```shell
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr 0.0.0.0
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr smartdns
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
0.0.0.0.in-addr.arpa name = smartdns.
smartdns name = smartdns.
```
* Method 2: Use `nslookup` to query the `www.baidu.com` domain name to see if the IP address of Baidu in the result is `only one. If there are multiple IP addresses returned, it means that it is not valid. Please try to check several domain names.
@@ -388,16 +388,16 @@ Note: Merlin firmware is derived from ASUS firmware and can theoretically be use
1. Restart router
After the router is started, use `nslookup -querytype=ptr 0.0.0.0` to query the domain name.
After the router is started, use `nslookup -querytype=ptr smartdns` to query the domain name.
See if the `name` item in the command result is displayed as `smartdns` or `hostname`, such as `smartdns`
```shell
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr 0.0.0.0
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr smartdns
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
0.0.0.0.in-addr.arpa name = smartdns.
smartdns name = smartdns.
```
1. Note
@@ -464,16 +464,16 @@ Note: Merlin firmware is derived from ASUS firmware and can theoretically be use
1. Restart the router to take effect
After the router is started, use `nslookup -querytype=ptr 0.0.0.0` to query the domain name.
After the router is started, use `nslookup -querytype=ptr smartdns` to query the domain name.
See if the `name` item in the command result is displayed as `smartdns` or `hostname`, such as `smartdns`
```shell
Pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr 0.0.0.0
Pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr smartdns
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
0.0.0.0.in-addr.arpa name = smartdns.
smartdns name = smartdns.
```
Note: If the service does not start automatically, you need to set optwre/entware to start automatically. For details, see the optware/entware documentation.
@@ -521,16 +521,16 @@ Note: Merlin firmware is derived from ASUS firmware and can theoretically be use
1. Check if the service is configured successfully
Query domain name with `nslookup -querytype=ptr 0.0.0.0`
Query domain name with `nslookup -querytype=ptr smartdns`
Check if the `name` item in the command result is displayed as `smartdns` or `hostname`, such as `smartdns`
```shell
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr 0.0.0.0
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr smartdns
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
0.0.0.0.in-addr.arpa name = smartdns.
smartdns name = smartdns.
```
## Configuration parameter

View File

@@ -17,18 +17,25 @@
BIN=smartdns
OBJS_LIB=lib/rbtree.o lib/art.o lib/bitops.o lib/radix.o lib/conf.o
OBJS=smartdns.o fast_ping.o dns_client.o dns_server.o dns.o util.o tlog.o dns_conf.o dns_cache.o http_parse.o $(OBJS_LIB)
CFLAGS +=-O2 -g -Wall -Wstrict-prototypes -fno-omit-frame-pointer -Wstrict-aliasing
# cflags
ifndef CFLAGS
CFLAGS =-O2 -g -Wall -Wstrict-prototypes -fno-omit-frame-pointer -Wstrict-aliasing
endif
override CFLAGS +=-Iinclude
override CFLAGS += -DBASE_FILE_NAME=\"$(notdir $<)\"
ifdef VER
override CFLAGS += -DSMARTDNS_VERION=\"$(VER)\"
endif
CXXFLAGS=-O2 -g -Wall -std=c++11
override CXXFLAGS +=-Iinclude
# ldflags
ifeq ($(STATIC), yes)
LDFLAGS += -lssl -lcrypto -Wl,--whole-archive -lpthread -Wl,--no-whole-archive -ldl -static
override LDFLAGS += -lssl -lcrypto -Wl,--whole-archive -lpthread -Wl,--no-whole-archive -ldl -static
else
LDFLAGS += -lssl -lcrypto -lpthread
override LDFLAGS += -lssl -lcrypto -lpthread
endif
.PHONY: all

View File

@@ -1688,6 +1688,11 @@ static int _dns_server_process_ptr(struct dns_request *request)
found = 1;
}
/* Determine if the smartdns service is in effect. */
if (found == 0 && strncmp(request->domain, "smartdns", sizeof("smartdns")) == 0) {
found = 1;
}
if (found == 0) {
goto errout;
}