#1151376 pdns-recursor: only the first /etc/hosts line per name is served, A or AAAA missing

Package:
pdns-recursor
Source:
pdns-recursor
Description:
PowerDNS Recursor
Submitter:
ruben@insecure.pw
Date:
2026-10-20 11:55:02 UTC
Severity:
normal
Tags:
#1151376#5
Date:
2026-10-20 10:03:20 UTC
From:
To:
With export-etc-hosts enabled, the recursor in bookworm only serves the
first line of /etc/hosts for a name. If a name is listed with an IPv4 and
an IPv6 address on two lines, only one of the two record types is
answered.

Steps to reproduce (Debian 12 based system, pdns-recursor 4.8.8-1+deb12u1,
export-etc-hosts=yes):

  /etc/hosts:
    192.0.2.77     plain.test
    2001:db8::77   plain.test

  rec_control reload-zones
  dig +short @127.0.0.1 plain.test A      -> 192.0.2.77
  dig +short @127.0.0.1 plain.test AAAA   -> (empty)

With the two lines in the opposite order only the AAAA record is
answered. In 4.8.8 makeNameToIPZone() in reczones-helpers.cc creates a
new zone for each line and addToDomainMap() refuses to replace an
existing one ("Will not overwrite already loaded zone").

Upstream fixed this in 4.9.0, PowerDNS pull request 12203, commit
a867410a2183e64d6abe212c5abcac7cf8a95b6b "Allow multiple records with
same name for etc/hosts processing" (15 lines added, 2 removed, one
file). With upstream 5.4.7 both records of the example are answered.
Debian 13 should not be affected, because the fix is in all releases
since 4.9.0, but I have not tested the trixie package.

The patch applies cleanly to the 4.8.8 source. I checked this with
"patch --dry-run" against the rec-4.8.8 tag and did not build or run a
patched package. A patch in DEP-3 format is attached.

I know that 4.x is end of life upstream, so a fix has to come from
Debian. Could this be considered for a bookworm point release? I noticed
it in VyOS (a Debian 12 based router distribution), where DHCP and static
host mappings for the same name use different address families and only
one of them resolves. I am happy to test a patched package.

#1151376#10
Date:
2026-10-20 11:34:18 UTC
From:
To:
Debian bookworm has transitioned out of being the "stable" release,
thus there a no further point releases. Please report bugs to the
LTS project, see https://wiki.debian.org/LTS/FAQ#Where_can_bugs_be_reported.3F

Best,
Chris

#1151376#11
Date:
2026-10-20 11:44:41 UTC
From:
To:
Thx for the fast reponse. I send it to the list. In meantime I created a pr or vyos.