dhcp: refactor loading of DHCP plugins

System Internals / NetworkManager - Thomas Haller [redhat.com] - 4 October 2016 04:41 UTC

The DHCP plugins are linked statically and don't have a plugin mechanism to be loaded from a shared library. Change the _nm_dhcp_client_register() mechanism to something more static.

Also, only link the plugins into the binary if they are actually enabled. Previously, they would always be linked in (and always register themself). However, nm_dhcp_dh*_get_path() would return NULL which made the plugin unusable.

The autoconf code to detect the DHCP plugins is still not stellar, but seems to work well enough for now. At least, we log the result of the detection at the end of the configure-script, so a user can at least notice what happend.

ad0f403 dhcp: refactor loading of DHCP plugins
configure.ac | 79 +++++++++++-------
src/Makefile.am | 62 +++++---------
src/dhcp-manager/nm-dhcp-client.h | 32 +++++---
src/dhcp-manager/nm-dhcp-dhclient.c | 38 +++++----
src/dhcp-manager/nm-dhcp-dhclient.h | 36 ---------
src/dhcp-manager/nm-dhcp-dhcpcd.c | 38 +++++----
src/dhcp-manager/nm-dhcp-dhcpcd.h | 37 ---------
src/dhcp-manager/nm-dhcp-manager.c | 151 ++++++++++++++---------------------
src/dhcp-manager/nm-dhcp-systemd.c | 34 +++++---
src/dhcp-manager/nm-dhcp-systemd.h | 37 ---------
10 files changed, 218 insertions(+), 326 deletions(-)

Upstream: cgit.freedesktop.org


  • Share