mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-07 14:18:12 +02:00
device: restore IP configuration when link comes up
This is especially important, because changing MTU takes the link down for a moment. Taking a link down deletes IP routes and IPv6 addresses. Thus, when the link comes up again, we must restore them. Otherwise, we don't call merge_and_apply() until the next DHCP lease (or possibly never in case of static addressing). https://bugzilla.redhat.com/show_bug.cgi?id=1309899 (cherry picked from commit35a7ea77b0) (cherry picked from commit5367eac814)
This commit is contained in:
parent
c3946c3d29
commit
6fa2405997
1 changed files with 16 additions and 0 deletions
|
|
@ -370,6 +370,9 @@ static gboolean nm_device_set_ip6_config (NMDevice *self,
|
||||||
gboolean commit,
|
gboolean commit,
|
||||||
gboolean routes_full_sync,
|
gboolean routes_full_sync,
|
||||||
NMDeviceStateReason *reason);
|
NMDeviceStateReason *reason);
|
||||||
|
static gboolean ip6_config_merge_and_apply (NMDevice *self,
|
||||||
|
gboolean commit,
|
||||||
|
NMDeviceStateReason *out_reason);
|
||||||
|
|
||||||
static gboolean nm_device_master_add_slave (NMDevice *self, NMDevice *slave, gboolean configure);
|
static gboolean nm_device_master_add_slave (NMDevice *self, NMDevice *slave, gboolean configure);
|
||||||
static void nm_device_slave_notify_enslave (NMDevice *self, gboolean success);
|
static void nm_device_slave_notify_enslave (NMDevice *self, gboolean success);
|
||||||
|
|
@ -1516,6 +1519,19 @@ device_link_changed (NMDevice *self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (priv->up && !was_up) {
|
||||||
|
/* the link was down and just came up. That happens for example, while changing MTU.
|
||||||
|
* We must restore IP configuration. */
|
||||||
|
if (priv->ip4_state == IP_DONE) {
|
||||||
|
if (!ip4_config_merge_and_apply (self, NULL, TRUE, NULL))
|
||||||
|
_LOGW (LOGD_IP4, "failed applying IP4 config after link comes up again");
|
||||||
|
}
|
||||||
|
if (priv->ip6_state == IP_DONE) {
|
||||||
|
if (!ip6_config_merge_and_apply (self, TRUE, NULL))
|
||||||
|
_LOGW (LOGD_IP6, "failed applying IP6 config after link comes up again");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return G_SOURCE_REMOVE;
|
return G_SOURCE_REMOVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue