diff --git a/src/dhcp/nm-dhcp-client.c b/src/dhcp/nm-dhcp-client.c index f1a62f2474..60901692fb 100644 --- a/src/dhcp/nm-dhcp-client.c +++ b/src/dhcp/nm-dhcp-client.c @@ -359,26 +359,25 @@ stop (NMDhcpClient *self, gboolean release, GBytes *duid) void nm_dhcp_client_set_state (NMDhcpClient *self, NMDhcpState new_state, - GObject *ip_config, + NMIPConfig *ip_config, GHashTable *options) { NMDhcpClientPrivate *priv = NM_DHCP_CLIENT_GET_PRIVATE (self); gs_free char *event_id = NULL; + if (new_state == NM_DHCP_STATE_BOUND) { + g_return_if_fail (NM_IS_IP_CONFIG (ip_config, priv->addr_family)); + g_return_if_fail (options); + } else { + g_return_if_fail (!ip_config); + g_return_if_fail (!options); + } + if (new_state >= NM_DHCP_STATE_BOUND) timeout_cleanup (self); if (new_state >= NM_DHCP_STATE_TIMEOUT) watch_cleanup (self); - if (new_state == NM_DHCP_STATE_BOUND) { - g_assert ( (priv->addr_family == AF_INET && NM_IS_IP4_CONFIG (ip_config)) - || (priv->addr_family == AF_INET6 && NM_IS_IP6_CONFIG (ip_config))); - g_assert (options); - } else { - g_assert (ip_config == NULL); - g_assert (options == NULL); - } - /* The client may send same-state transitions for RENEW/REBIND events and * the lease may have changed, so handle same-state transitions for the * BOUND state. Ignore same-state transitions for other events since @@ -851,7 +850,7 @@ nm_dhcp_client_handle_event (gpointer unused, g_clear_pointer (&str_options, g_hash_table_unref); } - nm_dhcp_client_set_state (self, new_state, G_OBJECT (ip_config), str_options); + nm_dhcp_client_set_state (self, new_state, ip_config, str_options); } return TRUE; diff --git a/src/dhcp/nm-dhcp-client.h b/src/dhcp/nm-dhcp-client.h index f3c34d3dcf..111b063bd5 100644 --- a/src/dhcp/nm-dhcp-client.h +++ b/src/dhcp/nm-dhcp-client.h @@ -168,7 +168,7 @@ void nm_dhcp_client_watch_child (NMDhcpClient *self, pid_t pid); void nm_dhcp_client_set_state (NMDhcpClient *self, NMDhcpState new_state, - GObject *ip_config, /* NMIP4Config or NMIP6Config */ + NMIPConfig *ip_config, GHashTable *options); /* str:str hash */ gboolean nm_dhcp_client_handle_event (gpointer unused, diff --git a/src/dhcp/nm-dhcp-systemd.c b/src/dhcp/nm-dhcp-systemd.c index 8cd80abe82..2d0202bb70 100644 --- a/src/dhcp/nm-dhcp-systemd.c +++ b/src/dhcp/nm-dhcp-systemd.c @@ -513,7 +513,7 @@ bound4_handle (NMDhcpSystemd *self) nm_dhcp_client_set_state (NM_DHCP_CLIENT (self), NM_DHCP_STATE_BOUND, - G_OBJECT (ip4_config), + NM_IP_CONFIG_CAST (ip4_config), options); } else { _LOGW ("%s", error->message); @@ -822,7 +822,7 @@ bound6_handle (NMDhcpSystemd *self) if (ip6_config) { nm_dhcp_client_set_state (NM_DHCP_CLIENT (self), NM_DHCP_STATE_BOUND, - G_OBJECT (ip6_config), + NM_IP_CONFIG_CAST (ip6_config), options); } else { _LOGW ("%s", error->message);