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:11:55 +0200
commit63571b266634c6d8bbbb37f26e502c2df759fc65 (patch)
tree8cea3e59070e9cb892f8867b04efed0d18a10c48
parent2edaf35f1296b4b8f140365b4b40d5d89e57128a (diff)
downloadNetworkManager-63571b266634c6d8bbbb37f26e502c2df759fc65.tar.gz
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
-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 5234d24cdd..70a4202c36 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -8909,6 +8909,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;
}