Page MenuHomeVyOS Platform

DHCP hostfile-update isn't removing hostfile entries on expiry.
Closed, DuplicatePublicBUG

Description

When a DHCP lease expires, it should be removed from /etc/hosts, but this isn't always happening:

dhcpd[6380]: execute_statement argv[0] = /usr/libexec/vyos/system/on-dhcp-event.sh
dhcpd[6380]: execute_statement argv[1] = release
dhcpd[6380]: execute: bad arg 2
hostfile-update
shared-network-name VLAN101 {
  authoritative
  subnet 172.16.101.0/24 {
      default-router 172.16.101.254
      dns-server 172.16.101.254
      domain-name guest.example.org
      failover {
          local-address 172.16.101.253
          name VLAN101
          peer-address 172.16.101.252
          status secondary
      }
      lease 3600
      range 0 {
          start 172.16.101.1
          stop 172.16.101.250
      }
   }
}

Details

Difficulty level
Unknown (require assessment)
Version
1.2.0
Why the issue appeared?
Will be filled on close

Event Timeline

syncer triaged this task as Normal priority.
syncer removed a project: VyOS 1.2 Crux.

https://marc.info/?l=dhcp-hackers&m=128755776831463 describes the solution.
Setting ClientName, ClientIp, ClientMac, ClientDomain on release and expire fails, and there's no need for that since they are already known.
Simply removing all "set" commands in the release and expire section fixes this bug and restores the desired behaviour that i.e. the leases are removed from /etc/hosts.