Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@milan-zededa
Copy link
Contributor

Description

  • Extended support for DhcpOptionsIgnore to cover IP addresses, DNS servers/domains, and gateway addresses, in addition to the already supported NTP servers.
  • By default, DHCP-provided options are merged with static configuration.
  • If a given *_exclusively flag is enabled, static values replace DHCP-provided ones. If no static values are present, the resulting config is then empty (e.g. no DNS servers, no IP).
  • Domain name and gateway are special cases: only one per-port value is supported. Here, static config always takes priority over DHCP. Regardless of the flag value, non-zero static values always overwrites DHCP config. If static is nil, then the DHCP value is used unless the corresponding *_exclusively flag is set, in which case the field is cleared.

Implementation notes:

  • Simplified handling of NTP servers: DeviceNetworkStatus now exposes a single combined list of NTP servers, so consumers do not need to distinguish DHCP vs static.
  • Introduced HostnameOrIP type for representing NTP servers, supporting both IPs and hostnames and (un)marshalling as strings.
  • When ignoring DHCP-provided IP addresses, the lease is still acquired and dhcpcd configures the address on the interface. However, EVE suppresses propagation of this IP and its routes into per-port and per-NI routing tables, ensuring only the static configuration is applied.

How to test and validate this PR

Once supported by the controller, it will be possible to configure network port with DHCP, but at the same time statically configure port IP addresses, gateways and DNS servers, and for each decide if it should be merged with DHCP-provided configuration or replace DHCP configuration. Then it is a matter of checking the reported network configuration or entering the device and checking output from ip addr, cat /etc/resolv.conf and ip route. (as well as testing connectivity)

But in the foreseeable future, it will be possible to use this feature only through the new LPS endpoint /api/v/network, which is still under development.

(I tested this using eden+adam, which allows me to create and submit any EdgeDevConfig edited using a text/JSON editor)

Changelog notes

Added support to selectively merge or replace DHCP-provided configuration (IP address, DNS servers/domains, gateways, NTP servers) with statically entered values. Previously, this was supported only for NTP servers.

PR Backports

New feature, not to be backported.

  • 14.5-stable: No
  • 13.4-stable: No

Checklist

  • I've provided a proper description
  • I've added the proper documentation
  • I've tested my PR on amd64 device
  • I've tested my PR on arm64 device
  • I've written the test verification instructions
  • I've set the proper labels to this PR
  • I've checked the boxes above, or I've provided a good reason why I didn't check them.

@milan-zededa milan-zededa self-assigned this Aug 28, 2025
@milan-zededa milan-zededa added the enhancement New feature or request label Aug 28, 2025
@milan-zededa milan-zededa added the main-quest The fate of the project rests on this PR. Prioritise review to advance the storyline! label Aug 28, 2025
@milan-zededa milan-zededa force-pushed the dhcp-options-ignore branch 2 times, most recently from ecdda35 to 1b969c3 Compare August 28, 2025 08:27
Copy link
Contributor

@eriknordmark eriknordmark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some questions in separate comments.

Kick off tests.

- Extended support for DhcpOptionsIgnore to cover IP addresses,
  DNS servers/domains, and gateway addresses, in addition to
  the already supported NTP servers.
- By default, DHCP-provided options are merged with static
  configuration.
- If a given "*_exclusively" flag is enabled, static values
  replace DHCP-provided ones. If no static values are present,
  the resulting config is then empty (e.g. no DNS servers, no IP).
- Domain name and gateway are special cases: only one per-port
  value is supported. Here, static config always takes priority
  over DHCP. Regardless of the flag value, non-zero static values
  always overwrites DHCP config. If static is nil, then the DHCP value
  is used unless the corresponding "*_exclusively" flag is set,
  in which case the field is cleared.

Implementation notes:
- Simplified handling of NTP servers: DeviceNetworkStatus now
  exposes a single combined list of NTP servers, so consumers
  do not need to distinguish DHCP vs static.
- Introduced HostnameOrIP type for representing NTP servers,
  supporting both IPs and hostnames and (un)marshalling as strings.
- When ignoring DHCP-provided IP addresses, the lease is still
  acquired and dhcpcd configures the address on the interface.
  However, EVE suppresses propagation of this IP and its routes
  into per-port and per-NI routing tables, ensuring only the
  static configuration is applied.

Signed-off-by: Milan Lenco <[email protected]>
@eriknordmark eriknordmark merged commit 802d095 into lf-edge:master Sep 2, 2025
43 of 44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request main-quest The fate of the project rests on this PR. Prioritise review to advance the storyline!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants