From 2bf7d6b5db5093a78a3dbced9ad39a54a3fe907d Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Tue, 14 Oct 2014 11:41:36 -0500 Subject: [PATCH] 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). --- src/devices/nm-device.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 1597d18faf..87bebdb1eb 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -2994,9 +2994,7 @@ act_stage3_ip4_config_start (NMDevice *self, connection = nm_device_get_connection (self); g_assert (connection); - method = nm_utils_get_ip_config_method (connection, NM_TYPE_SETTING_IP4_CONFIG); - - if ( strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL) != 0 + if ( connection_ip4_method_requires_carrier (connection, NULL) && priv->is_master && !priv->carrier) { _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 */ if (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0) ret = dhcp4_start (self, connection, reason); @@ -4011,9 +4011,7 @@ act_stage3_ip6_config_start (NMDevice *self, connection = nm_device_get_connection (self); g_assert (connection); - method = nm_utils_get_ip_config_method (connection, NM_TYPE_SETTING_IP6_CONFIG); - - if ( strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_MANUAL) != 0 + if ( connection_ip4_method_requires_carrier (connection, NULL) && priv->is_master && !priv->carrier) { _LOGI (LOGD_IP6 | LOGD_DEVICE, @@ -4038,6 +4036,8 @@ act_stage3_ip6_config_start (NMDevice *self, 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 (!priv->master) { /* When activating an IPv6 'ignore' connection we need to revert back