Skip to content

dhcp: remove the address synchronously on lease expiry

Beniamino Galvani requested to merge bg/dhcp-remove-addr-on-expiry into main

Summary

When the lease expires, the DHCP client emits a LEASE_UPDATE event with a NULL l3cd. After returning from the handler, it sends immediately a DHCP DISCOVER message to try to get a new lease.

It is important that when the DISCOVER gets sent the address is no longer configured on the interface. Otherwise, the server could see that it is already in use and assign a different one. Therefore, remove the address synchronously when handling the event.

Fixes #1532

Checklist

Please read https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/blob/main/CONTRIBUTING.md before opening the merge request. In particular, check that:

  • the subject for all commits is concise and explicative
  • the message for all commits explains the reason for the change
  • the source is properly formatted
  • any relevant documentation is up to date
  • you have added unit tests if applicable
  • the NEWS file is updated when the change deserves to be mentioned, for example for new features, behavior changes, API deprecations, etc.
Edited by Íñigo Huguet

Merge request reports