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 0652d9c596,
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
This commit is contained in:
Thomas Haller
2016-08-29 15:37:55 +02:00
parent 067aa50363
commit 553717bb1c
2 changed files with 4 additions and 5 deletions

View File

@@ -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

View File

@@ -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,