core: loosen master device carrier check before IP configuration

Previously a master device would wait for a carrier before starting
IP configuration only for 'manual' connections, but that's not quite
broad enough.  We also want to allow SHARED methods to proceed
immediately since they are also effectively static/manual configuration.

Use the newly split out methods for checking whether a connection
requires a carrier or not to allow the SHARED method to proceed
for master devices without a carrier.

For example, this allows bridge configurations with tun/tap ports
to set up SHARED addressing before the tun/tap gets a carrier which
only happens when something opens the other side of the tun/tap
(like the VM or container).
This commit is contained in:
Dan Williams
2014-10-14 11:41:36 -05:00
parent 9e1d31763b
commit 2bf7d6b5db

View File

@@ -2994,9 +2994,7 @@ act_stage3_ip4_config_start (NMDevice *self,
connection = nm_device_get_connection (self); connection = nm_device_get_connection (self);
g_assert (connection); g_assert (connection);
method = nm_utils_get_ip_config_method (connection, NM_TYPE_SETTING_IP4_CONFIG); if ( connection_ip4_method_requires_carrier (connection, NULL)
if ( strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL) != 0
&& priv->is_master && priv->is_master
&& !priv->carrier) { && !priv->carrier) {
_LOGI (LOGD_IP4 | LOGD_DEVICE, _LOGI (LOGD_IP4 | LOGD_DEVICE,
@@ -3019,6 +3017,8 @@ act_stage3_ip4_config_start (NMDevice *self,
} }
} }
method = nm_utils_get_ip_config_method (connection, NM_TYPE_SETTING_IP4_CONFIG);
/* Start IPv4 addressing based on the method requested */ /* Start IPv4 addressing based on the method requested */
if (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0) if (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0)
ret = dhcp4_start (self, connection, reason); ret = dhcp4_start (self, connection, reason);
@@ -4011,9 +4011,7 @@ act_stage3_ip6_config_start (NMDevice *self,
connection = nm_device_get_connection (self); connection = nm_device_get_connection (self);
g_assert (connection); g_assert (connection);
method = nm_utils_get_ip_config_method (connection, NM_TYPE_SETTING_IP6_CONFIG); if ( connection_ip4_method_requires_carrier (connection, NULL)
if ( strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_MANUAL) != 0
&& priv->is_master && priv->is_master
&& !priv->carrier) { && !priv->carrier) {
_LOGI (LOGD_IP6 | LOGD_DEVICE, _LOGI (LOGD_IP6 | LOGD_DEVICE,
@@ -4038,6 +4036,8 @@ act_stage3_ip6_config_start (NMDevice *self,
priv->dhcp6_mode = NM_RDISC_DHCP_LEVEL_NONE; priv->dhcp6_mode = NM_RDISC_DHCP_LEVEL_NONE;
method = nm_utils_get_ip_config_method (connection, NM_TYPE_SETTING_IP6_CONFIG);
if (strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE) == 0) { if (strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE) == 0) {
if (!priv->master) { if (!priv->master) {
/* When activating an IPv6 'ignore' connection we need to revert back /* When activating an IPv6 'ignore' connection we need to revert back