Skip to content

Error in bahavior when CNAME point at its owner name #6421

Description

@matsduf

What happened:

I have the following zone

$TTL 3600
$ORIGIN cname.recursor.engine.xa.

@                       SOA  (
                                   ns1
                                   root
                                   2023111502
                                   86400
                                   14400
                                   3600000
                                   3600
                                 )

@                       NS    ns1
ns1                     A     127.30.1.31
ns1                     AAAA  fda1:b2:c3:0:127:30:1:31

; For scenario LOOPED-CNAME-IN-ZONE-1
looped-cname-in-zone-1        CNAME looped-cname-in-zone-1

I load it with the following configuration

cname.recursor.engine.xa:53 {
   bind 127.30.1.31
   bind fda1:b2:c3:0:127:30:1:31
   log
   file Engine/Recursor-PM/cname.recursor.engine.xa cname.recursor.engine.xa.
}

(Yes, there is intentionally a loop in the CNAME. It is for testing of the DNS testing tool Zonemaster.)

I send the following query and the the response

; <<>> DiG 9.18.18-0ubuntu0.22.04.1-Ubuntu <<>> @127.30.1.31 looped-cname-in-zone-1.cname.recursor.engine.xa +norec
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 28328
;; flags: qr aa; QUERY: 1, ANSWER: 10, AUTHORITY: 1, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: a2c556a54de5df7a (echoed)
;; QUESTION SECTION:
;looped-cname-in-zone-1.cname.recursor.engine.xa. IN A

;; ANSWER SECTION:
looped-cname-in-zone-1.cname.recursor.engine.xa. 3600 IN CNAME looped-cname-in-zone-1.cname.recursor.engine.xa.
looped-cname-in-zone-1.cname.recursor.engine.xa. 3600 IN CNAME looped-cname-in-zone-1.cname.recursor.engine.xa.
looped-cname-in-zone-1.cname.recursor.engine.xa. 3600 IN CNAME looped-cname-in-zone-1.cname.recursor.engine.xa.
looped-cname-in-zone-1.cname.recursor.engine.xa. 3600 IN CNAME looped-cname-in-zone-1.cname.recursor.engine.xa.
looped-cname-in-zone-1.cname.recursor.engine.xa. 3600 IN CNAME looped-cname-in-zone-1.cname.recursor.engine.xa.
looped-cname-in-zone-1.cname.recursor.engine.xa. 3600 IN CNAME looped-cname-in-zone-1.cname.recursor.engine.xa.
looped-cname-in-zone-1.cname.recursor.engine.xa. 3600 IN CNAME looped-cname-in-zone-1.cname.recursor.engine.xa.
looped-cname-in-zone-1.cname.recursor.engine.xa. 3600 IN CNAME looped-cname-in-zone-1.cname.recursor.engine.xa.
looped-cname-in-zone-1.cname.recursor.engine.xa. 3600 IN CNAME looped-cname-in-zone-1.cname.recursor.engine.xa.
looped-cname-in-zone-1.cname.recursor.engine.xa. 3600 IN CNAME looped-cname-in-zone-1.cname.recursor.engine.xa.

;; AUTHORITY SECTION:
cname.recursor.engine.xa. 3600	IN	NS	ns1.cname.recursor.engine.xa.

;; Query time: 0 msec
;; SERVER: 127.30.1.31#53(127.30.1.31) (UDP)
;; WHEN: Wed Nov 29 11:10:34 UTC 2023
;; MSG SIZE  rcvd: 246

I do not like to see multiple copies of the same DNS record in the answer section so I updated the configuration with a template section:

# ns1 cname.recursor.engine.xa                                                                                                                                                                    
cname.recursor.engine.xa:53 {
   bind 127.30.1.31
   bind fda1:b2:c3:0:127:30:1:31
   log
   file Engine/Recursor-PM/cname.recursor.engine.xa cname.recursor.engine.xa.

   template IN A looped-cname-in-zone-1.cname.recursor.engine.xa {
      answer     "looped-cname-in-zone-1.cname.recursor.engine.xa. 3600 IN CNAME looped-cname-in-zone-1.cname.recursor.engine.xa."
      authority  "cname.recursor.engine.xa. 3600        IN      NS      ns1.cname.recursor.engine.xa."
   }

}

I resent the query, but now I do not get any response (but I get responses when I send queries for other query names):

;; communications error to 127.30.1.31#53: timed out
;; communications error to 127.30.1.31#53: timed out
;; communications error to 127.30.1.31#53: timed out

; <<>> DiG 9.18.18-0ubuntu0.22.04.1-Ubuntu <<>> @127.30.1.31 looped-cname-in-zone-1.cname.recursor.engine.xa +norec
; (1 server found)
;; global options: +cmd
;; no servers could be reached

What you expected to happen:
In both cases I expect to get a response with one copy of the CNAME record in the answer section. But if at least one of them work it would be fine.

;; ANSWER SECTION:
looped-cname-in-zone-1.cname.recursor.engine.xa. 3600 IN CNAME looped-cname-in-zone-1.cname.recursor.engine.xa.

How to reproduce it (as minimally and precisely as possible):
Use the configuration above.

Anything else we need to know?:

Environment:

  • the version of CoreDNS: CoreDNS-1.11.1
  • Corefile:
  • logs, if applicable:
  • OS (e.g: cat /etc/os-release): linux/amd64, PRETTY_NAME="Ubuntu 22.04.3 LTS"
  • Others: go1.20.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions