summaryrefslogtreecommitdiff
path: root/src/dhcp/nm-dhcp-client.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dhcp/nm-dhcp-client.c')
-rw-r--r--src/dhcp/nm-dhcp-client.c47
1 files changed, 28 insertions, 19 deletions
diff --git a/src/dhcp/nm-dhcp-client.c b/src/dhcp/nm-dhcp-client.c
index b02ff93426..6639edea5c 100644
--- a/src/dhcp/nm-dhcp-client.c
+++ b/src/dhcp/nm-dhcp-client.c
@@ -19,6 +19,7 @@
#include "NetworkManagerUtils.h"
#include "nm-utils.h"
+#include "nm-l3-config-data.h"
#include "nm-dhcp-utils.h"
#include "platform/nm-platform.h"
@@ -441,20 +442,23 @@ stop (NMDhcpClient *self, gboolean release)
void
nm_dhcp_client_set_state (NMDhcpClient *self,
NMDhcpState new_state,
- NMIPConfig *ip_config,
+ NML3ConfigData *l3cd,
GHashTable *options)
{
NMDhcpClientPrivate *priv = NM_DHCP_CLIENT_GET_PRIVATE (self);
gs_free char *event_id = NULL;
if (NM_IN_SET (new_state, NM_DHCP_STATE_BOUND, NM_DHCP_STATE_EXTENDED)) {
- g_return_if_fail (NM_IS_IP_CONFIG_ADDR_FAMILY (ip_config, priv->addr_family));
+ g_return_if_fail (NM_IS_L3_CONFIG_DATA (l3cd));
g_return_if_fail (options);
} else {
- g_return_if_fail (!ip_config);
+ g_return_if_fail (!l3cd);
g_return_if_fail (!options);
}
+ if (l3cd)
+ nm_l3_config_data_seal (l3cd);
+
if (new_state >= NM_DHCP_STATE_BOUND)
timeout_cleanup (self);
if (new_state >= NM_DHCP_STATE_TIMEOUT)
@@ -499,7 +503,7 @@ nm_dhcp_client_set_state (NMDhcpClient *self,
g_signal_emit (G_OBJECT (self),
signals[SIGNAL_STATE_CHANGED], 0,
new_state,
- ip_config,
+ l3cd,
options,
event_id);
}
@@ -889,7 +893,7 @@ nm_dhcp_client_handle_event (gpointer unused,
guint32 old_state;
guint32 new_state;
gs_unref_hashtable GHashTable *str_options = NULL;
- gs_unref_object NMIPConfig *ip_config = NULL;
+ nm_auto_unref_l3cd_init NML3ConfigData *l3cd = NULL;
NMPlatformIP6Address prefix = { 0, };
g_return_val_if_fail (NM_IS_DHCP_CLIENT (self), FALSE);
@@ -926,19 +930,19 @@ nm_dhcp_client_handle_event (gpointer unused,
/* Create the IP config */
if (g_hash_table_size (str_options) > 0) {
if (priv->addr_family == AF_INET) {
- ip_config = NM_IP_CONFIG_CAST (nm_dhcp_utils_ip4_config_from_options (nm_dhcp_client_get_multi_idx (self),
- priv->ifindex,
- priv->iface,
- str_options,
- priv->route_table,
- priv->route_metric));
+ l3cd = nm_dhcp_utils_ip4_config_from_options (nm_dhcp_client_get_multi_idx (self),
+ priv->ifindex,
+ priv->iface,
+ str_options,
+ priv->route_table,
+ priv->route_metric);
} else {
prefix = nm_dhcp_utils_ip6_prefix_from_options (str_options);
- ip_config = NM_IP_CONFIG_CAST (nm_dhcp_utils_ip6_config_from_options (nm_dhcp_client_get_multi_idx (self),
- priv->ifindex,
- priv->iface,
- str_options,
- priv->info_only));
+ l3cd = nm_dhcp_utils_ip6_config_from_options (nm_dhcp_client_get_multi_idx (self),
+ priv->ifindex,
+ priv->iface,
+ str_options,
+ priv->info_only);
}
} else
g_warn_if_reached ();
@@ -952,13 +956,13 @@ nm_dhcp_client_handle_event (gpointer unused,
} else {
/* Fail if no valid IP config was received */
if ( NM_IN_SET (new_state, NM_DHCP_STATE_BOUND, NM_DHCP_STATE_EXTENDED)
- && !ip_config) {
+ && !l3cd) {
_LOGW ("client bound but IP config not received");
new_state = NM_DHCP_STATE_FAIL;
nm_clear_pointer (&str_options, g_hash_table_unref);
}
- nm_dhcp_client_set_state (self, new_state, ip_config, str_options);
+ nm_dhcp_client_set_state (self, new_state, l3cd, str_options);
}
return TRUE;
@@ -1319,7 +1323,12 @@ nm_dhcp_client_class_init (NMDhcpClientClass *client_class)
G_SIGNAL_RUN_FIRST,
0,
NULL, NULL, NULL,
- G_TYPE_NONE, 4, G_TYPE_UINT, G_TYPE_OBJECT, G_TYPE_HASH_TABLE, G_TYPE_STRING);
+ G_TYPE_NONE,
+ 4,
+ G_TYPE_UINT,
+ G_TYPE_POINTER /* NML3ConfigData */,
+ G_TYPE_HASH_TABLE,
+ G_TYPE_STRING);
signals[SIGNAL_PREFIX_DELEGATED] =
g_signal_new (NM_DHCP_CLIENT_SIGNAL_PREFIX_DELEGATED,