mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-02 08:50:12 +01:00
device: ensure IP configuration is restored when link goes up
When the link is up and goes down link_changed_cb() schedules device_link_changed() to be run later. If the function is dispatched when the link is already up again, it does not detect that the link was down. Fix this by storing in the device state that we saw the link down so that device_link_changed() can properly restore the IP configuration. https://bugzilla.redhat.com/show_bug.cgi?id=1636715 https://github.com/NetworkManager/NetworkManager/pull/264 (cherry picked from commit7bd193ef30) (cherry picked from commit710406e746)
This commit is contained in:
parent
4a49df33c6
commit
c941b6fa10
1 changed files with 6 additions and 1 deletions
|
|
@ -382,6 +382,7 @@ typedef struct _NMDevicePrivate {
|
|||
|
||||
bool ipv6ll_handle:1; /* TRUE if NM handles the device's IPv6LL address */
|
||||
bool ipv6ll_has:1;
|
||||
bool device_link_changed_down:1;
|
||||
|
||||
/* Generic DHCP stuff */
|
||||
char * dhcp_anycast_address;
|
||||
|
|
@ -3385,8 +3386,10 @@ device_link_changed (NMDevice *self)
|
|||
gboolean was_up;
|
||||
gboolean update_unmanaged_specs = FALSE;
|
||||
gboolean got_hw_addr = FALSE, had_hw_addr;
|
||||
gboolean seen_down = priv->device_link_changed_down;
|
||||
|
||||
priv->device_link_changed_id = 0;
|
||||
priv->device_link_changed_down = FALSE;
|
||||
|
||||
ifindex = nm_device_get_ifindex (self);
|
||||
pllink = nm_platform_link_get (nm_device_get_platform (self), ifindex);
|
||||
|
|
@ -3480,7 +3483,7 @@ device_link_changed (NMDevice *self)
|
|||
|
||||
device_recheck_slave_status (self, pllink);
|
||||
|
||||
if (priv->up && !was_up) {
|
||||
if (priv->up && (!was_up || seen_down)) {
|
||||
/* 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) {
|
||||
|
|
@ -3556,6 +3559,8 @@ link_changed_cb (NMPlatform *platform,
|
|||
priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
|
||||
if (ifindex == nm_device_get_ifindex (self)) {
|
||||
if (!(info->n_ifi_flags & IFF_UP))
|
||||
priv->device_link_changed_down = TRUE;
|
||||
if (!priv->device_link_changed_id) {
|
||||
priv->device_link_changed_id = g_idle_add ((GSourceFunc) device_link_changed, self);
|
||||
_LOGD (LOGD_DEVICE, "queued link change for ifindex %d", ifindex);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue