dhcp: add nettools dhcp4 client

System Internals / NetworkManager - Tom Gundersen [jklm.no] - 5 July 2019 09:04 EDT

This is inspired by the existing systemd integration, with a few differences:

- This parses the WPAD option, which systemd requested, but did not use.
- We hook into the DAD handling, only making use of the configured address once DAD has completed successfully, and declining the lease if it fails.

There are still many areas of possible improvement. In particular, we need to ensure the parsing of all options are compliant, as n-dhcp4 treats all options as opaque, unlike sd-dhcp4. We probably also need to look at how to handle failures and retries (in particular if we decline a lease).

We need to query the current MTU at client startu, as well as the hardware broadcast address. Both these are provided by the kernel over netlink, so it should simply be a matter of hooking that up with NM's netlink layer.

Contribution under LGPL2.0+, in addition to stated licenses.

6adade6f2 dhcp: add nettools dhcp4 client
Makefile.am | 47 +-
contrib/scripts/checkpatch.pl | 2 +-
meson_options.txt | 2 +-
shared/meson.build | 37 ++
src/dhcp/nm-dhcp-client.h | 1 +
src/dhcp/nm-dhcp-listener.c | 3 +-
src/dhcp/nm-dhcp-manager.h | 2 +-
src/dhcp/nm-dhcp-nettools.c | 1336 +++++++++++++++++++++++++++++++++++++++++
src/meson.build | 2 +
src/nm-iface-helper.c | 3 +-
10 files changed, 1429 insertions(+), 6 deletions(-)

Upstream: cgit.freedesktop.org

  • Share