pdns icon indicating copy to clipboard operation
pdns copied to clipboard

Fix forward mapping when loading entries from an `etc-hosts` file

Open fredmorcos opened this issue 2 years ago • 0 comments

  • Program: Recursor
  • Issue type: Bug report

Short description

Description by @omoerbeek: https://github.com/PowerDNS/pdns/pull/11682#issuecomment-1149744457

I did not look at the code yet, but did a few tests.

Looking at at an example /etc/hosts containing

194.109.6.2     p
194.109.6.3     p
2001:888:0:7::2 p
2001:888:0:7::2 q

I see that dig -t A p succeeds but has one record. dig -t AAAA p gives me an empty answer section. dig -t AAAA q works and gives me a single record.

In an ideal world the forward mapping would work for all cases: two answer records for dig -t A p, one record for dig -t AAAA p and one record for dig -t AAAA q.

Having both an IPv4 and an IPv6 address for the same name is very common. So it would be nice if we would handle at least that case.

I don't know if this is feasible with the current structure, I guess it would mean merging domains in some cases.

The reverse (PTR) mapping should give only the first name encountered for each address. This seems to work as expected.

https://github.com/PowerDNS/pdns/pull/11682#issuecomment-1149781192

To be clear, the behavior above is already present in master, so it is not a regression.

Environment

  • Operating system: N/A
  • Software version: master
  • Software source: any

Steps to reproduce

Available in the description above.

Expected behaviour

Available in the description above.

Actual behaviour

Available in the description above.

Other information

fredmorcos avatar Jun 10 '22 07:06 fredmorcos