From d4d2e65eb7fee4486e386e62a2f9d405c320e1f0 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 18 Aug 2015 16:10:38 +0200 Subject: [PATCH 1/5] macros: add NM_SET_OUT() macro --- include/nm-macros-internal.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/nm-macros-internal.h b/include/nm-macros-internal.h index 0bf25821ad..d12690048f 100644 --- a/include/nm-macros-internal.h +++ b/include/nm-macros-internal.h @@ -109,6 +109,15 @@ /* macro to return strlen() of a compile time string. */ #define STRLEN(str) ( sizeof ("" str) - 1 ) +#define NM_SET_OUT(out_val, value) \ + G_STMT_START { \ + typeof(*(out_val)) *_out_val = (out_val); \ + \ + if (_out_val) { \ + *_out_val = (value); \ + } \ + } G_STMT_END + /********************************************************/ #define _NM_IN_SET_EVAL_1(op, x, y1) \ From 78ca961c0fd0e5b563e33306299bd1058fa2e289 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 6 Oct 2015 11:05:14 +0200 Subject: [PATCH 2/5] device: refactor scheduling the activation source Every activation-source handler first cleared the current activation-source (activation_source_clear()) and later returned FALSE/G_SOURCE_REMOVE. Do not directly attach the handlers to g_idle_add(). Instead wrap the actual handler. This wrapper - always clears the activation source first - always returns G_SOURCE_REMOVE - does trace logging about invoking the handler This also avoids a possibility for a bug where the handler returns G_SOURCE_REMOVE, without also clearing activation_source_clear(). --- src/devices/nm-device.c | 261 ++++++++++++++++++++++++---------------- 1 file changed, 154 insertions(+), 107 deletions(-) diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 5fd7bfff7d..0088e894d1 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -135,6 +135,13 @@ enum { #define PENDING_ACTION_DHCP6 "dhcp6" #define PENDING_ACTION_AUTOCONF6 "autoconf6" +typedef void (*ActivationHandleFunc) (NMDevice *self); + +typedef struct { + ActivationHandleFunc func; + guint id; +} ActivationHandleData; + typedef enum { CLEANUP_TYPE_DECONFIGURE, CLEANUP_TYPE_KEEP, @@ -228,13 +235,11 @@ typedef struct { NMActRequest * queued_act_request; gboolean queued_act_request_is_waiting_for_carrier; NMActRequest * act_request; - guint act_source_id; - gpointer act_source_func; - guint act_source6_id; - gpointer act_source6_func; + ActivationHandleData act_handle4; /* for layer2 and IPv4. */ + ActivationHandleData act_handle6; guint recheck_assume_id; struct { - guint call_id; + guint call_id; NMDeviceStateReason available_reason; NMDeviceStateReason unavailable_reason; } recheck_available; @@ -376,6 +381,9 @@ static void _carrier_wait_check_queued_act_request (NMDevice *self); static gboolean nm_device_get_default_unmanaged (NMDevice *self); +static const char *_activation_func_to_string (ActivationHandleFunc func); +static void activation_source_handle_cb (NMDevice *self, int family); + static void _set_state_full (NMDevice *self, NMDeviceState state, NMDeviceStateReason reason, @@ -2776,63 +2784,119 @@ dnsmasq_state_changed_cb (NMDnsMasqManager *manager, guint32 status, gpointer us } } -static void -activation_source_clear (NMDevice *self, gboolean remove_source, int family) +/*****************************************************************************/ + +static gboolean +activation_source_handle_cb4 (gpointer user_data) +{ + activation_source_handle_cb (user_data, AF_INET); + return G_SOURCE_REMOVE; +} + +static gboolean +activation_source_handle_cb6 (gpointer user_data) +{ + activation_source_handle_cb (user_data, AF_INET6); + return G_SOURCE_REMOVE; +} + +static ActivationHandleData * +activation_source_get_by_family (NMDevice *self, + int family, + GSourceFunc *out_idle_func) { NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); - guint *act_source_id; - gpointer *act_source_func; if (family == AF_INET6) { - act_source_id = &priv->act_source6_id; - act_source_func = &priv->act_source6_func; + NM_SET_OUT (out_idle_func, activation_source_handle_cb6); + return &priv->act_handle6; } else { - act_source_id = &priv->act_source_id; - act_source_func = &priv->act_source_func; - } - - if (*act_source_id) { - if (remove_source) - g_source_remove (*act_source_id); - *act_source_id = 0; - *act_source_func = NULL; + NM_SET_OUT (out_idle_func, activation_source_handle_cb4); + g_return_val_if_fail (family == AF_INET, &priv->act_handle4); + return &priv->act_handle4; } } static void -activation_source_schedule (NMDevice *self, GSourceFunc func, int family) +activation_source_clear (NMDevice *self, int family) { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); - guint *act_source_id; - gpointer *act_source_func; + ActivationHandleData *act_data; - if (family == AF_INET6) { - act_source_id = &priv->act_source6_id; - act_source_func = &priv->act_source6_func; - } else { - act_source_id = &priv->act_source_id; - act_source_func = &priv->act_source_func; + act_data = activation_source_get_by_family (self, family, NULL); + + if (act_data->id) { + _LOGD (LOGD_DEVICE, "activation-stage: clear %s,%d (id %u)", + _activation_func_to_string (act_data->func), family, act_data->id); + nm_clear_g_source (&act_data->id); + act_data->func = NULL; } - - if (*act_source_id) { - if (*act_source_func == func) { - /* Don't bother rescheduling the same function that's about to - * run anyway. Fixes issues with crappy wireless drivers sending - * streams of associate events before NM has had a chance to process - * the first one. - */ - _LOGD (LOGD_DEVICE, "activation stage already scheduled"); - return; - } else { - _LOGW (LOGD_DEVICE, "a different activation stage already scheduled"); - activation_source_clear (self, TRUE, family); - } - } - - *act_source_id = g_idle_add (func, self); - *act_source_func = func; } +static void +activation_source_handle_cb (NMDevice *self, int family) +{ + ActivationHandleData *act_data, a; + + g_return_if_fail (NM_IS_DEVICE (self)); + + act_data = activation_source_get_by_family (self, family, NULL); + + g_return_if_fail (act_data->id); + g_return_if_fail (act_data->func); + + a = *act_data; + + act_data->func = NULL; + act_data->id = 0; + + _LOGD (LOGD_DEVICE, "activation-stage: invoke %s,%d (id %u)", + _activation_func_to_string (a.func), family, a.id); + + a.func (self); + + _LOGD (LOGD_DEVICE, "activation-stage: complete %s,%d (id %u)", + _activation_func_to_string (a.func), family, a.id); +} + +static void +activation_source_schedule (NMDevice *self, ActivationHandleFunc func, int family) +{ + ActivationHandleData *act_data; + GSourceFunc source_func; + guint new_id = 0; + + act_data = activation_source_get_by_family (self, family, &source_func); + + if (act_data->id && act_data->func != func) { + /* Don't bother rescheduling the same function that's about to + * run anyway. Fixes issues with crappy wireless drivers sending + * streams of associate events before NM has had a chance to process + * the first one. + */ + _LOGD (LOGD_DEVICE, "activation-stage: already scheduled %s,%d (id %u)", + _activation_func_to_string (func), family, act_data->id); + return; + } + + new_id = g_idle_add (source_func, self); + + if (act_data->id) { + _LOGW (LOGD_DEVICE, "activation-stage: schedule %s,%d which replaces %s,%d (id %u -> %u)", + _activation_func_to_string (func), family, + _activation_func_to_string (act_data->func), family, + act_data->id, new_id); + nm_clear_g_source (&act_data->id); + } else { + _LOGD (LOGD_DEVICE, "activation-stage: schedule %s,%d (id %u)", + _activation_func_to_string (func), family, new_id); + } + + act_data->func = func; + act_data->id = new_id; +} + +/*****************************************************************************/ + static gboolean get_ip_config_may_fail (NMDevice *self, int family) { @@ -2907,18 +2971,14 @@ act_stage1_prepare (NMDevice *self, NMDeviceStateReason *reason) * Prepare for device activation * */ -static gboolean -nm_device_activate_stage1_device_prepare (gpointer user_data) +static void +nm_device_activate_stage1_device_prepare (NMDevice *self) { - NMDevice *self = NM_DEVICE (user_data); NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); NMActStageReturn ret = NM_ACT_STAGE_RETURN_SUCCESS; NMDeviceStateReason reason = NM_DEVICE_STATE_REASON_NONE; NMActiveConnection *active = NM_ACTIVE_CONNECTION (priv->act_request); - /* Clear the activation source ID now that this stage has run */ - activation_source_clear (self, FALSE, 0); - priv->ip4_state = priv->ip6_state = IP_NONE; /* Notify the new ActiveConnection along with the state change */ @@ -2943,7 +3003,6 @@ nm_device_activate_stage1_device_prepare (gpointer user_data) out: _LOGD (LOGD_DEVICE, "Activation: Stage 1 of 5 (Device Prepare) complete."); - return FALSE; } @@ -2963,7 +3022,7 @@ nm_device_activate_schedule_stage1_device_prepare (NMDevice *self) priv = NM_DEVICE_GET_PRIVATE (self); g_return_if_fail (priv->act_request); - activation_source_schedule (self, nm_device_activate_stage1_device_prepare, 0); + activation_source_schedule (self, nm_device_activate_stage1_device_prepare, AF_INET); _LOGD (LOGD_DEVICE, "Activation: Stage 1 of 5 (Device Prepare) scheduled..."); } @@ -2982,10 +3041,9 @@ act_stage2_config (NMDevice *self, NMDeviceStateReason *reason) * for wireless devices, set SSID, keys, etc. * */ -static gboolean -nm_device_activate_stage2_device_config (gpointer user_data) +static void +nm_device_activate_stage2_device_config (NMDevice *self) { - NMDevice *self = NM_DEVICE (user_data); NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); NMActStageReturn ret; NMDeviceStateReason reason = NM_DEVICE_STATE_REASON_NONE; @@ -2993,9 +3051,6 @@ nm_device_activate_stage2_device_config (gpointer user_data) NMActiveConnection *active = NM_ACTIVE_CONNECTION (priv->act_request); GSList *iter; - /* Clear the activation source ID now that this stage has run */ - activation_source_clear (self, FALSE, 0); - _LOGD (LOGD_DEVICE, "Activation: Stage 2 of 5 (Device Configure) starting..."); nm_device_state_changed (self, NM_DEVICE_STATE_CONFIG, NM_DEVICE_STATE_REASON_NONE); @@ -3037,7 +3092,6 @@ nm_device_activate_stage2_device_config (gpointer user_data) out: _LOGD (LOGD_DEVICE, "Activation: Stage 2 of 5 (Device Configure) complete."); - return FALSE; } @@ -3082,7 +3136,7 @@ nm_device_activate_schedule_stage2_device_config (NMDevice *self) } } - activation_source_schedule (self, nm_device_activate_stage2_device_config, 0); + activation_source_schedule (self, nm_device_activate_stage2_device_config, AF_INET); _LOGD (LOGD_DEVICE, "Activation: Stage 2 of 5 (Device Configure) scheduled..."); } @@ -5496,17 +5550,13 @@ nm_device_activate_stage3_ip6_start (NMDevice *self) * Begin automatic/manual IP configuration * */ -static gboolean -nm_device_activate_stage3_ip_config_start (gpointer user_data) +static void +nm_device_activate_stage3_ip_config_start (NMDevice *self) { - NMDevice *self = NM_DEVICE (user_data); NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); NMActiveConnection *master; NMDevice *master_device; - /* Clear the activation source ID now that this stage has run */ - activation_source_clear (self, FALSE, 0); - priv->ip4_state = priv->ip6_state = IP_WAIT; _LOGD (LOGD_DEVICE, "Activation: Stage 3 of 5 (IP Configure Start) started..."); @@ -5548,7 +5598,6 @@ nm_device_activate_stage3_ip_config_start (gpointer user_data) out: _LOGD (LOGD_DEVICE, "Activation: Stage 3 of 5 (IP Configure Start) complete."); - return FALSE; } @@ -5578,7 +5627,7 @@ fw_change_zone_cb (NMFirewallManager *firewall_manager, if (priv->state == NM_DEVICE_STATE_IP_CHECK) nm_device_start_ip_check (self); else { - activation_source_schedule (self, nm_device_activate_stage3_ip_config_start, 0); + activation_source_schedule (self, nm_device_activate_stage3_ip_config_start, AF_INET); _LOGD (LOGD_DEVICE, "Activation: Stage 3 of 5 (IP Configure Start) scheduled."); } } @@ -5612,7 +5661,7 @@ nm_device_activate_schedule_stage3_ip_config_start (NMDevice *self) if (nm_device_uses_assumed_connection (self)) { _LOGD (LOGD_DEVICE, "Activation: skip setting firewall zone '%s' for assumed device", zone ? zone : "default"); - activation_source_schedule (self, nm_device_activate_stage3_ip_config_start, 0); + activation_source_schedule (self, nm_device_activate_stage3_ip_config_start, AF_INET); _LOGD (LOGD_DEVICE, "Activation: Stage 3 of 5 (IP Configure Start) scheduled."); return; } @@ -5643,17 +5692,13 @@ act_stage4_ip4_config_timeout (NMDevice *self, NMDeviceStateReason *reason) * Time out on retrieving the IPv4 config. * */ -static gboolean -nm_device_activate_ip4_config_timeout (gpointer user_data) +static void +nm_device_activate_ip4_config_timeout (NMDevice *self) { - NMDevice *self = NM_DEVICE (user_data); NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE; NMDeviceStateReason reason = NM_DEVICE_STATE_REASON_NONE; - /* Clear the activation source ID now that this stage has run */ - activation_source_clear (self, FALSE, AF_INET); - _LOGD (LOGD_DEVICE | LOGD_IP4, "Activation: Stage 4 of 5 (IPv4 Configure Timeout) started..."); ret = NM_DEVICE_GET_CLASS (self)->act_stage4_ip4_config_timeout (self, &reason); @@ -5671,7 +5716,6 @@ nm_device_activate_ip4_config_timeout (gpointer user_data) out: _LOGD (LOGD_DEVICE | LOGD_IP4, "Activation: Stage 4 of 5 (IPv4 Configure Timeout) complete."); - return FALSE; } @@ -5715,17 +5759,13 @@ act_stage4_ip6_config_timeout (NMDevice *self, NMDeviceStateReason *reason) * Time out on retrieving the IPv6 config. * */ -static gboolean -nm_device_activate_ip6_config_timeout (gpointer user_data) +static void +nm_device_activate_ip6_config_timeout (NMDevice *self) { - NMDevice *self = NM_DEVICE (user_data); NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE; NMDeviceStateReason reason = NM_DEVICE_STATE_REASON_NONE; - /* Clear the activation source ID now that this stage has run */ - activation_source_clear (self, FALSE, AF_INET6); - _LOGD (LOGD_DEVICE | LOGD_IP6, "Activation: Stage 4 of 5 (IPv6 Configure Timeout) started..."); ret = NM_DEVICE_GET_CLASS (self)->act_stage4_ip6_config_timeout (self, &reason); @@ -5743,7 +5783,6 @@ nm_device_activate_ip6_config_timeout (gpointer user_data) out: _LOGD (LOGD_DEVICE | LOGD_IP6, "Activation: Stage 4 of 5 (IPv6 Configure Timeout) complete."); - return FALSE; } @@ -5971,10 +6010,9 @@ arp_announce (NMDevice *self) priv->arp_round2_id = g_timeout_add_seconds (2, arp_announce_round2, self); } -static gboolean -nm_device_activate_ip4_config_commit (gpointer user_data) +static void +nm_device_activate_ip4_config_commit (NMDevice *self) { - NMDevice *self = NM_DEVICE (user_data); NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); NMActRequest *req; const char *method; @@ -5982,9 +6020,6 @@ nm_device_activate_ip4_config_commit (gpointer user_data) NMDeviceStateReason reason = NM_DEVICE_STATE_REASON_NONE; int ip_ifindex; - /* Clear the activation source ID now that this stage has run */ - activation_source_clear (self, FALSE, AF_INET); - _LOGD (LOGD_DEVICE, "Activation: Stage 5 of 5 (IPv4 Commit) started..."); req = nm_device_get_act_request (self); @@ -6046,8 +6081,6 @@ nm_device_activate_ip4_config_commit (gpointer user_data) out: _LOGD (LOGD_DEVICE, "Activation: Stage 5 of 5 (IPv4 Commit) complete."); - - return FALSE; } static void @@ -6099,19 +6132,15 @@ nm_device_activate_ip4_state_in_wait (NMDevice *self) return NM_DEVICE_GET_PRIVATE (self)->ip4_state == IP_WAIT; } -static gboolean -nm_device_activate_ip6_config_commit (gpointer user_data) +static void +nm_device_activate_ip6_config_commit (NMDevice *self) { - NMDevice *self = NM_DEVICE (user_data); NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); NMActRequest *req; NMConnection *connection; NMDeviceStateReason reason = NM_DEVICE_STATE_REASON_NONE; int ip_ifindex; - /* Clear the activation source ID now that this stage has run */ - activation_source_clear (self, FALSE, AF_INET6); - _LOGD (LOGD_DEVICE, "Activation: Stage 5 of 5 (IPv6 Commit) started..."); req = nm_device_get_act_request (self); @@ -6158,8 +6187,6 @@ nm_device_activate_ip6_config_commit (gpointer user_data) } _LOGD (LOGD_DEVICE, "Activation: Stage 5 of 5 (IPv6 Commit) complete."); - - return FALSE; } void @@ -6629,7 +6656,7 @@ nm_device_is_activating (NMDevice *self) * handler is actually run. If there's an activation handler scheduled * we're activating anyway. */ - return priv->act_source_id ? TRUE : FALSE; + return priv->act_handle4.id ? TRUE : FALSE; } /* IP Configuration stuff */ @@ -8386,8 +8413,8 @@ _cancel_activation (NMDevice *self) ip_check_gw_ping_cleanup (self); /* Break the activation chain */ - activation_source_clear (self, TRUE, AF_INET); - activation_source_clear (self, TRUE, AF_INET6); + activation_source_clear (self, AF_INET); + activation_source_clear (self, AF_INET6); } static void @@ -8819,7 +8846,7 @@ _set_state_full (NMDevice *self, */ if ( (priv->state == state) && !(state == NM_DEVICE_STATE_UNAVAILABLE && priv->firmware_missing)) { - _LOGt (LOGD_DEVICE, "device state change: %s -> %s (reason '%s') [%d %d %d] (skip due to missing firmware)", + _LOGD (LOGD_DEVICE, "device state change: %s -> %s (reason '%s') [%d %d %d] (skip due to missing firmware)", state_to_string (old_state), state_to_string (state), reason_to_string (reason), @@ -9399,6 +9426,26 @@ spec_match_list (NMDevice *self, const GSList *specs) /***********************************************************/ +static const char * +_activation_func_to_string (ActivationHandleFunc func) +{ +#define FUNC_TO_STRING_CHECK_AND_RETURN(func, f) \ + G_STMT_START { \ + if ((func) == (f)) \ + return #f; \ + } G_STMT_END + FUNC_TO_STRING_CHECK_AND_RETURN (func, nm_device_activate_stage1_device_prepare); + FUNC_TO_STRING_CHECK_AND_RETURN (func, nm_device_activate_stage2_device_config); + FUNC_TO_STRING_CHECK_AND_RETURN (func, nm_device_activate_stage3_ip_config_start); + FUNC_TO_STRING_CHECK_AND_RETURN (func, nm_device_activate_ip4_config_timeout); + FUNC_TO_STRING_CHECK_AND_RETURN (func, nm_device_activate_ip6_config_timeout); + FUNC_TO_STRING_CHECK_AND_RETURN (func, nm_device_activate_ip4_config_commit); + FUNC_TO_STRING_CHECK_AND_RETURN (func, nm_device_activate_ip6_config_commit); + g_return_val_if_reached ("unknown"); +} + +/***********************************************************/ + #define DEFAULT_AUTOCONNECT TRUE static void From 823ce8bf7338980c94fc9c694d133cbc1fd40aac Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 7 Oct 2015 12:07:51 +0200 Subject: [PATCH 3/5] device: rename nm_device_activate_*() functions The function name is logged, so change them to be more suitable: - drop the "nm_device_" prefix. It is redundant in the logging, and usually our static functions don't have an nm-prefix. - have all functions now start with "activate_stagex_". The stage number corresponds to what we are currently logging during activation: "Activation: Stage 1 of 5 (Device Prepare)..." No other functions start with a "activate_stagex_" prefix, so it's easy to grep. --- src/devices/nm-device.c | 52 ++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 0088e894d1..5414d28f7b 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -2966,13 +2966,13 @@ act_stage1_prepare (NMDevice *self, NMDeviceStateReason *reason) } /* - * nm_device_activate_stage1_device_prepare + * activate_stage1_device_prepare * * Prepare for device activation * */ static void -nm_device_activate_stage1_device_prepare (NMDevice *self) +activate_stage1_device_prepare (NMDevice *self) { NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); NMActStageReturn ret = NM_ACT_STAGE_RETURN_SUCCESS; @@ -3022,7 +3022,7 @@ nm_device_activate_schedule_stage1_device_prepare (NMDevice *self) priv = NM_DEVICE_GET_PRIVATE (self); g_return_if_fail (priv->act_request); - activation_source_schedule (self, nm_device_activate_stage1_device_prepare, AF_INET); + activation_source_schedule (self, activate_stage1_device_prepare, AF_INET); _LOGD (LOGD_DEVICE, "Activation: Stage 1 of 5 (Device Prepare) scheduled..."); } @@ -3035,14 +3035,14 @@ act_stage2_config (NMDevice *self, NMDeviceStateReason *reason) } /* - * nm_device_activate_stage2_device_config + * activate_stage2_device_config * * Determine device parameters and set those on the device, ie * for wireless devices, set SSID, keys, etc. * */ static void -nm_device_activate_stage2_device_config (NMDevice *self) +activate_stage2_device_config (NMDevice *self) { NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); NMActStageReturn ret; @@ -3136,7 +3136,7 @@ nm_device_activate_schedule_stage2_device_config (NMDevice *self) } } - activation_source_schedule (self, nm_device_activate_stage2_device_config, AF_INET); + activation_source_schedule (self, activate_stage2_device_config, AF_INET); _LOGD (LOGD_DEVICE, "Activation: Stage 2 of 5 (Device Configure) scheduled..."); } @@ -5545,13 +5545,13 @@ nm_device_activate_stage3_ip6_start (NMDevice *self) } /* - * nm_device_activate_stage3_ip_config_start + * activate_stage3_ip_config_start * * Begin automatic/manual IP configuration * */ static void -nm_device_activate_stage3_ip_config_start (NMDevice *self) +activate_stage3_ip_config_start (NMDevice *self) { NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); NMActiveConnection *master; @@ -5627,7 +5627,7 @@ fw_change_zone_cb (NMFirewallManager *firewall_manager, if (priv->state == NM_DEVICE_STATE_IP_CHECK) nm_device_start_ip_check (self); else { - activation_source_schedule (self, nm_device_activate_stage3_ip_config_start, AF_INET); + activation_source_schedule (self, activate_stage3_ip_config_start, AF_INET); _LOGD (LOGD_DEVICE, "Activation: Stage 3 of 5 (IP Configure Start) scheduled."); } } @@ -5661,7 +5661,7 @@ nm_device_activate_schedule_stage3_ip_config_start (NMDevice *self) if (nm_device_uses_assumed_connection (self)) { _LOGD (LOGD_DEVICE, "Activation: skip setting firewall zone '%s' for assumed device", zone ? zone : "default"); - activation_source_schedule (self, nm_device_activate_stage3_ip_config_start, AF_INET); + activation_source_schedule (self, activate_stage3_ip_config_start, AF_INET); _LOGD (LOGD_DEVICE, "Activation: Stage 3 of 5 (IP Configure Start) scheduled."); return; } @@ -5693,7 +5693,7 @@ act_stage4_ip4_config_timeout (NMDevice *self, NMDeviceStateReason *reason) * */ static void -nm_device_activate_ip4_config_timeout (NMDevice *self) +activate_stage4_ip4_config_timeout (NMDevice *self) { NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE; @@ -5735,7 +5735,7 @@ nm_device_activate_schedule_ip4_config_timeout (NMDevice *self) priv = NM_DEVICE_GET_PRIVATE (self); g_return_if_fail (priv->act_request); - activation_source_schedule (self, nm_device_activate_ip4_config_timeout, AF_INET); + activation_source_schedule (self, activate_stage4_ip4_config_timeout, AF_INET); _LOGD (LOGD_DEVICE | LOGD_IP4, "Activation: Stage 4 of 5 (IPv4 Configure Timeout) scheduled..."); } @@ -5754,13 +5754,13 @@ act_stage4_ip6_config_timeout (NMDevice *self, NMDeviceStateReason *reason) /* - * nm_device_activate_ip6_config_timeout + * activate_stage4_ip6_config_timeout * * Time out on retrieving the IPv6 config. * */ static void -nm_device_activate_ip6_config_timeout (NMDevice *self) +activate_stage4_ip6_config_timeout (NMDevice *self) { NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE; @@ -5802,7 +5802,7 @@ nm_device_activate_schedule_ip6_config_timeout (NMDevice *self) priv = NM_DEVICE_GET_PRIVATE (self); g_return_if_fail (priv->act_request); - activation_source_schedule (self, nm_device_activate_ip6_config_timeout, AF_INET6); + activation_source_schedule (self, activate_stage4_ip6_config_timeout, AF_INET6); _LOGD (LOGD_DEVICE | LOGD_IP6, "Activation: Stage 4 of 5 (IPv6 Configure Timeout) scheduled..."); } @@ -6011,7 +6011,7 @@ arp_announce (NMDevice *self) } static void -nm_device_activate_ip4_config_commit (NMDevice *self) +activate_stage5_ip4_config_commit (NMDevice *self) { NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); NMActRequest *req; @@ -6113,7 +6113,7 @@ nm_device_activate_schedule_ip4_config_result (NMDevice *self, NMIP4Config *conf priv->dev_ip4_config = g_object_ref (config); nm_device_queued_ip_config_change_clear (self); - activation_source_schedule (self, nm_device_activate_ip4_config_commit, AF_INET); + activation_source_schedule (self, activate_stage5_ip4_config_commit, AF_INET); _LOGD (LOGD_DEVICE | LOGD_IP4, "Activation: Stage 5 of 5 (IPv4 Configure Commit) scheduled..."); } @@ -6133,7 +6133,7 @@ nm_device_activate_ip4_state_in_wait (NMDevice *self) } static void -nm_device_activate_ip6_config_commit (NMDevice *self) +activate_stage5_ip6_config_commit (NMDevice *self) { NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); NMActRequest *req; @@ -6202,7 +6202,7 @@ nm_device_activate_schedule_ip6_config_result (NMDevice *self) if (priv->ip6_state == IP_FAIL) priv->ip6_state = IP_CONF; - activation_source_schedule (self, nm_device_activate_ip6_config_commit, AF_INET6); + activation_source_schedule (self, activate_stage5_ip6_config_commit, AF_INET6); _LOGD (LOGD_DEVICE | LOGD_IP6, "Activation: Stage 5 of 5 (IPv6 Commit) scheduled..."); } @@ -9434,13 +9434,13 @@ _activation_func_to_string (ActivationHandleFunc func) if ((func) == (f)) \ return #f; \ } G_STMT_END - FUNC_TO_STRING_CHECK_AND_RETURN (func, nm_device_activate_stage1_device_prepare); - FUNC_TO_STRING_CHECK_AND_RETURN (func, nm_device_activate_stage2_device_config); - FUNC_TO_STRING_CHECK_AND_RETURN (func, nm_device_activate_stage3_ip_config_start); - FUNC_TO_STRING_CHECK_AND_RETURN (func, nm_device_activate_ip4_config_timeout); - FUNC_TO_STRING_CHECK_AND_RETURN (func, nm_device_activate_ip6_config_timeout); - FUNC_TO_STRING_CHECK_AND_RETURN (func, nm_device_activate_ip4_config_commit); - FUNC_TO_STRING_CHECK_AND_RETURN (func, nm_device_activate_ip6_config_commit); + FUNC_TO_STRING_CHECK_AND_RETURN (func, activate_stage1_device_prepare); + FUNC_TO_STRING_CHECK_AND_RETURN (func, activate_stage2_device_config); + FUNC_TO_STRING_CHECK_AND_RETURN (func, activate_stage3_ip_config_start); + FUNC_TO_STRING_CHECK_AND_RETURN (func, activate_stage4_ip4_config_timeout); + FUNC_TO_STRING_CHECK_AND_RETURN (func, activate_stage4_ip6_config_timeout); + FUNC_TO_STRING_CHECK_AND_RETURN (func, activate_stage5_ip4_config_commit); + FUNC_TO_STRING_CHECK_AND_RETURN (func, activate_stage5_ip6_config_commit); g_return_val_if_reached ("unknown"); } From b343956d40fb53d3b4ff7002f8c84ff039dfff50 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 6 Oct 2015 14:27:03 +0200 Subject: [PATCH 4/5] device/logging: refactor logging for activation-stage Instead of adding explicit logging lines while scheduling and processing the activation-stages, only log them in activation_source_schedule() and activation_source_handle_cb(). Effectively, lines like: "Activation: Stage 1 of 5 (Device Prepare) started..." are now: "activation-stage: invoke activate_stage1_device_prepare,2 (id x)" --- src/devices/nm-device.c | 85 +++++++++-------------------------------- 1 file changed, 18 insertions(+), 67 deletions(-) diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 5414d28f7b..cd921b16e8 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -2984,25 +2984,21 @@ activate_stage1_device_prepare (NMDevice *self) /* Notify the new ActiveConnection along with the state change */ g_object_notify (G_OBJECT (self), NM_DEVICE_ACTIVE_CONNECTION); - _LOGD (LOGD_DEVICE, "Activation: Stage 1 of 5 (Device Prepare) started..."); nm_device_state_changed (self, NM_DEVICE_STATE_PREPARE, NM_DEVICE_STATE_REASON_NONE); /* Assumed connections were already set up outside NetworkManager */ if (!nm_active_connection_get_assumed (active)) { ret = NM_DEVICE_GET_CLASS (self)->act_stage1_prepare (self, &reason); if (ret == NM_ACT_STAGE_RETURN_POSTPONE) { - goto out; + return; } else if (ret == NM_ACT_STAGE_RETURN_FAILURE) { nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, reason); - goto out; + return; } g_assert (ret == NM_ACT_STAGE_RETURN_SUCCESS); } nm_device_activate_schedule_stage2_device_config (self); - -out: - _LOGD (LOGD_DEVICE, "Activation: Stage 1 of 5 (Device Prepare) complete."); } @@ -3023,8 +3019,6 @@ nm_device_activate_schedule_stage1_device_prepare (NMDevice *self) g_return_if_fail (priv->act_request); activation_source_schedule (self, activate_stage1_device_prepare, AF_INET); - - _LOGD (LOGD_DEVICE, "Activation: Stage 1 of 5 (Device Prepare) scheduled..."); } static NMActStageReturn @@ -3051,7 +3045,6 @@ activate_stage2_device_config (NMDevice *self) NMActiveConnection *active = NM_ACTIVE_CONNECTION (priv->act_request); GSList *iter; - _LOGD (LOGD_DEVICE, "Activation: Stage 2 of 5 (Device Configure) starting..."); nm_device_state_changed (self, NM_DEVICE_STATE_CONFIG, NM_DEVICE_STATE_REASON_NONE); /* Assumed connections were already set up outside NetworkManager */ @@ -3061,15 +3054,15 @@ activate_stage2_device_config (NMDevice *self) nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_FIRMWARE_MISSING); else nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_CONFIG_FAILED); - goto out; + return; } ret = NM_DEVICE_GET_CLASS (self)->act_stage2_config (self, &reason); if (ret == NM_ACT_STAGE_RETURN_POSTPONE) - goto out; + return; else if (ret == NM_ACT_STAGE_RETURN_FAILURE) { nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, reason); - goto out; + return; } g_assert (ret == NM_ACT_STAGE_RETURN_SUCCESS); } @@ -3086,12 +3079,7 @@ activate_stage2_device_config (NMDevice *self) nm_device_queue_recheck_assume (info->slave); } - _LOGD (LOGD_DEVICE, "Activation: Stage 2 of 5 (Device Configure) successful."); - nm_device_activate_schedule_stage3_ip_config_start (self); - -out: - _LOGD (LOGD_DEVICE, "Activation: Stage 2 of 5 (Device Configure) complete."); } @@ -3137,8 +3125,6 @@ nm_device_activate_schedule_stage2_device_config (NMDevice *self) } activation_source_schedule (self, activate_stage2_device_config, AF_INET); - - _LOGD (LOGD_DEVICE, "Activation: Stage 2 of 5 (Device Configure) scheduled..."); } /* @@ -3374,8 +3360,7 @@ ipv4ll_start (NMDevice *self, NMDeviceStateReason *reason) goto fail; } - _LOGI (LOGD_DEVICE | LOGD_AUTOIP4, - "Activation: Stage 3 of 5 (IP Configure Start) IPv4LL started"); + _LOGI (LOGD_DEVICE | LOGD_AUTOIP4, "IPv4LL: started"); /* Start a timeout to bound the address attempt */ priv->ipv4ll_timeout = g_timeout_add_seconds (20, ipv4ll_timeout_cb, self); @@ -5559,7 +5544,6 @@ activate_stage3_ip_config_start (NMDevice *self) priv->ip4_state = priv->ip6_state = IP_WAIT; - _LOGD (LOGD_DEVICE, "Activation: Stage 3 of 5 (IP Configure Start) started..."); nm_device_state_changed (self, NM_DEVICE_STATE_IP_CONFIG, NM_DEVICE_STATE_REASON_NONE); /* Device should be up before we can do anything with it */ @@ -5583,21 +5567,18 @@ activate_stage3_ip_config_start (NMDevice *self) nm_connection_get_id (nm_device_get_applied_connection (self)), master_device ? nm_device_get_iface (master_device) : "(unknown)"); } - goto out; + return; } /* IPv4 */ if (!nm_device_activate_stage3_ip4_start (self)) - goto out; + return; /* IPv6 */ if (!nm_device_activate_stage3_ip6_start (self)) - goto out; + return; nm_device_check_ip_failed (self, TRUE); - -out: - _LOGD (LOGD_DEVICE, "Activation: Stage 3 of 5 (IP Configure Start) complete."); } @@ -5626,10 +5607,8 @@ fw_change_zone_cb (NMFirewallManager *firewall_manager, if (priv->state == NM_DEVICE_STATE_IP_CHECK) nm_device_start_ip_check (self); - else { + else activation_source_schedule (self, activate_stage3_ip_config_start, AF_INET); - _LOGD (LOGD_DEVICE, "Activation: Stage 3 of 5 (IP Configure Start) scheduled."); - } } /* @@ -5662,7 +5641,6 @@ nm_device_activate_schedule_stage3_ip_config_start (NMDevice *self) if (nm_device_uses_assumed_connection (self)) { _LOGD (LOGD_DEVICE, "Activation: skip setting firewall zone '%s' for assumed device", zone ? zone : "default"); activation_source_schedule (self, activate_stage3_ip_config_start, AF_INET); - _LOGD (LOGD_DEVICE, "Activation: Stage 3 of 5 (IP Configure Start) scheduled."); return; } @@ -5699,23 +5677,18 @@ activate_stage4_ip4_config_timeout (NMDevice *self) NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE; NMDeviceStateReason reason = NM_DEVICE_STATE_REASON_NONE; - _LOGD (LOGD_DEVICE | LOGD_IP4, "Activation: Stage 4 of 5 (IPv4 Configure Timeout) started..."); - ret = NM_DEVICE_GET_CLASS (self)->act_stage4_ip4_config_timeout (self, &reason); if (ret == NM_ACT_STAGE_RETURN_POSTPONE) - goto out; + return; else if (ret == NM_ACT_STAGE_RETURN_FAILURE) { nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, reason); - goto out; + return; } - g_assert (ret == NM_ACT_STAGE_RETURN_SUCCESS); + g_assert (ret == NM_ACT_STAGE_RETURN_SUCCESS); priv->ip4_state = IP_FAIL; nm_device_check_ip_failed (self, FALSE); - -out: - _LOGD (LOGD_DEVICE | LOGD_IP4, "Activation: Stage 4 of 5 (IPv4 Configure Timeout) complete."); } @@ -5736,8 +5709,6 @@ nm_device_activate_schedule_ip4_config_timeout (NMDevice *self) g_return_if_fail (priv->act_request); activation_source_schedule (self, activate_stage4_ip4_config_timeout, AF_INET); - - _LOGD (LOGD_DEVICE | LOGD_IP4, "Activation: Stage 4 of 5 (IPv4 Configure Timeout) scheduled..."); } @@ -5766,23 +5737,18 @@ activate_stage4_ip6_config_timeout (NMDevice *self) NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE; NMDeviceStateReason reason = NM_DEVICE_STATE_REASON_NONE; - _LOGD (LOGD_DEVICE | LOGD_IP6, "Activation: Stage 4 of 5 (IPv6 Configure Timeout) started..."); - ret = NM_DEVICE_GET_CLASS (self)->act_stage4_ip6_config_timeout (self, &reason); if (ret == NM_ACT_STAGE_RETURN_POSTPONE) - goto out; - else if (ret == NM_ACT_STAGE_RETURN_FAILURE) { + return; + if (ret == NM_ACT_STAGE_RETURN_FAILURE) { nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, reason); - goto out; + return; } g_assert (ret == NM_ACT_STAGE_RETURN_SUCCESS); priv->ip6_state = IP_FAIL; nm_device_check_ip_failed (self, FALSE); - -out: - _LOGD (LOGD_DEVICE | LOGD_IP6, "Activation: Stage 4 of 5 (IPv6 Configure Timeout) complete."); } @@ -5803,8 +5769,6 @@ nm_device_activate_schedule_ip6_config_timeout (NMDevice *self) g_return_if_fail (priv->act_request); activation_source_schedule (self, activate_stage4_ip6_config_timeout, AF_INET6); - - _LOGD (LOGD_DEVICE | LOGD_IP6, "Activation: Stage 4 of 5 (IPv6 Configure Timeout) scheduled..."); } static gboolean @@ -6020,8 +5984,6 @@ activate_stage5_ip4_config_commit (NMDevice *self) NMDeviceStateReason reason = NM_DEVICE_STATE_REASON_NONE; int ip_ifindex; - _LOGD (LOGD_DEVICE, "Activation: Stage 5 of 5 (IPv4 Commit) started..."); - req = nm_device_get_act_request (self); g_assert (req); connection = nm_act_request_get_applied_connection (req); @@ -6039,7 +6001,7 @@ activate_stage5_ip4_config_commit (NMDevice *self) if (!ip4_config_merge_and_apply (self, NULL, TRUE, &reason)) { _LOGD (LOGD_DEVICE | LOGD_IP4, "Activation: Stage 5 of 5 (IPv4 Commit) failed"); nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, reason); - goto out; + return; } /* Start IPv4 sharing if we need it */ @@ -6049,7 +6011,7 @@ activate_stage5_ip4_config_commit (NMDevice *self) if (!start_sharing (self, priv->ip4_config)) { _LOGW (LOGD_SHARING, "Activation: Stage 5 of 5 (IPv4 Commit) start sharing failed."); nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_SHARED_START_FAILED); - goto out; + return; } } @@ -6078,9 +6040,6 @@ activate_stage5_ip4_config_commit (NMDevice *self) if (nm_device_get_state (self) == NM_DEVICE_STATE_IP_CONFIG) nm_device_state_changed (self, NM_DEVICE_STATE_IP_CHECK, NM_DEVICE_STATE_REASON_NONE); - -out: - _LOGD (LOGD_DEVICE, "Activation: Stage 5 of 5 (IPv4 Commit) complete."); } static void @@ -6114,8 +6073,6 @@ nm_device_activate_schedule_ip4_config_result (NMDevice *self, NMIP4Config *conf nm_device_queued_ip_config_change_clear (self); activation_source_schedule (self, activate_stage5_ip4_config_commit, AF_INET); - - _LOGD (LOGD_DEVICE | LOGD_IP4, "Activation: Stage 5 of 5 (IPv4 Configure Commit) scheduled..."); } gboolean @@ -6141,8 +6098,6 @@ activate_stage5_ip6_config_commit (NMDevice *self) NMDeviceStateReason reason = NM_DEVICE_STATE_REASON_NONE; int ip_ifindex; - _LOGD (LOGD_DEVICE, "Activation: Stage 5 of 5 (IPv6 Commit) started..."); - req = nm_device_get_act_request (self); g_assert (req); connection = nm_act_request_get_applied_connection (req); @@ -6185,8 +6140,6 @@ activate_stage5_ip6_config_commit (NMDevice *self) _LOGW (LOGD_DEVICE | LOGD_IP6, "Activation: Stage 5 of 5 (IPv6 Commit) failed"); nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, reason); } - - _LOGD (LOGD_DEVICE, "Activation: Stage 5 of 5 (IPv6 Commit) complete."); } void @@ -6203,8 +6156,6 @@ nm_device_activate_schedule_ip6_config_result (NMDevice *self) priv->ip6_state = IP_CONF; activation_source_schedule (self, activate_stage5_ip6_config_commit, AF_INET6); - - _LOGD (LOGD_DEVICE | LOGD_IP6, "Activation: Stage 5 of 5 (IPv6 Commit) scheduled..."); } gboolean From 061028961a31e048aa7cf0d43ef071f52f7b2441 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 6 Oct 2015 17:26:27 +0200 Subject: [PATCH 5/5] device: refactor setting firewall zone during activation-stage2 schedule_stage3() used to set the firewall before really scheduling the stage3. In that case, fw_change_zone_cb() would then directly call: activation_source_schedule (self, activate_stage3_ip_config_start, AF_INET); This was different from all other places. Usually, only the nm_device_schedule_*() functions would directly call to activation_source_schedule(). Change this, to behave similar as when we wait for master-ready while scheduling stage2. As such, it is more idiomatic, and it would still work correctly even if there were multiple conditions that would block scheduling-stage3. --- src/devices/nm-device.c | 95 ++++++++++++++++++++++++++--------------- 1 file changed, 61 insertions(+), 34 deletions(-) diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index cd921b16e8..4c7d917418 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -297,6 +297,7 @@ typedef struct { gulong dnsmasq_state_id; /* Firewall */ + gboolean fw_ready; NMFirewallManagerCallId fw_call; /* IPv4LL stuff */ @@ -5581,34 +5582,56 @@ activate_stage3_ip_config_start (NMDevice *self) nm_device_check_ip_failed (self, TRUE); } +static gboolean +fw_change_zone_handle (NMDevice *self, + NMFirewallManagerCallId call_id, + GError *error) +{ + NMDevicePrivate *priv; + + g_return_val_if_fail (NM_IS_DEVICE (self), FALSE); + + priv = NM_DEVICE_GET_PRIVATE (self); + + g_return_val_if_fail (priv->fw_call == call_id, FALSE); + priv->fw_call = NULL; + + return !nm_utils_error_is_cancelled (error, FALSE); +} static void -fw_change_zone_cb (NMFirewallManager *firewall_manager, - NMFirewallManagerCallId call_id, - GError *error, - gpointer user_data) +fw_change_zone_cb_stage2 (NMFirewallManager *firewall_manager, + NMFirewallManagerCallId call_id, + GError *error, + gpointer user_data) { NMDevice *self = user_data; NMDevicePrivate *priv; - g_return_if_fail (NM_IS_DEVICE (self)); - - priv = NM_DEVICE_GET_PRIVATE (self); - - g_return_if_fail (priv->fw_call == call_id); - priv->fw_call = NULL; - - if (nm_utils_error_is_cancelled (error, FALSE)) + if (!fw_change_zone_handle (self, call_id, error)) return; - if (error) { - /* FIXME: fail the device activation? */ - } + /* FIXME: fail the device on error? */ - if (priv->state == NM_DEVICE_STATE_IP_CHECK) - nm_device_start_ip_check (self); - else - activation_source_schedule (self, activate_stage3_ip_config_start, AF_INET); + priv = NM_DEVICE_GET_PRIVATE (self); + priv->fw_ready = TRUE; + + nm_device_activate_schedule_stage3_ip_config_start (self); +} + +static void +fw_change_zone_cb_ip_check (NMFirewallManager *firewall_manager, + NMFirewallManagerCallId call_id, + GError *error, + gpointer user_data) +{ + NMDevice *self = user_data; + + if (!fw_change_zone_handle (self, call_id, error)) + return; + + /* FIXME: fail the device on error? */ + nm_device_start_ip_check (self); } /* @@ -5629,28 +5652,31 @@ nm_device_activate_schedule_stage3_ip_config_start (NMDevice *self) priv = NM_DEVICE_GET_PRIVATE (self); g_return_if_fail (priv->act_request); - g_return_if_fail (!priv->fw_call); - /* Add the interface to the specified firewall zone */ connection = nm_device_get_applied_connection (self); g_assert (connection); s_con = nm_connection_get_setting_connection (connection); - zone = nm_setting_connection_get_zone (s_con); + if (!priv->fw_ready) { + if (nm_device_uses_assumed_connection (self)) + priv->fw_ready = TRUE; + else { + if (!priv->fw_call) { + zone = nm_setting_connection_get_zone (s_con); - if (nm_device_uses_assumed_connection (self)) { - _LOGD (LOGD_DEVICE, "Activation: skip setting firewall zone '%s' for assumed device", zone ? zone : "default"); - activation_source_schedule (self, activate_stage3_ip_config_start, AF_INET); - return; + _LOGD (LOGD_DEVICE, "Activation: setting firewall zone '%s'", zone ? zone : "default"); + priv->fw_call = nm_firewall_manager_add_or_change_zone (nm_firewall_manager_get (), + nm_device_get_ip_iface (self), + zone, + FALSE, + fw_change_zone_cb_stage2, + self); + } + return; + } } - _LOGD (LOGD_DEVICE, "Activation: setting firewall zone '%s'", zone ? zone : "default"); - priv->fw_call = nm_firewall_manager_add_or_change_zone (nm_firewall_manager_get (), - nm_device_get_ip_iface (self), - zone, - FALSE, - fw_change_zone_cb, - self); + activation_source_schedule (self, activate_stage3_ip_config_start, AF_INET); } static NMActStageReturn @@ -8360,6 +8386,7 @@ _cancel_activation (NMDevice *self) g_warn_if_fail (!priv->fw_call); priv->fw_call = NULL; } + priv->fw_ready = FALSE; ip_check_gw_ping_cleanup (self); @@ -9049,7 +9076,7 @@ _set_state_full (NMDevice *self, nm_device_get_ip_iface (self), zone, FALSE, - fw_change_zone_cb, + fw_change_zone_cb_ip_check, self); } else nm_device_start_ip_check (self);