Skip to content

_gateway incorrectly returns NXDOMAIN for AAAA records on IPv4-only host and vice versa #11192

Closed

Description

@toreanderson

systemd version the issue has been seen with

systemd-239-6.git9f3aed1.fc29.x86_64

Used distribution

Fedora 29

Expected behaviour you didn't see

When queried for the AAAA record of the magic host _gateway on an IPv4-only host, the question should have been answered with a NODATA status (a.k.a. NOERROR with zero answers), as there exists records with different RR types for the queried-for FQDN. Conversely, when queried for the A record of _gateway on an IPv6-only host, the question should also have been answered with NODATA.

Unexpected behaviour you saw

The queries mentioned above are answered with NXDOMAIN. NXDOMAIN is a status code that indicates to the client that the FQDN does not exist at all (i.e., regardless of the RR type). In other words, a client querying for the AAAA record of _gateway and getting an NXDOMAIN answer may safely assume that this FQDN does not have an A record (or TXT or any other for that matter) either, and can optimise away any planned queries for those records. This bug means that such a client that queries for _gateway might end up with incorrect information (e.g., incorrectly concluding that «this host has no gateways at all»).

Steps to reproduce the problem

Start out with an IPv4-only or IPv6-only machine, e.g., like so:

$ ip -4 route show default 
default via 192.168.1.1 dev wlp2s0 proto dhcp metric 600
$ ip -6 route show default | wc -l
0

Perform some queries for the magic _gateway FQDN:

$ dig @127.0.0.53 _gateway. IN A

; <<>> DiG 9.11.4-P2-RedHat-9.11.4-10.P2.fc29 <<>> @127.0.0.53 _gateway. IN A
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 51151
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;_gateway.                      IN      A

;; ANSWER SECTION:
_gateway.               0       IN      A       192.168.1.1

;; Query time: 0 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: må. des. 17 20:37:31 CET 2018
;; MSG SIZE  rcvd: 53

$ dig @127.0.0.53 _gateway. IN AAAA

; <<>> DiG 9.11.4-P2-RedHat-9.11.4-10.P2.fc29 <<>> @127.0.0.53 _gateway. IN AAAA
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 17403
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;_gateway.                      IN      AAAA

;; Query time: 0 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: må. des. 17 20:37:33 CET 2018
;; MSG SIZE  rcvd: 37

$ dig @127.0.0.53 _gateway. IN TXT

; <<>> DiG 9.11.4-P2-RedHat-9.11.4-10.P2.fc29 <<>> @127.0.0.53 _gateway. IN TXT
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 34143
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;_gateway.                      IN      TXT

;; Query time: 0 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: må. des. 17 20:37:35 CET 2018
;; MSG SIZE  rcvd: 37

It is worth noting that the TXT query is answered correctly with NODATA. Only the AAAA query is incorrectly answered with NXDOMAIN.

It is also possible to observe the unexpected difference in behaviour between the TXT and AAAA queries when using resolvectl:

$ resolvectl query _gateway
_gateway: 192.168.1.1%wlp2s0

-- Information acquired via protocol DNS in 5.3ms.
-- Data is authenticated: yes
$ resolvectl query _gateway -t A
_gateway IN A 192.168.1.1 # interface wlp2s0

-- Information acquired via protocol DNS in 1.1ms.
-- Data is authenticated: yes
$ resolvectl query _gateway -t AAAA
_gateway: resolve call failed: '_gateway' not found
$ resolvectl query _gateway -t TXT
_gateway: resolve call failed: Name '_gateway' does not have any RR of the requested type

Activity

  1. poettering commented on Dec 18, 2018

    @poettering
    Member

    True, we should reply with NODATA in this case

  2. added
    bug 🐛
    on Dec 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐛resolve

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions