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 63571b2666)
This commit is contained in:
Thomas Haller 2016-05-29 17:54:36 +02:00
parent 68122212e0
commit 951013d1e1

View file

@ -8610,6 +8610,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;
}