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-30 18:18:44 +0200
commite0805fc686bfdc01f2026dfb02263a4351f8f301 (patch)
tree7e4cef8b8633d4d3b77026cc62b404ec74087d20
parente9d8c4e44e97c28fbe1af04ae39bd8280bf2f40b (diff)
device: reconfigure IP addressing after bringing up device
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 changing the hardware address it has no chance to run (or notice that the device was shortly down). https://bugzilla.redhat.com/show_bug.cgi?id=1309899 (cherry picked from commit 63571b266634c6d8bbbb37f26e502c2df759fc65) (cherry picked from commit 951013d1e1182510366fb0de088179a3303ea65d)
-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 e6c88dd3b8..8888e08a35 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -7164,6 +7164,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;
}