summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2016-05-29 17:54:36 +0200
committerThomas Haller <thaller@redhat.com>2016-05-29 18:00:20 +0200
commitcdce05627294fc6b0192b4e32c1d69c83574f0d0 (patch)
tree3c9ffd4af7489d5a157b500c51e2bea393151c40
parent04852d2877cf94d80d17d0e3f46eb1d286a0ecdb (diff)
downloadNetworkManager-th/device-ip-config-on-link-up-rh1309899-pt2.tar.gz
device: reconfigure IP addressing after bringing up deviceth/device-ip-config-on-link-up-rh1309899-pt2
For changing the hardware address, we must bring the device down. When doing that, IP addressing is lost and it must be re-configured after bringing the device up again. We already do something similar in device_link_changed(), but that might not be sufficient, because device_link_changed() is run on an idle handler, thus, while chaning the hardware address it has no chance to run (or see that the device was shortly down). https://bugzilla.redhat.com/show_bug.cgi?id=1309899
-rw-r--r--src/devices/nm-device.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index dfbf3ebbc8..707f391a2e 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -8855,6 +8855,17 @@ nm_device_bring_up (NMDevice *self, gboolean block, gboolean *no_firmware)
nm_device_update_hw_address (self);
_update_ip4_address (self);
+
+ /* when the link comes up, we must restore IP configuration if necessary. */
+ if (priv->ip4_state == IP_DONE) {
+ if (!ip4_config_merge_and_apply (self, NULL, TRUE, NULL))
+ _LOGW (LOGD_IP4, "failed applying IP4 config after bringing link up");
+ }
+ if (priv->ip6_state == IP_DONE) {
+ if (!ip6_config_merge_and_apply (self, TRUE, NULL))
+ _LOGW (LOGD_IP6, "failed applying IP6 config after bringing link up");
+ }
+
return TRUE;
}