DiG removes underscores from queries
Summary
When performing a dig query on a host with an underscore in it, the underscore is unexpectedly removed.
BIND version used
DiG 9.17.20-1+ubuntu21.10.1+isc+2-Ubuntu
Steps to reproduce
dig _spf-a.microsoft.com txt
; <<>> DiG 9.17.20-1+ubuntu21.10.1+isc+2-Ubuntu <<>> _spf-a.microsoft.com txt
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 981
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;spf-a.microsoft.com. IN TXT
;; AUTHORITY SECTION:
microsoft.com. 167 IN SOA ns1-205.azure-dns.com. azuredns-hostmaster.microsoft.com. 1 3600 300 2419200 300
;; Query time: 4 msec
;; SERVER: 127.0.0.53#53(127.0.0.53) (UDP)
;; WHEN: Fri Dec 03 13:22:46 GMT 2021
;; MSG SIZE rcvd: 122
What is the current bug behavior?
DiG removes the underscore from the host prior to the query.
What is the expected correct behavior?
The query should be performed with the underscore still within the host.
nslookup for comparison:
nslookup -type=txt _spf-a.microsoft.com
Server: dsldevice.lan
Address: 192.168.1.254
Non-authoritative answer:
_spf-a.microsoft.com text =
"v=spf1 ip4:216.99.5.67 ip4:216.99.5.68 ip4:202.177.148.100 ip4:203.122.32.250 ip4:202.177.148.110 ip4:213.199.128.139 ip4:213.199.128.145 ip4:207.46.50.72 ip4:207.46.50.82 ip4:65.55.42.224/28 ip4:13.78.233.182 include:spf.protection.outlook.com ~all"