aa65535/openwrt-chinadns

Suggest to use larger BUF_SIZE to avoid MESSAGE_TOO_LONG error

GhostFlying opened this issue · 7 comments

Sorry I do not know is here the right location to talk about the origin project as the origin one seems deprecated.

With my local dns, chinadns always throw the MESSAGE_TOO_LONG error and may fail when I query some specified domains.

Here is one example:

Sat Jan  7 22:53:30 2017 request osxapps.itunes.apple.com
Sat Jan  7 22:53:30 2017 chinadns.c:665 local_ns_initparse: Message too long
Sat Jan  7 22:53:30 2017 chinadns.c:665 local_ns_initparse: Message too long

Then here is the result should be:

 dig @127.0.0.1 -p 5300 osxapps.itunes.apple.com

; <<>> DiG 9.9.5-9+deb8u8-Debian <<>> @127.0.0.1 -p 5300 osxapps.itunes.apple.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 9097
;; flags: qr rd ra; QUERY: 1, ANSWER: 17, AUTHORITY: 13, ADDITIONAL: 4

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;osxapps.itunes.apple.com.	IN	A

;; ANSWER SECTION:
osxapps.itunes.apple.com. 63324	IN	CNAME	osxapps.itunes.g.aaplimg.com.
osxapps.itunes.g.aaplimg.com. 7677 IN	CNAME	osxapps-cn-lb.itunes-apple.com.akadns.net.
osxapps-cn-lb.itunes-apple.com.akadns.net. 185 IN CNAME	hls.itunes.apple.com.mwcname.com.
hls.itunes.apple.com.mwcname.com. 1451 IN CNAME	app.dlmix.ourdvs.com.
app.dlmix.ourdvs.com.	43	IN	A	115.231.84.49
app.dlmix.ourdvs.com.	43	IN	A	122.228.24.174
app.dlmix.ourdvs.com.	43	IN	A	180.101.30.33
app.dlmix.ourdvs.com.	43	IN	A	122.228.24.169
app.dlmix.ourdvs.com.	43	IN	A	122.228.233.194
app.dlmix.ourdvs.com.	43	IN	A	183.134.53.221
app.dlmix.ourdvs.com.	43	IN	A	221.229.203.169
app.dlmix.ourdvs.com.	43	IN	A	115.239.253.114
app.dlmix.ourdvs.com.	43	IN	A	122.228.24.172
app.dlmix.ourdvs.com.	43	IN	A	183.134.12.72
app.dlmix.ourdvs.com.	43	IN	A	122.228.237.165
app.dlmix.ourdvs.com.	43	IN	A	122.228.24.171
app.dlmix.ourdvs.com.	43	IN	A	122.225.28.142

;; AUTHORITY SECTION:
.			11809	IN	NS	k.root-servers.net.
.			11809	IN	NS	m.root-servers.net.
.			11809	IN	NS	a.root-servers.net.
.			11809	IN	NS	f.root-servers.net.
.			11809	IN	NS	h.root-servers.net.
.			11809	IN	NS	j.root-servers.net.
.			11809	IN	NS	i.root-servers.net.
.			11809	IN	NS	b.root-servers.net.
.			11809	IN	NS	d.root-servers.net.
.			11809	IN	NS	g.root-servers.net.
.			11809	IN	NS	e.root-servers.net.
.			11809	IN	NS	l.root-servers.net.
.			11809	IN	NS	c.root-servers.net.

;; ADDITIONAL SECTION:
a.root-servers.net.	15068	IN	A	198.41.0.4
e.root-servers.net.	15058	IN	AAAA	2001:500:a8::e
g.root-servers.net.	15059	IN	AAAA	2001:500:12::d0d

;; Query time: 5 msec
;; SERVER: 127.0.0.1#5300(127.0.0.1)
;; WHEN: Sat Jan 07 22:38:34 CST 2017
;; MSG SIZE  rcvd: 709

After some experiments I have done, the only cause is the dns response is larger than 512 bytes and the default BUF_SIZE of chinadns is 512. And I changed it to 1024 then it works well.

So I suggest to make some value larger as the default value.

如果上游使用的是dnscrypt-proxy,这个确实需要修改,不然有些域名无法解析。

I'm having the same issue here after installing 1.3.2-5, may I know how to change the BUF_SIZE? Thanks!

hi ghost flying, may i ask how to change the buf_size of chinadns? this shall be done before compiling the ipk or can be modified in the router firmware somewhere?

hi dear Ghost Flying, you can direct me a way of getting that modified patch?

this patch is the one that included in the patches folder of package--->chinadns ? and the file name starts with 00002-Use-to-define?

very nice of your reply!

fix via 6d24a52