diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-01-23 22:07:33 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-01-23 22:45:37 +0100 |
commit | 3b2ac14ac45bef01cf489c3231b868936866444b (patch) | |
tree | eeb9a96bef1b949c4f5b11c87db2904e711967bd /src/resolve/resolved-dns-synthesize.c | |
parent | dns-domain: re-introduce dns_name_is_empty() (diff) | |
download | systemd-3b2ac14ac45bef01cf489c3231b868936866444b.tar.xz systemd-3b2ac14ac45bef01cf489c3231b868936866444b.zip |
resolve: synthesize empty name
Do not return any error for empty name. Just returns empty answer.
Before:
---
$ dig .
; <<>> DiG 9.16.24-RH <<>> .
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 13617
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;. IN A
;; Query time: 0 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Mon Jan 24 05:49:30 JST 2022
;; MSG SIZE rcvd: 28
---
After:
---
$ dig .
; <<>> DiG 9.16.24-RH <<>> .
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7957
;; flags: qr aa rd ra ad; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;. IN A
;; Query time: 1 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Mon Jan 24 06:05:02 JST 2022
;; MSG SIZE rcvd: 28
---
Replaces #22197.
Fixes RHBZ#2039854 (https://bugzilla.redhat.com/show_bug.cgi?id=2039854).
Diffstat (limited to 'src/resolve/resolved-dns-synthesize.c')
-rw-r--r-- | src/resolve/resolved-dns-synthesize.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/resolve/resolved-dns-synthesize.c b/src/resolve/resolved-dns-synthesize.c index ef1423f441..ea239e686d 100644 --- a/src/resolve/resolved-dns-synthesize.c +++ b/src/resolve/resolved-dns-synthesize.c @@ -394,7 +394,10 @@ int dns_synthesize_answer( name = dns_resource_key_name(key); - if (is_localhost(name)) { + if (dns_name_is_empty(name)) { + /* Do nothing. */ + + } else if (is_localhost(name)) { r = synthesize_localhost_rr(m, key, ifindex, &answer); if (r < 0) |