Page MenuHomeVyOS Platform

DHCP client does not remove IP address when stopped by the 02-vyos-stopdhclient hook
Closed, ResolvedPublicBUG

Description

Inside the 02-vyos-stopdhclient hook we use the native dhclient functionality to stop a dhclient instance, the -x option. It stops a process and executes all the hooks, if necessary to change IP address and other settings obtained via DHCP.
This is done in a next way:

  1. Old dhclient killed by a new process (with -x option).
  2. The new dhclient check if there is an active DHCP lease received by the killed process.
  3. If a lease exists, execute hooks to remove the settings that it contains.

The problem is in a method on how dhclient searches for active leases. To do this, it checks a lease file but uses a path to the file from the new dhclient process, not the old one. Because of this if paths are different, what is the case if dhclient is started by different services, it does not see an old lease and does not execute hooks. So, all the settings applied by the old process stay active.

One of the examples, when this happens, is deployment from OVA image - after the first boot, we may see two IP addresses assigned to an eth0 interface.

Details

Difficulty level
Easy (less than an hour)
Version
1.3.0-epa2, 1.3-beta-202110240342, 1.4-rolling-202110240217
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible
Issue type
Bug (incorrect behavior)

Related Objects

Mentioned In
1.3.5