Commit 512fa33e authored by Thomas Haller's avatar Thomas Haller

dhcp: remove unused nm_dhcp_manager_get_lease_ip_configs() function

parent 745d60c0
......@@ -194,13 +194,6 @@ typedef struct {
GType (*get_type)(void);
const char *name;
const char *(*get_path) (void);
GSList *(*get_lease_ip_configs) (struct _NMDedupMultiIndex *multi_idx,
int addr_family,
const char *iface,
int ifindex,
const char *uuid,
guint32 route_table,
guint32 route_metric);
} NMDhcpClientFactory;
extern const NMDhcpClientFactory _nm_dhcp_client_factory_dhcpcanon;
......
......@@ -158,32 +158,6 @@ get_dhclient_leasefile (int addr_family,
return NULL;
}
static GSList *
nm_dhcp_dhclient_get_lease_ip_configs (NMDedupMultiIndex *multi_idx,
int addr_family,
const char *iface,
int ifindex,
const char *uuid,
guint32 route_table,
guint32 route_metric)
{
gs_free char *contents = NULL;
gs_free char *leasefile = NULL;
leasefile = get_dhclient_leasefile (addr_family, iface, uuid, NULL);
if (!leasefile)
return NULL;
if ( g_file_test (leasefile, G_FILE_TEST_EXISTS)
&& g_file_get_contents (leasefile, &contents, NULL, NULL)
&& contents
&& contents[0]) {
return nm_dhcp_dhclient_read_lease_ip_configs (multi_idx, addr_family, iface, ifindex,
route_table, route_metric, contents, NULL);
}
return NULL;
}
static gboolean
merge_dhclient_config (NMDhcpDhclient *self,
int addr_family,
......@@ -721,7 +695,6 @@ const NMDhcpClientFactory _nm_dhcp_client_factory_dhclient = {
.name = "dhclient",
.get_type = nm_dhcp_dhclient_get_type,
.get_path = nm_dhcp_dhclient_get_path,
.get_lease_ip_configs = nm_dhcp_dhclient_get_lease_ip_configs,
};
#endif /* WITH_DHCLIENT */
......@@ -265,7 +265,6 @@ const NMDhcpClientFactory _nm_dhcp_client_factory_dhcpcanon = {
.name = "dhcpcanon",
.get_type = nm_dhcp_dhcpcanon_get_type,
.get_path = nm_dhcp_dhcpcanon_get_path,
.get_lease_ip_configs = NULL,
};
#endif /* WITH_DHCPCANON */
......@@ -251,7 +251,6 @@ const NMDhcpClientFactory _nm_dhcp_client_factory_dhcpcd = {
.name = "dhcpcd",
.get_type = nm_dhcp_dhcpcd_get_type,
.get_path = nm_dhcp_dhcpcd_get_path,
.get_lease_ip_configs = NULL,
};
#endif /* WITH_DHCPCD */
......@@ -333,31 +333,6 @@ nm_dhcp_manager_set_default_hostname (NMDhcpManager *manager, const char *hostna
priv->default_hostname = g_strdup (hostname);
}
GSList *
nm_dhcp_manager_get_lease_ip_configs (NMDhcpManager *self,
NMDedupMultiIndex *multi_idx,
int addr_family,
const char *iface,
int ifindex,
const char *uuid,
guint32 route_table,
guint32 route_metric)
{
NMDhcpManagerPrivate *priv;
g_return_val_if_fail (NM_IS_DHCP_MANAGER (self), NULL);
g_return_val_if_fail (iface != NULL, NULL);
g_return_val_if_fail (ifindex >= -1, NULL);
g_return_val_if_fail (uuid != NULL, NULL);
g_return_val_if_fail (NM_IN_SET (addr_family, AF_INET, AF_INET6), NULL);
priv = NM_DHCP_MANAGER_GET_PRIVATE (self);
if ( priv->client_factory
&& priv->client_factory->get_lease_ip_configs)
return priv->client_factory->get_lease_ip_configs (multi_idx, addr_family, iface, ifindex, uuid, route_table, route_metric);
return NULL;
}
const char *
nm_dhcp_manager_get_config (NMDhcpManager *self)
{
......
......@@ -78,15 +78,6 @@ NMDhcpClient * nm_dhcp_manager_start_ip6 (NMDhcpManager *manager,
NMSettingIP6ConfigPrivacy privacy,
guint needed_prefixes);
GSList * nm_dhcp_manager_get_lease_ip_configs (NMDhcpManager *self,
struct _NMDedupMultiIndex *multi_idx,
int addr_family,
const char *iface,
int ifindex,
const char *uuid,
guint32 route_table,
guint32 route_metric);
/* For testing only */
extern const char* nm_dhcp_helper_path;
......
......@@ -450,36 +450,6 @@ get_leasefile_path (int addr_family, const char *iface, const char *uuid)
iface);
}
static GSList *
nm_dhcp_systemd_get_lease_ip_configs (NMDedupMultiIndex *multi_idx,
int addr_family,
const char *iface,
int ifindex,
const char *uuid,
guint32 route_table,
guint32 route_metric)
{
GSList *leases = NULL;
gs_free char *path = NULL;
sd_dhcp_lease *lease = NULL;
NMIP4Config *ip4_config;
int r;
if (addr_family != AF_INET)
return NULL;
path = get_leasefile_path (addr_family, iface, uuid);
r = dhcp_lease_load (&lease, path);
if (r == 0 && lease) {
ip4_config = lease_to_ip4_config (multi_idx, iface, ifindex, lease, NULL, route_table, route_metric, FALSE, NULL);
if (ip4_config)
leases = g_slist_append (leases, ip4_config);
sd_dhcp_lease_unref (lease);
}
return leases;
}
/*****************************************************************************/
static void
......@@ -1091,5 +1061,4 @@ const NMDhcpClientFactory _nm_dhcp_client_factory_internal = {
.name = "internal",
.get_type = nm_dhcp_systemd_get_type,
.get_path = NULL,
.get_lease_ip_configs = nm_dhcp_systemd_get_lease_ip_configs,
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment