Page MenuHomeVyOS Platform

DHCP hostfile-update isn't removing hostfile entries on expiry.
Open, NormalPublicBUG

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

thinkl33t created this task.Mar 7 2019, 3:47 PM
syncer assigned this task to dmbaturin.Aug 31 2019, 12:45 AM
syncer triaged this task as Normal priority.
syncer removed a project: VyOS 1.2 Crux.
pasik added a subscriber: pasik.May 16 2020, 8:12 AM
varac added a subscriber: varac.Fri, Nov 20, 8:30 AM

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.