AdguardTeam / AdguardTeam/AdGuardHome

Retry without ECS when `REFUSED` returned from resolver (RFC 7871 7.1.3)

未關閉
#3,652 5 則留言 6 個 reaction 已指派 1 人 已被 @EugeneOne1 認領 在 GitHub 檢視
enhancement P4: Low
主要語言
TypeScript
星號
36.9k
分支
2.5k
PR 合併指標
30 天內沒有已合併 PR

描述

### Problem Description

Per https://groups.google.com/g/public-dns-announce/c/h4XLjnWvAp8 (Jan 15, 2020) and RFC 7871 section 7.1.3, resolvers including Google DNS returns `REFUSED`...

> we plan to start sending REFUSED responses to queries with non-zero address ECS that is not a prefix of the source address

I came across this when I realized that Google was discarding subnet info in ECS data despite it being valid, for certain domains.

If I make this query from my subnet (without ECS) it returns properly.
However with ECS, for this specific Akamai domain:

```
2021/09/24 20:20:00.049785 1#561 [debug] github.com/AdguardTeam/dnsproxy/proxy.(*Proxy).handleTCPConnection(): Start handling the new tls connection xx.107.179.25:37562
2021/09/24 20:20:00.123522 1#561 [debug] github.com/AdguardTeam/dnsproxy/proxy.(*Proxy).logDNSMessage(): IN: ;; opcode: QUERY, status: NOERROR, id: 27442
;; flags: rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; QUESTION SECTION:
;a1806.dscb.akamai.net. IN A

;; ADDITIONAL SECTION:

;; OPT PSEUDOSECTION:
; EDNS: version 0; flags: ; udp: 4096
; PADDING: 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

2021/09/24 20:20:00.123627 1#561 [debug] etchosts: answer: a1806.dscb.akamai.net -> []
2021/09/24 20:20:00.123662 1#561 [debug] Set ECS data: xx.107.179.0/24
2021/09/24 20:20:00.123708 1#561 [debug] https://dns.google:443/dns-query: sending request A a1806.dscb.akamai.net.
2021/09/24 20:20:00.140740 1#561 [debug] https://dns.google:443/dns-query: response: ok
2021/09/24 20:20:00.140815 1#561 [debug] github.com/AdguardTeam/dnsproxy/proxy.exchangeWithUpstream(): upstream https://dns.google:443/dns-query successfully finished exchange of ;a1806.dscb.akamai.net. IN A. Elapsed 17.101508ms.
2021/09/24 20:20:00.140873 1#561 [debug] github.com/AdguardTeam/dnsproxy/proxy.(*Proxy).replyFromUpstream(): RTT: 17.174509ms
2021/09/24 20:20:00.140898 1#561 [debug] ECS option in response: xx.107.179.0/0
2021/09/24 20:20:00.140988 1#561 [debug] ipset: starting processing
2021/09/24 20:20:00.141011 1#561 [debug] ipset: added 0 new ipset entries
2021/09/24 20:20:00.141063 1#561 [debug] github.com/AdguardTeam/dnsproxy/proxy.(*Proxy).logDNSMessage(): OUT: ;; opcode: QUERY, status: REFUSED, id: 27442
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; QUESTION SECTION:
;a1806.dscb.akamai.net. IN A

;; ADDITIONAL SECTION:

;; OPT PSEUDOSECTION:
; EDNS: version 0; flags: ; udp: 4096
```

I was able to use dns.google to actually verify this issue:

```json
// Using ECS xx.107.179.0/24
{
"Status": 5,
"TC": false,
"RD": true,
"RA": true,
"AD": false,
"CD": false,
"Question": [
{
"name": "a1806.dscb.akamai.net.",
"type": 1
}
],
"edns_client_subnet": "xx.107.179.0/0"
}
```

### Proposed Solution

1. Implement RFC 7871 section 7.1.3
2. Denote in the UI that the query was done without ECS (if enabled)

### Additional Information

**EDIT**: This seems to be the case with Google Public DNS and Akamai domains only (`akamai.net`, `akamaiedge.net`, `akadns.net`, etc)

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。