From 3a7f07e2f04b534fe42ea8ff43906d11521af53c Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Tue, 25 Feb 2014 18:00:34 -0600 Subject: [PATCH] core: postpone non-static master IP configuration until carrier This got broken at some point. The intent of ignore-carrier was always to ignore the carrier for IP configuration for static/manual connections, but never for DHCP/SLAAC where a link is actually required. Thus when checking whether to postpone IP configuration for a master interface that's using DHCP/SLAAC, don't allow ignore-carrier to factor into the decision. --- src/devices/nm-device.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 3c069e04f8..282a77caa7 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -1085,17 +1085,6 @@ nm_device_has_carrier (NMDevice *device) return NM_DEVICE_GET_PRIVATE (device)->carrier; } -/* Returns %TRUE if @device is unavailable for connections because it - * needs carrier but does not have it. - */ -static gboolean -nm_device_is_unavailable_because_of_carrier (NMDevice *device) -{ - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); - - return !priv->carrier && !priv->ignore_carrier; -} - #define LINK_DISCONNECT_DELAY 4 static gboolean @@ -2917,7 +2906,7 @@ act_stage3_ip4_config_start (NMDevice *self, if ( strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL) != 0 && nm_device_is_master (self) - && nm_device_is_unavailable_because_of_carrier (self)) { + && !priv->carrier) { nm_log_info (LOGD_IP4 | LOGD_DEVICE, "(%s): IPv4 config waiting until carrier is on", nm_device_get_ip_iface (self)); @@ -3685,7 +3674,7 @@ act_stage3_ip6_config_start (NMDevice *self, if ( strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_MANUAL) != 0 && nm_device_is_master (self) - && nm_device_is_unavailable_because_of_carrier (self)) { + && !priv->carrier) { nm_log_info (LOGD_IP6 | LOGD_DEVICE, "(%s): IPv6 config waiting until carrier is on", ip_iface); return NM_ACT_STAGE_RETURN_WAIT; @@ -4893,10 +4882,13 @@ nm_device_is_activating (NMDevice *device) static gboolean can_interrupt_activation (NMDevice *device) { + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); + /* Devices that support carrier detect can interrupt activation - * if the link becomes inactive. + * if the link becomes inactive and carrier is honored. */ - return nm_device_is_unavailable_because_of_carrier (device); + return !priv->carrier && !priv->ignore_carrier; + } gboolean