diff options
author | Francesco Giudici <fgiudici@redhat.com> | 2019-08-23 18:27:28 +0200 |
---|---|---|
committer | Francesco Giudici <fgiudici@redhat.com> | 2019-09-05 12:13:36 +0200 |
commit | f60a60a0d056b8bb16f6bcea406ee53935e799b5 (patch) | |
tree | b452b18264e92a6ef066ac2825329a6b5bbc86f4 | |
parent | ee20761ea897a097cf46fdb223c0e0f40b1fba91 (diff) | |
download | NetworkManager-f60a60a0d056b8bb16f6bcea406ee53935e799b5.tar.gz |
dhcp: dhclient: use the shared function to retrieve the lease file path
... but leave in place the custom checks dependant on the dhclient plugin
-rw-r--r-- | src/dhcp/nm-dhcp-dhclient.c | 26 |
1 files changed, 2 insertions, 24 deletions
diff --git a/src/dhcp/nm-dhcp-dhclient.c b/src/dhcp/nm-dhcp-dhclient.c index fa142b4b5d..ec9676e5e4 100644 --- a/src/dhcp/nm-dhcp-dhclient.c +++ b/src/dhcp/nm-dhcp-dhclient.c @@ -38,7 +38,6 @@ #include "nm-glib-aux/nm-dedup-multi.h" #include "nm-utils.h" -#include "nm-config.h" #include "nm-dhcp-dhclient-utils.h" #include "nm-dhcp-manager.h" #include "NetworkManagerUtils.h" @@ -118,35 +117,14 @@ get_dhclient_leasefile (int addr_family, const char *uuid, char **out_preferred_path) { - gs_free char *rundir_path = NULL; gs_free char *path = NULL; - /* First, see if the lease file is in /run */ - rundir_path = g_strdup_printf (NMRUNDIR "/dhclient%s-%s-%s.lease", - _addr_family_to_path_part (addr_family), - uuid, - iface); - - if (g_file_test (rundir_path, G_FILE_TEST_EXISTS)) { - NM_SET_OUT (out_preferred_path, g_strdup (rundir_path)); - return g_steal_pointer (&rundir_path); - } - - /* /var/lib/NetworkManager is the preferred leasefile path */ - path = g_strdup_printf (NMSTATEDIR "/dhclient%s-%s-%s.lease", - _addr_family_to_path_part (addr_family), - uuid, - iface); - - if (g_file_test (path, G_FILE_TEST_EXISTS)) { + if (nm_dhcp_utils_get_leasefile_path (addr_family, "dhclient", iface, uuid, &path)) { NM_SET_OUT (out_preferred_path, g_strdup (path)); return g_steal_pointer (&path); } - if (nm_config_get_configure_and_quit (nm_config_get ()) == NM_CONFIG_CONFIGURE_AND_QUIT_INITRD) - NM_SET_OUT (out_preferred_path, g_steal_pointer (&rundir_path)); - else - NM_SET_OUT (out_preferred_path, g_steal_pointer (&path)); + NM_SET_OUT (out_preferred_path, g_steal_pointer (&path)); /* If the leasefile we're looking for doesn't exist yet in the new location * (eg, /var/lib/NetworkManager) then look in old locations to maintain |