{"action":"created","issue":{"url":"https://api.github.com/repos/chengr28/Pcap_DNSProxy/issues/175","repository_url":"https://api.github.com/repos/chengr28/Pcap_DNSProxy","labels_url":"https://api.github.com/repos/chengr28/Pcap_DNSProxy/issues/175/labels{/name}","comments_url":"https://api.github.com/repos/chengr28/Pcap_DNSProxy/issues/175/comments","events_url":"https://api.github.com/repos/chengr28/Pcap_DNSProxy/issues/175/events","html_url":"https://github.com/chengr28/Pcap_DNSProxy/issues/175","id":163055965,"number":175,"title":"移动宽带（CMCC,4G）UDP 协议解析超时","user":{"login":"hyxxsfwy","id":3905989,"avatar_url":"https://avatars.githubusercontent.com/u/3905989?v=3","gravatar_id":"","url":"https://api.github.com/users/hyxxsfwy","html_url":"https://github.com/hyxxsfwy","followers_url":"https://api.github.com/users/hyxxsfwy/followers","following_url":"https://api.github.com/users/hyxxsfwy/following{/other_user}","gists_url":"https://api.github.com/users/hyxxsfwy/gists{/gist_id}","starred_url":"https://api.github.com/users/hyxxsfwy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyxxsfwy/subscriptions","organizations_url":"https://api.github.com/users/hyxxsfwy/orgs","repos_url":"https://api.github.com/users/hyxxsfwy/repos","events_url":"https://api.github.com/users/hyxxsfwy/events{/privacy}","received_events_url":"https://api.github.com/users/hyxxsfwy/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/chengr28/Pcap_DNSProxy/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-06-30T00:19:33Z","updated_at":"2016-06-30T03:40:55Z","closed_at":null,"body":"#### 版本号及运行环境\r\n+ 版本号：Pcap_DNSProxy.exe; 0.4.6.5\r\n+ 运行环境：Windows NT 6.1; WOW64\r\n\r\n#### 问题重现步骤\r\n在移动运营商（CMCC或者移动4G网）的网络环境中，指定 DNS 解析协议为 IPV4 + UDP，则 DNS 解析全部超时。但相同网络环境下，dig 查询```IPv4 Local DNS Address```对应的 DNS 服务器可以返回正确结果。\r\n\r\n+ 指定协议 IPV4 + TCP 时，可以正确解析：\r\n\t```\r\n\t$ dig @127.0.0.1 v.youku.com\r\n\r\n\t; <<>> DiG 9.10.3-P4 <<>> @127.0.0.1 v.youku.com\r\n\t; (1 server found)\r\n\t;; global options: +cmd\r\n\t;; Got answer:\r\n\t;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 24451\r\n\t;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1\r\n\r\n\t;; OPT PSEUDOSECTION:\r\n\t; EDNS: version: 0, flags:; udp: 4096\r\n\t;; QUESTION SECTION:\r\n\t;v.youku.com.                   IN      A\r\n\r\n\t;; ANSWER SECTION:\r\n\tv.youku.com.            193     IN      CNAME   b28-yk-v.youku.com.\r\n\tb28-yk-v.youku.com.     920     IN      A       43.250.12.43\r\n\r\n\t;; Query time: 374 msec\r\n\t;; SERVER: 127.0.0.1#53(127.0.0.1)\r\n\t;; WHEN: 周四 六月 30 06:59:11 CST 2016\r\n\t;; MSG SIZE  rcvd: 79\r\n\t```\r\n\r\n+ 指定协议 IPV4 + UDP 时，解析超时：\r\n\t```\r\n\t$ dig @127.0.0.1 v.youku.com\r\n\r\n\t; <<>> DiG 9.10.3-P4 <<>> @127.0.0.1 v.youku.com\r\n\t; (1 server found)\r\n\t;; global options: +cmd\r\n\t;; connection timed out; no servers could be reached\r\n\t```\r\n\r\n+ 同时，直接 dig 查询则没有问题：\r\n\r\n\t```\r\n\t$ dig @223.6.6.6 v.youku.com\r\n\r\n\t; <<>> DiG 9.10.3-P4 <<>> @223.6.6.6 v.youku.com\r\n\t; (1 server found)\r\n\t;; global options: +cmd\r\n\t;; Got answer:\r\n\t;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 31306\r\n\t;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0\r\n\r\n\t;; QUESTION SECTION:\r\n\t;v.youku.com.                   IN      A\r\n\r\n\t;; ANSWER SECTION:\r\n\tv.youku.com.            15      IN      CNAME   b28-yk-v.youku.com.\r\n\tb28-yk-v.youku.com.     15      IN      A       43.250.12.43\r\n\r\n\t;; Query time: 93 msec\r\n\t;; SERVER: 223.6.6.6#53(223.6.6.6)\r\n\t;; WHEN: 周四 六月 30 07:05:32 CST 2016\r\n\t;; MSG SIZE  rcvd: 68\r\n\r\n\t$ dig +tcp @223.6.6.6 v.youku.com\r\n\r\n\t; <<>> DiG 9.10.3-P4 <<>> +tcp @223.6.6.6 v.youku.com\r\n\t; (1 server found)\r\n\t;; global options: +cmd\r\n\t;; Got answer:\r\n\t;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 41767\r\n\t;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1\r\n\r\n\t;; OPT PSEUDOSECTION:\r\n\t; EDNS: version: 0, flags:; udp: 4096\r\n\t;; QUESTION SECTION:\r\n\t;v.youku.com.                   IN      A\r\n\r\n\t;; ANSWER SECTION:\r\n\tv.youku.com.            60      IN      CNAME   b28-yk-v.youku.com.\r\n\tb28-yk-v.youku.com.     575     IN      A       43.250.12.43\r\n\r\n\t;; Query time: 187 msec\r\n\t;; SERVER: 223.6.6.6#53(223.6.6.6)\r\n\t;; WHEN: 周四 六月 30 07:06:24 CST 2016\r\n\t;; MSG SIZE  rcvd: 79\r\n\t```\r\n\r\n#### 期望和实际的程序行为\r\n+ 预期通过 UDP 或者 TCP 查询均可返回正确数据；\r\n+ 实际 UDP 查询返回超时，无法通过 UDP 解析 DNS；\r\n+ TCP 查询，配合国内路由表，无法返回正确的国内 IP 地址。\r\n\r\n#### 与默认配置不同的部分\r\n```ini\r\n……\r\n\r\n[DNS]\r\nProtocol = IPv4 + UDP\r\nDirect Request = 0\r\nCache Type = Queue\r\nCache Parameter = 1024\r\nDefault TTL = 3600\r\n\r\n[Local DNS]\r\nLocal Protocol = IPv4 + UDP\r\nLocal Force Request = 1\r\nLocal Hosts = 1\r\nLocal Main = 0\r\nLocal Routing = 0\r\n\r\n[Addresses]\r\nIPv4 Listen Address = \r\nIPv4 EDNS Client Subnet Address =\r\nIPv4 DNS Address = 8.8.4.4:53\r\nIPv4 Alternate DNS Address = 8.8.8.8:53|208.67.220.220:443|208.67.222.222:5353\r\nIPv4 Local DNS Address = 223.6.6.6:53\r\nIPv4 Local Alternate DNS Address = 114.114.115.115:53\r\n……\r\n\r\n[Switches]\r\nTCP Fast Open = 0\r\nDomain Case Conversion = 0\r\nCompression Pointer Mutation = 0\r\nEDNS Label = 1\r\n……\r\n```\r\n\r\n或者换成下面这样，问题依旧：\r\n```ini\r\n[Local DNS]\r\nLocal Protocol = IPv4 + UDP\r\nLocal Force Request = 0\r\nLocal Hosts = 0\r\nLocal Main = 1\r\nLocal Routing = 1\r\n```\r\n\r\n另外，当启用 TCP 查询并使用如下参数时，会解析到海外IP，\r\n```ini\r\n[Local DNS]\r\nLocal Protocol = IPv4 + TCP + UDP\r\nLocal Force Request = 0\r\nLocal Hosts = 0\r\nLocal Main = 1\r\nLocal Routing = 1\r\n```\r\n```\r\n$ dig @127.0.0.1 v.youku.com\r\n\r\n; <<>> DiG 9.10.3-P4 <<>> @127.0.0.1 v.youku.com\r\n; (1 server found)\r\n;; global options: +cmd\r\n;; Got answer:\r\n;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 20687\r\n;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 1\r\n\r\n;; OPT PSEUDOSECTION:\r\n; EDNS: version: 0, flags:; udp: 16384\r\n;; QUESTION SECTION:\r\n;v.youku.com.                   IN      A\r\n\r\n;; ANSWER SECTION:\r\nv.youku.com.            165     IN      CNAME   gz-inter-v.youku.com.\r\ngz-inter-v.youku.com.   3465    IN      A       202.46.41.178\r\ngz-inter-v.youku.com.   3465    IN      A       202.46.41.176\r\ngz-inter-v.youku.com.   3465    IN      A       202.46.41.179\r\ngz-inter-v.youku.com.   3465    IN      A       202.46.41.177\r\n\r\n;; Query time: 655 msec\r\n;; SERVER: 127.0.0.1#53(127.0.0.1)\r\n;; WHEN: 周四 六月 30 07:47:50 CST 2016\r\n;; MSG SIZE  rcvd: 129\r\n```\r\n\r\n#### 程序错误日志\r\n\r\nError.log 中无相关报错信息。\r\ndig 查询抓包文件见 [Pcapng_ChinaMobile.zip](https://dl.dropboxusercontent.com/u/81625521/atts/16.06/Pcapng_ChinaMobile.zip \"https://dl.dropboxusercontent.com/u/81625521/atts/16.06/Pcapng_ChinaMobile.zip\")。\r\n"},"comment":{"url":"https://api.github.com/repos/chengr28/Pcap_DNSProxy/issues/comments/229551955","html_url":"https://github.com/chengr28/Pcap_DNSProxy/issues/175#issuecomment-229551955","issue_url":"https://api.github.com/repos/chengr28/Pcap_DNSProxy/issues/175","id":229551955,"user":{"login":"chengr28","id":1025140,"avatar_url":"https://avatars.githubusercontent.com/u/1025140?v=3","gravatar_id":"","url":"https://api.github.com/users/chengr28","html_url":"https://github.com/chengr28","followers_url":"https://api.github.com/users/chengr28/followers","following_url":"https://api.github.com/users/chengr28/following{/other_user}","gists_url":"https://api.github.com/users/chengr28/gists{/gist_id}","starred_url":"https://api.github.com/users/chengr28/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chengr28/subscriptions","organizations_url":"https://api.github.com/users/chengr28/orgs","repos_url":"https://api.github.com/users/chengr28/repos","events_url":"https://api.github.com/users/chengr28/events{/privacy}","received_events_url":"https://api.github.com/users/chengr28/received_events","type":"User","site_admin":false},"created_at":"2016-06-30T03:40:55Z","updated_at":"2016-06-30T03:40:55Z","body":"0.4.6.x 版本的境内解析部分的确是出问题了，之前这边测试的时候这边有发现\r\n解析到境外地址也是因为这个，稍后会发一个新版本修复这个问题"}}
{"actor":{"display_login":"chengr28"}}