From 553717bb1c9ed31be0fab85bc37f6823dc8ab480 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 29 Aug 2016 15:37:55 +0200 Subject: [PATCH] device: don't set ip4_state=IP_FAIL for ipv4.method=disabled ... and don't set ip6_state=IP_FAIL for ipv6.method=ignore. The disabled state is like having an empty NMIP4Config object. It should not result in %IP_FAIL state. Instead, we just want to proceed and commit an empty NMIP4Config instance. This was introduced by commit 0652d9c5961e4636eab87647af890aaf8c3e3269, which I think was wrong. Likewise, for ipv6.method=ignore we also don't want to mark the IP state as failed. Instead, we want to proceed and set IP_DONE right away -- without commiting anything, which is a difference to the IPv4 case. This is especially important, because an ip4_state/ip6_state of IP_FAIL causes nm_device_can_assume_active_connection() to return FALSE, which means we unmanage devices at shutdown. Ony might say that it doesn't matter so much for a device without IP configuration, but imagine a bond with VLANs on top that only has Layer 2 configuration. This will bring down the entire stack. With this change, devices with IP methods disabled/ignore stay up on exit of NetworkManager (rh#1371126). Of course, that means on restart software devices stay unamanged due to external-down (because since commit e1edcda, devices without IP address are also external-down). So, this really just fixes one scenario, breaking another one. This should be fixed with bgo#746440 by not assuming connections. https://bugzilla.redhat.com/show_bug.cgi?id=1371126 --- src/devices/nm-device.c | 5 ++--- src/devices/wwan/nm-modem.c | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 743202eb9..7fc61509c 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -5438,8 +5438,7 @@ act_stage3_ip4_config_start (NMDevice *self, g_return_val_if_reached (NM_ACT_STAGE_RETURN_FAILURE); } else if (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) == 0) { apply_mtu_from_config (self); - /* Nothing else to do... */ - ret = NM_ACT_STAGE_RETURN_IP_FAIL; + ret = NM_ACT_STAGE_RETURN_SUCCESS; } else _LOGW (LOGD_IP4, "unhandled IPv4 config method '%s'; will fail", method); @@ -6760,7 +6759,7 @@ act_stage3_ip6_config_start (NMDevice *self, nm_device_ipv6_sysctl_set (self, "disable_ipv6", "1"); restore_ip6_properties (self); } - return NM_ACT_STAGE_RETURN_IP_FAIL; + return NM_ACT_STAGE_RETURN_IP_DONE; } /* Ensure the MTU makes sense. If it was below 1280 the kernel would not diff --git a/src/devices/wwan/nm-modem.c b/src/devices/wwan/nm-modem.c index bf3eac926..94430af47 100644 --- a/src/devices/wwan/nm-modem.c +++ b/src/devices/wwan/nm-modem.c @@ -590,7 +590,7 @@ nm_modem_stage3_ip4_config_start (NMModem *self, /* Only Disabled and Auto methods make sense for WWAN */ if (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) == 0) - return NM_ACT_STAGE_RETURN_IP_FAIL; + return NM_ACT_STAGE_RETURN_SUCCESS; if (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO) != 0) { nm_log_warn (LOGD_MB | LOGD_IP4, @@ -709,7 +709,7 @@ nm_modem_stage3_ip6_config_start (NMModem *self, /* Only Ignore and Auto methods make sense for WWAN */ if (strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE) == 0) - return NM_ACT_STAGE_RETURN_IP_FAIL; + return NM_ACT_STAGE_RETURN_IP_DONE; if (strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO) != 0) { nm_log_warn (LOGD_MB | LOGD_IP6,