wired: ignore carrier state for manual/static bridge and bond connections

NM is supposed to ignore carrier and slave states for manual/static
connections when bringing up bonds and bridges, on the theory that
since static configuration does not require connectivity, there's
no need to wait for that connectivity to happen. This wasn't
happening during the IP configuration phase, but was happening
before getting to the IP config phase where the device waits
for slaves before starting IP configuration if the method
requires connectivity.
This commit is contained in:
Dan Williams 2013-06-07 15:11:23 -05:00
parent 10f3a97889
commit 790c102fff

View file

@ -2442,7 +2442,23 @@ act_stage3_ip4_config_start (NMDevice *self,
g_return_val_if_fail (reason != NULL, NM_ACT_STAGE_RETURN_FAILURE);
if ( nm_device_is_master (self)
connection = nm_device_get_connection (self);
g_assert (connection);
/* If we did not receive IP4 configuration information, default to DHCP.
* Slaves, on the other hand, never have any IP configuration themselves,
* since the master handles all of that.
*/
s_ip4 = nm_connection_get_setting_ip4_config (connection);
if (priv->master) /* eg, device is a slave */
method = NM_SETTING_IP4_CONFIG_METHOD_DISABLED;
else if (s_ip4)
method = nm_setting_ip4_config_get_method (s_ip4);
else
method = NM_SETTING_IP4_CONFIG_METHOD_AUTO;
if ( g_strcmp0 (method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL) != 0
&& nm_device_is_master (self)
&& nm_device_is_unavailable_because_of_carrier (self)) {
nm_log_info (LOGD_IP4 | LOGD_DEVICE,
"(%s): IPv4 config waiting until carrier is on",
@ -2450,9 +2466,6 @@ act_stage3_ip4_config_start (NMDevice *self,
return NM_ACT_STAGE_RETURN_WAIT;
}
connection = nm_device_get_connection (self);
g_assert (connection);
if (priv->is_master && ip4_requires_slaves (connection)) {
/* If the master has no ready slaves, and depends on slaves for
* a successful IPv4 attempt, then postpone IPv4 addressing.
@ -2469,18 +2482,6 @@ act_stage3_ip4_config_start (NMDevice *self,
}
}
/* If we did not receive IP4 configuration information, default to DHCP.
* Slaves, on the other hand, never have any IP configuration themselves,
* since the master handles all of that.
*/
s_ip4 = nm_connection_get_setting_ip4_config (connection);
if (priv->master) /* eg, device is a slave */
method = NM_SETTING_IP4_CONFIG_METHOD_DISABLED;
else if (s_ip4)
method = nm_setting_ip4_config_get_method (s_ip4);
else
method = NM_SETTING_IP4_CONFIG_METHOD_AUTO;
/* Start IPv4 addressing based on the method requested */
if (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0)
ret = dhcp4_start (self, connection, reason);
@ -3049,18 +3050,30 @@ act_stage3_ip6_config_start (NMDevice *self,
g_return_val_if_fail (reason != NULL, NM_ACT_STAGE_RETURN_FAILURE);
if ( nm_device_is_master (self)
&& nm_device_is_unavailable_because_of_carrier (self)) {
nm_log_info (LOGD_IP6 | LOGD_DEVICE,
"(%s): IPv6 config waiting until carrier is on",
nm_device_get_ip_iface (self));
return NM_ACT_STAGE_RETURN_WAIT;
}
ip_iface = nm_device_get_ip_iface (self);
connection = nm_device_get_connection (self);
g_assert (connection);
ip_iface = nm_device_get_ip_iface (self);
/* If we did not receive IP6 configuration information, default to AUTO.
* Slaves, on the other hand, never have any IP configuration themselves,
* since the master handles all of that.
*/
s_ip6 = nm_connection_get_setting_ip6_config (connection);
if (priv->master) /* eg, device is a slave */
method = NM_SETTING_IP6_CONFIG_METHOD_IGNORE;
else if (s_ip6)
method = nm_setting_ip6_config_get_method (s_ip6);
else
method = NM_SETTING_IP6_CONFIG_METHOD_AUTO;
if ( g_strcmp0 (method, NM_SETTING_IP6_CONFIG_METHOD_MANUAL) != 0
&& nm_device_is_master (self)
&& nm_device_is_unavailable_because_of_carrier (self)) {
nm_log_info (LOGD_IP6 | LOGD_DEVICE,
"(%s): IPv6 config waiting until carrier is on", ip_iface);
return NM_ACT_STAGE_RETURN_WAIT;
}
if (priv->is_master && ip6_requires_slaves (connection)) {
/* If the master has no ready slaves, and depends on slaves for
@ -3083,18 +3096,6 @@ act_stage3_ip6_config_start (NMDevice *self,
priv->dhcp6_mode = IP6_DHCP_OPT_NONE;
/* If we did not receive IP6 configuration information, default to AUTO.
* Slaves, on the other hand, never have any IP configuration themselves,
* since the master handles all of that.
*/
s_ip6 = nm_connection_get_setting_ip6_config (connection);
if (priv->master) /* eg, device is a slave */
method = NM_SETTING_IP6_CONFIG_METHOD_IGNORE;
else if (s_ip6)
method = nm_setting_ip6_config_get_method (s_ip6);
else
method = NM_SETTING_IP6_CONFIG_METHOD_AUTO;
if ( strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO) == 0
|| strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL) == 0) {
if (!addrconf6_start (self)) {