Page MenuHomeVyOS Platform

Incorrect addresses returned with interaction of static /etc/hosts with DNS64
Open, HighPublicBUG

Description

I've created a bug report for PowerDNS:

https://github.com/PowerDNS/pdns/issues/11770

Summary:

When using both the options:
``
export-etc-hosts=yes

dns64-prefix=2001:db8:abcd:64::/96
``
I believe there is a missing test to see if the IPv6 address already exists for that host name and don't do the DNS64 processing to synthesize an IPv6 address if that host has an IPv6 address already configured in /etc/hosts.
Short description

It is returning the DNS64 synthesized address instead of the actual configured IPv6 address in the /etc/host file, even though the IPv6 address is configured in the /etc/hosts file.

DNS64 synthesized address should ONLY be generated if there is NOT a pre-configured IPv6 address for that host name in the /etc/hosts file.

Since the /etc/hosts was just recently fixed to add capability for IPv6 lookups in PDNS 4.8 (alpha) then this interaction may have been inadvertently overlooked.
Environment

Operating system: VyOS (Debian "Buster")
Software version: 1.3
Software source: PDNS 4.5 (compiled into VyOS 1.3)

Steps to reproduce

PDNS configuration file /run/powerdns/recursor.conf:

export-etc-hosts=yes
dns64-prefix=2001:db8:abcd:64::/96

Then when the /etc/hosts file has
10.1.10.51 myhost
2001:db8:abcd:10::51 myhost

Look up 'myhost' with:
$ host myhost
Expected behaviour

myhost has address 10.1.10.51
mhost has IPv6 address 2001:db8abcd:10::51

Actual behaviour

myhost has address 10.1.10.51
mhost has IPv6 address 2001:db8:abcd:64::a01:a33

Other information

I just discovered that PDNS recursor just recently had code added to "export-etc-hosts" option to handle IPv6.

My theory is that the interaction between that and 'dns64-prefix' was overlooked.

Details

Version
1.3
Is it a breaking change?
Perfectly compatible
Issue type
Bug (incorrect behavior)

Event Timeline

dsummers created this object in space S1 VyOS Public.
dsummers updated the task description. (Show Details)
Viacheslav changed the task status from Open to Needs testing.Aug 30 2023, 12:40 PM

I re-check this, and the problem still reproduces on the following versions:

Version:          VyOS 1.5-rolling-202406120020
PowerDNS Recursor 4.8.8

Version:          VyOS 1.4-stable-202407030309
PowerDNS Recursor 4.8.8

Version:          VyOS 1.3-stable-202407040623
PowerDNS Recursor 4.8.9

step to reproduce:
configure DNS forwarding

set service dns forwarding allow-from '10.0.0.0/24'
set service dns forwarding dns64-prefix '2001:db8:abcd:64::/96'
set service dns forwarding listen-address '10.0.0.13'
set system static-host-mapping host-name myhost inet '10.1.10.52'
set system static-host-mapping host-name myhost inet '2001:db8:abcd:10::52'

and look up host:

vyos@vyos# host myhost
myhost has address 10.1.10.52
myhost has IPv6 address 2001:db8:abcd:64::a01:a34

Also, this error is related to the order of the lines in /etc/hosts. The original problem occurs with:

vyos@vyos# cat /etc/hosts
...
# From 'system static-host-mapping' and DHCP server
# system
10.1.10.52      myhost 
2001:db8:abcd:10::52 myhost

but when ipv6 address is first then host command shows the expected value but without ipv4 address:

del system static-host-mapping host-name myhost inet '10.1.10.52'
commit
set system static-host-mapping host-name myhost inet '10.1.10.52'
vyos@vyos# cat /etc/hosts
...
# From 'system static-host-mapping' and DHCP server
# system
2001:db8:abcd:10::52 myhost 
10.1.10.52      myhost
vyos@vyos# host myhost
myhost has IPv6 address 2001:db8:abcd:10::52
HollyGurza changed the task status from Needs testing to Open.Jul 18 2024, 9:20 AM
dmbaturin removed a project: Restricted Project.Oct 14 2024, 8:44 AM
dmbaturin changed Is it a breaking change? from Unspecified (possibly destroys the router) to Perfectly compatible.
dmbaturin changed Issue type from Unspecified (please specify) to Bug (incorrect behavior).
syncer changed the subtype of this task from "Task" to "Bug".
syncer moved this task from Need Triage to Backlog - Bug on the VyOS Rolling board.
syncer subscribed.

This should be fixed in PowerDNS 4.9.0