Page MenuHomeVyOS Platform

dhcp: stop dhclient with -x (no RELEASE) so INIT-REBOOT and HA lease seeds work
In progress, NormalPublicBUG

Description

Summary

dhclient@.service and the per-interface override (data/templates/dhcp-client/override.conf.j2) use:

ExecStop=... dhclient -4 -r ...

dhclient -r sends DHCPRELEASE and tears down local recovery state. After stop/restart the client cannot use INIT-REBOOT (DHCPREQUEST with the previous address) from the ISC -lf DB; the next start tends to DISCOVER (full DORA).

That breaks HA lease pre-share: the backup seeds /run/dhclient/dhclient_<iface>.leases before enable; any ExecStop -r path (or a restart that stops first) RELEASEs the lease the peer may still hold under a shared MAC and forces rediscovery.

Why it matters

  1. HA VRRP with shared ISP MACs: seed -lf before enable is meant to INIT-REBOOT (REQUEST) the same IP. RELEASE undoes that and can signal the ISP that the address is free while the other node still uses it.
  1. Production drill (2026-07-10): seeded -lf still saw DISCOVER on takeover; follow-up bench (2026-07-21, 1.5 rolling) isolated ExecStop -r as the smoking gun.
  1. Distinct from:
    • T9085 — RENEW succeeds but does not reinstall a missing default
    • T9108 — stuck unicast RENEW until lease end (no rediscover)

Reproduction (bench, VyOS 1.5 rolling)

On a DHCP WAN (e.g. eth5) with a live lease:

  1. snapshot -lf cp /run/dhclient/dhclient_eth5.leases /tmp/seed.leases

    systemctl stop dhclient@eth5
  2. Wire: DHCPRELEASE; ipwrapper flushes dynamic addr

    cp /tmp/seed.leases /run/dhclient/dhclient_eth5.leases systemctl start dhclient@eth5
  3. Wire after re-seed: DHCPREQUEST (INIT-REBOOT) + ACK when -lf intact
  4. With stock -r stop, the RELEASE alone already cleared server-side session;
  5. without re-seed, next start is DISCOVER.

Expected

ExecStop stops the client without DHCPRELEASE so the ISC -lf DB remains valid for INIT-REBOOT on the next start (HA seed / restart recovery).

Actual

ExecStop uses -r: DHCPRELEASE + local flush; next start does not reliably INIT-REBOOT from a preserved seed.

Suggested fix

Use dhclient -x (exit without release) in:

  • src/systemd/dhclient@.service
  • data/templates/dhcp-client/override.conf.j2

Explicit RELEASE remains available for operator workflows if needed; disable/restart should not RELEASE by default on a router.

Fix PR

https://github.com/vyos/vyos-1x/pull/5342

Environment

  • VyOS 1.5 Circinus rolling (e.g. 2026.07.x)
  • DHCP WANs, HA lease pre-share, shared ISP MACs

Details

Version
VyOS Rolling (1.5 / Circinus)
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Bug (incorrect behavior)

Event Timeline

Viacheslav changed the task status from Open to In progress.Jul 24 2026, 4:06 PM
Viacheslav assigned this task to bradkollmyer.
Viacheslav triaged this task as Normal priority.
Viacheslav subscribed.

Addressed review on https://github.com/vyos/vyos-1x/pull/5342 (e17b4e433):

ExecStop stays -x (restart / disable / HA seed still INIT-REBOOT).

Op-mode release dhcp interface was a systemd stop, so after the unit flip nothing in-tree sent a DHCPv4 RELEASE and the server kept the binding until expire. It now:

  1. runs dhclient -4 -r with the unit -cf/-pf/-lf (and VRF if the interface is enslaved)
  2. systemctl stop dhclient@<iface> so Restart=always does not start a new client after the main PID exits

IPv6 is unchanged (systemctl stop dhcp6c@).

Addressed alexk37 2026-08-22 follow-up on https://github.com/vyos/vyos-1x/pull/5342 (a526ccdde; rebased onto current rolling):

dhclient -r with the unit pidfile raced ExecStop -x (releaser killed before the packet left; that -x process re-acquired). Stop-first removed the address so -r logged Network is unreachable.

Interface.release_dhcp_lease() now runtime-masks the unit, SIGKILLs it (address stays), then dhclient -4 -r with a separate pidfile. Op-mode release, delete address dhcp, flush, and VRF instance delete use that helper. Interface disable and VRF move stay stop-only so INIT-REBOOT / HA seed still work.