Skip to content

Add support for blocked replies with NOERROR code and empty answer#8245

Open
agross wants to merge 1 commit intoAdguardTeam:masterfrom
agross:fix-8024
Open

Add support for blocked replies with NOERROR code and empty answer#8245
agross wants to merge 1 commit intoAdguardTeam:masterfrom
agross:fix-8024

Conversation

@agross
Copy link
Copy Markdown

@agross agross commented Feb 11, 2026

Hello,

I'm not a Go developer by trade and not a DNS expert; please be gentle.

I found #8024 is affecting me.

The default behavior of returning the null address makes localhost reachable under blocked names. This causes errors and unwanted behavior, like being able to ping blocked hosts (by talking to localhost).

Returning NXDOMAIN or REFUSED, on the other hand, will cause extra DNS queries with the search domain appended, i.e., blocked.example.com becomes blocked.example.com.local.domain.com.

By returning NOERROR without an answer section, these problems go away.

With this patch, AdGuard will return a response similar to resolving a non-existing name, i.e., asking a question but not getting an answer:

$ dig doesntexist.example.com # not blocked
...
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 52361
...
;; QUESTION SECTION:
;doesntexist.example.com.       IN      A

;; AUTHORITY SECTION:
example.com.            1708    IN      SOA     elliott.ns.cloudflare.com. dns.cloudflare.com. 2395194487 10000 2400 604800 1800

If NOERROR is selected and a blocked name is requested, it looks like this:

$ dig ogads-pa.clients6.google.com # blocked by AdGuard DNS filter
...
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 8474
...
;; QUESTION SECTION:
;ogads-pa.clients6.google.com.  IN      A

;; AUTHORITY SECTION:
ogads-pa.clients6.google.com. 10 IN     SOA     fake-for-negative-caching.adguard.com. hostmaster.ogads-pa.clients6.google.com. 100500 1800 900 604800 86400

Closes #8024

Copy link
Copy Markdown

@windsurf-bot windsurf-bot Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 To request another review, post a new comment with "/windsurf-review".

filtering.BlockingModeDefault,
filtering.BlockingModeNXDOMAIN,
filtering.BlockingModeREFUSED,
filtering.BlockingModeNOERROR,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR adds filtering.BlockingModeNOERROR to the list of valid blocking modes, but I don't see a corresponding implementation in the filtering package. Make sure this mode is properly implemented in the filtering package to handle blocked domains with NOERROR responses without answer sections.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a new approach to responding to filtered queries, not a new method for filtering.

@agross agross force-pushed the fix-8024 branch 2 times, most recently from 4deb43d to f53fdba Compare March 5, 2026 00:37
@github-actions github-actions Bot force-pushed the fix-8024 branch 3 times, most recently from 8793a81 to 524f303 Compare March 12, 2026 04:57
@github-actions github-actions Bot force-pushed the fix-8024 branch 3 times, most recently from 3d04800 to 2576ed7 Compare March 21, 2026 04:47
@github-actions github-actions Bot force-pushed the fix-8024 branch 5 times, most recently from 63d944c to 3c7d59d Compare April 2, 2026 05:14
@github-actions github-actions Bot force-pushed the fix-8024 branch 6 times, most recently from 791c59e to d303033 Compare April 11, 2026 05:04
@github-actions github-actions Bot force-pushed the fix-8024 branch 4 times, most recently from a6a6155 to d1cec80 Compare April 18, 2026 05:17
@github-actions github-actions Bot force-pushed the fix-8024 branch 3 times, most recently from de66c70 to 7098c29 Compare April 25, 2026 05:22
@github-actions github-actions Bot force-pushed the fix-8024 branch 2 times, most recently from 255facd to cfa0982 Compare May 6, 2026 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add "Blank" block mode

1 participant