aboutsummaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorGravatar Chris O'Haver <cohaver@infoblox.com> 2022-01-07 11:19:46 -0500
committerGravatar GitHub <noreply@github.com> 2022-01-07 11:19:46 -0500
commit37c0fcf4394a61098b4966f187525eea77e57704 (patch)
tree75f0d9d692062fd6b2924864af93c08653cb5701 /plugin
parentb546031f9b9507d01bf7d91889011f10e67c0bba (diff)
downloadcoredns-37c0fcf4394a61098b4966f187525eea77e57704.tar.gz
coredns-37c0fcf4394a61098b4966f187525eea77e57704.tar.zst
coredns-37c0fcf4394a61098b4966f187525eea77e57704.zip
persist truncated state to client if lookup response is truncated (#4712)
Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
Diffstat (limited to 'plugin')
-rw-r--r--plugin/dns64/dns64.go3
-rw-r--r--plugin/dns64/dns64_test.go55
2 files changed, 58 insertions, 0 deletions
diff --git a/plugin/dns64/dns64.go b/plugin/dns64/dns64.go
index 110bfeadd..9f426eb87 100644
--- a/plugin/dns64/dns64.go
+++ b/plugin/dns64/dns64.go
@@ -131,6 +131,9 @@ func (d *DNS64) Synthesize(origReq, origResponse, resp *dns.Msg) *dns.Msg {
ret := dns.Msg{}
ret.SetReply(origReq)
+ // persist truncated state of AAAA response
+ ret.Truncated = resp.Truncated
+
// 5.3.2: DNS64 MUST pass the additional section unchanged
ret.Extra = resp.Extra
ret.Ns = resp.Ns
diff --git a/plugin/dns64/dns64_test.go b/plugin/dns64/dns64_test.go
index de7ab65a8..5db83f163 100644
--- a/plugin/dns64/dns64_test.go
+++ b/plugin/dns64/dns64_test.go
@@ -434,6 +434,61 @@ func TestDNS64(t *testing.T) {
},
},
},
+ {
+ // no AAAA records, A record response truncated.
+ name: "truncated A response",
+ req: &dns.Msg{
+ MsgHdr: dns.MsgHdr{
+ Id: 42,
+ RecursionDesired: true,
+ Opcode: dns.OpcodeQuery,
+ },
+ Question: []dns.Question{{"example.com.", dns.TypeAAAA, dns.ClassINET}},
+ },
+ initResp: &dns.Msg{ //success, no answers
+ MsgHdr: dns.MsgHdr{
+ Id: 42,
+ Opcode: dns.OpcodeQuery,
+ RecursionDesired: true,
+ Rcode: dns.RcodeSuccess,
+ Response: true,
+ },
+ Question: []dns.Question{{"example.com.", dns.TypeAAAA, dns.ClassINET}},
+ Ns: []dns.RR{test.SOA("example.com. 70 IN SOA foo bar 1 1 1 1 1")},
+ },
+ aResp: &dns.Msg{
+ MsgHdr: dns.MsgHdr{
+ Id: 43,
+ Opcode: dns.OpcodeQuery,
+ RecursionDesired: true,
+ Truncated: true,
+ Rcode: dns.RcodeSuccess,
+ Response: true,
+ },
+ Question: []dns.Question{{"example.com.", dns.TypeA, dns.ClassINET}},
+ Answer: []dns.RR{
+ test.A("example.com. 60 IN A 192.0.2.42"),
+ test.A("example.com. 5000 IN A 192.0.2.43"),
+ },
+ },
+
+ resp: &dns.Msg{
+ MsgHdr: dns.MsgHdr{
+ Id: 42,
+ Opcode: dns.OpcodeQuery,
+ RecursionDesired: true,
+ Truncated: true,
+ Rcode: dns.RcodeSuccess,
+ Response: true,
+ },
+ Question: []dns.Question{{"example.com.", dns.TypeAAAA, dns.ClassINET}},
+ Answer: []dns.RR{
+ test.AAAA("example.com. 60 IN AAAA 64:ff9b::192.0.2.42"),
+ // override RR ttl to SOA ttl, since it's lower
+ test.AAAA("example.com. 70 IN AAAA 64:ff9b::192.0.2.43"),
+ },
+ },
+ },
}
_, pfx, _ := net.ParseCIDR("64:ff9b::/96")