diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 55a81e4f34..c09a80da54 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -4407,6 +4407,9 @@ nm_device_unrealize (NMDevice *self, gboolean remove_resources, GError **error) } } + nm_clear_g_source (&priv->queued_ip_config_id_4); + nm_clear_g_source (&priv->queued_ip_config_id_6); + g_object_freeze_notify (G_OBJECT (self)); NM_DEVICE_GET_CLASS (self)->unrealize_notify (self); diff --git a/src/nm-manager.c b/src/nm-manager.c index 8ca87551c9..44be55164a 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -3083,10 +3083,21 @@ platform_link_added (NMManager *self, continue; if (nm_device_is_real (candidate)) { - /* Ignore the link added event since there's already a realized - * device with the link's name. + /* There's already a realized device with the link's name + * and a different ifindex. */ - nm_device_update_from_platform_link (candidate, plink); + if (nm_device_get_ifindex (candidate) <= 0) + nm_device_update_from_platform_link (candidate, plink); + else { + /* The ifindex of a device can't be changed after + * initialization because it is used as a key by + * the dns-manager. + */ + _LOGD (LOGD_DEVICE, "(%s): removing old device %p after ifindex change from %d to %d", + plink->name, candidate, nm_device_get_ifindex (candidate), ifindex); + remove_device (self, candidate, FALSE, TRUE); + goto add; + } return; } else if (nm_device_realize_start (candidate, plink, @@ -3106,6 +3117,7 @@ platform_link_added (NMManager *self, /* Try next unrealized device */ } +add: /* Try registered device factories */ factory = nm_device_factory_manager_find_factory_for_link_type (plink->type); if (factory) { diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c index a8a649c7b4..70559c576a 100644 --- a/src/platform/nm-linux-platform.c +++ b/src/platform/nm-linux-platform.c @@ -3405,7 +3405,7 @@ typedef struct { WaitForNlResponseResult *out_seq_result; char **out_errmsg; union { - int *out_refresh_all_in_progess; + int *out_refresh_all_in_progress; NMPObject **out_route_get; gpointer out_data; } response; @@ -3437,7 +3437,7 @@ typedef struct { /* counter that a refresh all action is in progress, separated * by type. */ - int refresh_all_in_progess[_DELAYED_ACTION_IDX_REFRESH_ALL_NUM]; + int refresh_all_in_progress[_DELAYED_ACTION_IDX_REFRESH_ALL_NUM]; GPtrArray *list_master_connected; GPtrArray *list_refresh_link; @@ -3910,7 +3910,7 @@ delayed_action_refresh_all_in_progress (NMPlatform *platform, DelayedActionType if (NM_FLAGS_ANY (priv->delayed_action.flags, action_type)) return TRUE; - if (priv->delayed_action.refresh_all_in_progess[delayed_action_refresh_all_to_idx (action_type)] > 0) + if (priv->delayed_action.refresh_all_in_progress[delayed_action_refresh_all_to_idx (action_type)] > 0) return TRUE; return FALSE; @@ -3940,10 +3940,10 @@ delayed_action_wait_for_nl_response_complete (NMPlatform *platform, case DELAYED_ACTION_RESPONSE_TYPE_VOID: break; case DELAYED_ACTION_RESPONSE_TYPE_REFRESH_ALL_IN_PROGRESS: - if (data->response.out_refresh_all_in_progess) { - nm_assert (*data->response.out_refresh_all_in_progess > 0); - *data->response.out_refresh_all_in_progess -= 1; - data->response.out_refresh_all_in_progess = NULL; + if (data->response.out_refresh_all_in_progress) { + nm_assert (*data->response.out_refresh_all_in_progress > 0); + *data->response.out_refresh_all_in_progress -= 1; + data->response.out_refresh_all_in_progress = NULL; } break; case DELAYED_ACTION_RESPONSE_TYPE_ROUTE_GET: @@ -4666,11 +4666,11 @@ do_request_all_no_delayed_actions (NMPlatform *platform, DelayedActionType actio const NMPClass *klass = nmp_class_from_type (obj_type); nm_auto_nlmsg struct nl_msg *nlmsg = NULL; int nle; - int *out_refresh_all_in_progess; + int *out_refresh_all_in_progress; - out_refresh_all_in_progess = &priv->delayed_action.refresh_all_in_progess[delayed_action_refresh_all_to_idx (iflags)]; - nm_assert (*out_refresh_all_in_progess >= 0); - *out_refresh_all_in_progess += 1; + out_refresh_all_in_progress = &priv->delayed_action.refresh_all_in_progress[delayed_action_refresh_all_to_idx (iflags)]; + nm_assert (*out_refresh_all_in_progress >= 0); + *out_refresh_all_in_progress += 1; /* clear any delayed action that request a refresh of this object type. */ priv->delayed_action.flags &= ~iflags; @@ -4704,9 +4704,9 @@ do_request_all_no_delayed_actions (NMPlatform *platform, DelayedActionType actio if (nle < 0) continue; - if (_nl_send_nlmsg (platform, nlmsg, NULL, NULL, DELAYED_ACTION_RESPONSE_TYPE_REFRESH_ALL_IN_PROGRESS, out_refresh_all_in_progess) < 0) { - nm_assert (*out_refresh_all_in_progess > 0); - *out_refresh_all_in_progess -= 1; + if (_nl_send_nlmsg (platform, nlmsg, NULL, NULL, DELAYED_ACTION_RESPONSE_TYPE_REFRESH_ALL_IN_PROGRESS, out_refresh_all_in_progress) < 0) { + nm_assert (*out_refresh_all_in_progress > 0); + *out_refresh_all_in_progress -= 1; } } } @@ -4735,10 +4735,10 @@ event_seq_check_refresh_all (NMPlatform *platform, guint32 seq_number) data = &g_array_index (priv->delayed_action.list_wait_for_nl_response, DelayedActionWaitForNlResponseData, i); if ( data->response_type == DELAYED_ACTION_RESPONSE_TYPE_REFRESH_ALL_IN_PROGRESS - && data->response.out_refresh_all_in_progess + && data->response.out_refresh_all_in_progress && data->seq_number == priv->nlh_seq_last_seen) { - *data->response.out_refresh_all_in_progess -= 1; - data->response.out_refresh_all_in_progess = NULL; + *data->response.out_refresh_all_in_progress -= 1; + data->response.out_refresh_all_in_progress = NULL; break; } }