Page MenuHomeVyOS Platform

Bad hostnames in /etc/hosts with static-mapping in dhcp server config
Open, Requires assessmentPublicBUG

Description

Issue description:

Using static mappings in the dhcp server config section allows to hand the same "reserved" IP to the same hosts whenever they connect. If service dhcp-server hostfile-update is set, the /etc/hosts will get updated with the hostname and IP address upon successful connection.

However, since the DHCP configuration also has a shared-network-name, this name, followed by an underscore, will preceed the host name and thus break resolution.

Example:

set service dhcp-server hostfile-update
set service dhcp-server shared-network-name WIFI subnet 192.168.XX.YY/24 static-mapping myhost ip-address 192.168.XX.ZZ
set service dhcp-server shared-network-name WIFI subnet 192.168.XX.YY/24 static-mapping myhost mac-address 00:11:22:33:44:55
set service dhcp-server shared-network-name WIFI subnet 192.168.XX.YY/24 domain-name mydomain.local
set service dhcp-server shared-network-name WIFI subnet 192.168.XX.YY/24 domain-search mydomain.local
commit

Resulting entries in /etc/hosts:

192.168.XX.YY	WIFI_myhost.mydomain.local.mydomain.local
192.168.XX.YY	WIFI_myhost.mydomain.local

Expected behavior:

There should only be one additional entry in /etc/hosts:

192.168.XX.YY	myhost.mydomain.local

Workaround:

Disable hostfile updates:

delete service dhcp-server hostfile-update
commit && save

Details

Difficulty level
Unknown (require assessment)
Version
VyOS 1.3-rolling-202004111646 (self-built, d64011558e3257-dirty)
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)

Event Timeline

pasik added a subscriber: pasik.Apr 14 2020, 11:44 AM