Commit Graph

2 Commits

Author SHA1 Message Date
Sueun Cho
9a623cdeed plugin/rewrite: apply rcode rewrites to responses with no records (#8421)
* plugin/rewrite: apply rcode rewrites to record-less responses

An rcode rewrite rewrites the message-level RCODE, but the reverter only ran
response rules from inside the per-record loops in WriteMsg. When a response
carries no answer, authority or additional records - for example a bare
SERVFAIL that a downstream plugin returns to a non-EDNS client - none of the
loops iterate, so the rcode rewrite was silently skipped and the client
received the original RCODE.

Apply message-level response rules once when the response has no records, using
a small marker interface that mirrors the existing requestExtraRevertRule
pattern. This fixes the plugin's documented SERVFAIL-to-NOERROR use case for
responses without records.

Signed-off-by: Sueun Cho <sueun.dev@gmail.com>

* plugin/rewrite: apply fallback rcode rewrites for continue

Signed-off-by: Sueun Cho <sueun.dev@gmail.com>

---------

Signed-off-by: Sueun Cho <sueun.dev@gmail.com>
2026-08-18 11:12:32 +08:00
maximilize
9ddc4fdb8f plugin/rewrite: test EDNS0 revert with a record present and on the replace path (#8315)
Adds two regression tests for #8234 that the existing suite does not cover:

- an OPT-less upstream reply that carries a record, so the per-record
  response rules run while the request OPT is reused by ScrubWriter;
- a request that already carries the option, where "set ... revert" must
  put the client's original value back rather than just drop the option.

Both fail against the tree before #8235 and pass on current master.

Signed-off-by: maximilize <3752128+maximilize@users.noreply.github.com>
2026-08-03 18:13:46 -07:00