manager: assume DHCP if we see a lease on taking over an initramfs connection

In general, we aren't really able to tell, but when we see a lease file
we're pretty sure that DHCP is what was going on.

https://bugzilla.redhat.com/show_bug.cgi?id=1771792
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/335

Fixes: f2fe6c03ee ('manager: don't treat the initramfs-configured DHCP connections as generated')
(cherry picked from commit 7a84388a9b)
This commit is contained in:
Lubomir Rintel 2019-11-15 22:09:14 +01:00
parent 3a133e2826
commit e19138b94c

View file

@ -2741,6 +2741,12 @@ recheck_assume_connection (NMManager *self,
activation_type_assume = TRUE;
if (generated) {
/* Reset the IPv4 setting to empty method=auto, regardless of what assumption guessed. */
nm_connection_add_setting (nm_settings_connection_get_connection (sett_conn),
g_object_new (NM_TYPE_SETTING_IP4_CONFIG,
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
NULL));
nm_settings_connection_update (sett_conn,
NULL,
NM_SETTINGS_CONNECTION_PERSIST_MODE_KEEP,