mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-06-10 20:48:45 +02:00
dhcp: drop nm_dhcp_utils_merge_new_dhcp6_lease()
Since dhclient is gone, this is no longer needed.
This commit is contained in:
parent
8b0da1a646
commit
6dd6391c90
3 changed files with 6 additions and 80 deletions
|
|
@ -785,13 +785,12 @@ _nm_dhcp_client_notify(NMDhcpClient *self,
|
|||
NMDhcpClientEventType client_event_type,
|
||||
const NML3ConfigData *l3cd)
|
||||
{
|
||||
NMDhcpClientPrivate *priv = NM_DHCP_CLIENT_GET_PRIVATE(self);
|
||||
GHashTable *options;
|
||||
gboolean l3cd_changed;
|
||||
NMOptionBool acd_state;
|
||||
const int IS_IPv4 = NM_IS_IPv4(priv->config.addr_family);
|
||||
nm_auto_unref_l3cd const NML3ConfigData *l3cd_merged = NULL;
|
||||
char sbuf1[NM_HASH_OBFUSCATE_PTR_STR_BUF_SIZE];
|
||||
NMDhcpClientPrivate *priv = NM_DHCP_CLIENT_GET_PRIVATE(self);
|
||||
GHashTable *options;
|
||||
gboolean l3cd_changed;
|
||||
NMOptionBool acd_state;
|
||||
const int IS_IPv4 = NM_IS_IPv4(priv->config.addr_family);
|
||||
char sbuf1[NM_HASH_OBFUSCATE_PTR_STR_BUF_SIZE];
|
||||
|
||||
nm_assert(NM_IN_SET(client_event_type,
|
||||
NM_DHCP_CLIENT_EVENT_TYPE_UNSPECIFIED,
|
||||
|
|
@ -824,15 +823,6 @@ _nm_dhcp_client_notify(NMDhcpClient *self,
|
|||
if (client_event_type >= NM_DHCP_CLIENT_EVENT_TYPE_TIMEOUT)
|
||||
watch_cleanup(self);
|
||||
|
||||
if (!IS_IPv4 && l3cd) {
|
||||
/* nm_dhcp_utils_merge_new_dhcp6_lease() relies on "life_starts" option
|
||||
* for merging. The internal client supports multiple IP addresses per lease. */
|
||||
if (nm_dhcp_utils_merge_new_dhcp6_lease(priv->l3cd_next, l3cd, &l3cd_merged)) {
|
||||
_LOGD("lease merged with existing one");
|
||||
l3cd = nm_l3_config_data_seal(l3cd_merged);
|
||||
}
|
||||
}
|
||||
|
||||
if (l3cd) {
|
||||
nm_clear_g_source_inst(&priv->no_lease_timeout_source);
|
||||
} else
|
||||
|
|
|
|||
|
|
@ -827,64 +827,6 @@ nm_dhcp_utils_get_leasefile_path(int addr_family,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_dhcp_utils_merge_new_dhcp6_lease(const NML3ConfigData *l3cd_old,
|
||||
const NML3ConfigData *l3cd_new,
|
||||
const NML3ConfigData **out_l3cd_merged)
|
||||
{
|
||||
nm_auto_unref_l3cd_init NML3ConfigData *l3cd_merged = NULL;
|
||||
const NMPlatformIP6Address *addr;
|
||||
NMDhcpLease *lease_old;
|
||||
NMDhcpLease *lease_new;
|
||||
NMDedupMultiIter iter;
|
||||
const char *start;
|
||||
const char *iaid;
|
||||
|
||||
nm_assert(out_l3cd_merged && !*out_l3cd_merged);
|
||||
|
||||
if (!l3cd_old)
|
||||
return FALSE;
|
||||
if (!l3cd_new)
|
||||
return FALSE;
|
||||
|
||||
lease_new = nm_l3_config_data_get_dhcp_lease(l3cd_new, AF_INET6);
|
||||
if (!lease_new)
|
||||
return FALSE;
|
||||
|
||||
lease_old = nm_l3_config_data_get_dhcp_lease(l3cd_old, AF_INET6);
|
||||
if (!lease_old)
|
||||
return FALSE;
|
||||
|
||||
start = nm_dhcp_lease_lookup_option(lease_new, "life_starts");
|
||||
if (!start)
|
||||
return FALSE;
|
||||
iaid = nm_dhcp_lease_lookup_option(lease_new, "iaid");
|
||||
if (!iaid)
|
||||
return FALSE;
|
||||
|
||||
if (!nm_streq0(start, nm_dhcp_lease_lookup_option(lease_old, "life_starts")))
|
||||
return FALSE;
|
||||
if (!nm_streq0(iaid, nm_dhcp_lease_lookup_option(lease_old, "iaid")))
|
||||
return FALSE;
|
||||
|
||||
/* If the server sends multiple IPv6 addresses, we receive a state
|
||||
* changed event for each of them. Use the event ID to merge IPv6
|
||||
* addresses from the same transaction into a single configuration.
|
||||
**/
|
||||
|
||||
l3cd_merged = nm_l3_config_data_new_clone(l3cd_old, 0);
|
||||
|
||||
nm_l3_config_data_iter_ip6_address_for_each (&iter, l3cd_new, &addr)
|
||||
nm_l3_config_data_add_address_6(l3cd_merged, addr);
|
||||
|
||||
/* FIXME(l3cfg): Note that we keep the original NMDhcpLease. All we take from the new lease are the
|
||||
* addresses. Maybe this is not right and we should merge the leases too?? */
|
||||
nm_l3_config_data_set_dhcp_lease(l3cd_merged, AF_INET6, lease_old);
|
||||
|
||||
*out_l3cd_merged = nm_l3_config_data_ref_and_seal(g_steal_pointer(&l3cd_merged));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -33,12 +33,6 @@ gboolean nm_dhcp_utils_get_leasefile_path(int addr_family,
|
|||
const char *uuid,
|
||||
char **out_leasefile_path);
|
||||
|
||||
char *nm_dhcp_utils_get_dhcp6_event_id(GHashTable *lease);
|
||||
|
||||
gboolean nm_dhcp_utils_merge_new_dhcp6_lease(const NML3ConfigData *l3cd_old,
|
||||
const NML3ConfigData *l3cd_new,
|
||||
const NML3ConfigData **out_l3cd_merged);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static inline gboolean
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue