no options request causes exception
Issuing a dns request made with python scapy module got me this error:
runtime error: /usr/local/lib/lua/resty/dns/server.lua:245: bad argument #1 to 'lshift' (number expected, got nil)
fix in a7fc349 . @andreaf74 @selboo If you use the subnet feature, try again. @andreaf74
Hello, I've tried the subnet feature branch but I got the same error (only on a different line) this time it happens even using a simple dig:
2019/07/23 13:51:25 [error] 8052#8052: *1250 lua entry thread aborted: runtime error: /usr/local/lib/lua/resty/dns/server.lua:286: bad argument #1 to 'lshift' (number expected, got nil) stack traceback: coroutine 0: [C]: in function 'lshift' /usr/local/lib/lua/resty/dns/server.lua:286: in function 'decode_request' content_by_lua(nginx.conf:297):38: in main chunk, udp client: xxxxxxx:53 , server: xxxxxx:53
I believe the problem is because the code doesn't actually check the RDLEN size. (line 278) If it is 0 it shouldn't go on with decoding.. I'll try to post a fix later..
Bye
@andreaf74 Can you provide the version of dig, and parameters? In theory it can't happen, I guess it maybe need to second recv.
按readme 中Synopsis 的说明搭建 执行 nslookup www.taobao.com 127.0.0.1 不会报错 而执行dig @127.0.0.1 www.taobao.com 出错
dig -v DiG 9.10.6
出错信息
2019/11/28 18:53:11 [error] 503566#503566: *10 lua entry thread aborted: runtime error: /usr/local/openresty/lualib/resty/dns/server.lua:286: bad argument #1 to 'lshift' (number expected, got nil)
stack traceback:
coroutine 0:
[C]: in function 'lshift'