From bb782ab4b2058e0ae14aae1a4c71bd0dc908fbdc Mon Sep 17 00:00:00 2001
From: Beniamino Galvani <bgalvani@redhat.com>
Date: Tue, 7 May 2019 16:26:09 +0200
Subject: [PATCH 1/3] all: fix typos (milli seconds -> milliseconds)
(cherry picked from commit 4735d6764a5dc9c3bc6bc09d3220751e789b39c4)
(cherry picked from commit f6b9366eb4435d7ee45f862dabdefb5f87c4739d)
---
shared/nm-glib-aux/nm-time-utils.c | 2 +-
src/devices/nm-device.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/shared/nm-glib-aux/nm-time-utils.c b/shared/nm-glib-aux/nm-time-utils.c
index ae526c342..98a414595 100644
--- a/shared/nm-glib-aux/nm-time-utils.c
+++ b/shared/nm-glib-aux/nm-time-utils.c
@@ -231,7 +231,7 @@ nm_utils_get_monotonic_timestamp_s (void)
* @timestamp: the monotonic-timestamp that should be converted into CLOCK_BOOTTIME.
* @timestamp_ns_per_tick: How many nano seconds make one unit of @timestamp? E.g. if
* @timestamp is in unit seconds, pass %NM_UTILS_NS_PER_SECOND; @timestamp in nano
- * seconds, pass 1; @timestamp in milli seconds, pass %NM_UTILS_NS_PER_SECOND/1000; etc.
+ * seconds, pass 1; @timestamp in milliseconds, pass %NM_UTILS_NS_PER_SECOND/1000; etc.
*
* Returns: the monotonic-timestamp as CLOCK_BOOTTIME, as returned by clock_gettime().
* The unit is the same as the passed in @timestamp basd on @timestamp_ns_per_tick.
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 8ae64b968..7bf1eb4ce 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -3588,7 +3588,7 @@ nm_device_set_carrier (NMDevice *self, gboolean carrier)
now_ms = nm_utils_get_monotonic_timestamp_ms ();
until_ms = NM_MAX (now_ms + _get_carrier_wait_ms (self), priv->carrier_wait_until_ms);
priv->carrier_defer_id = g_timeout_add (until_ms - now_ms, carrier_disconnected_action_cb, self);
- _LOGD (LOGD_DEVICE, "carrier: link disconnected (deferring action for %ld milli seconds) (id=%u)",
+ _LOGD (LOGD_DEVICE, "carrier: link disconnected (deferring action for %ld milliseconds) (id=%u)",
(long) (until_ms - now_ms), priv->carrier_defer_id);
}
}
--
2.20.1
From ef2113cf7c06d5157ddd2cdc26c1f781b60c477c Mon Sep 17 00:00:00 2001
From: Beniamino Galvani <bgalvani@redhat.com>
Date: Tue, 7 May 2019 16:25:04 +0200
Subject: [PATCH 2/3] device: unconditionally reapply IP configuration on link
up
Consider the situation in which ipv4.method=auto and there is an
address configured. Also, the DHCP timeout is long and there is no
DHCP server. If the link is brought down temporarily, the prefix route
for the static address is lost and not restored by NM because we
reapply the IP configuration only when the IP state is DONE.
The same can happen also for IPv6, but in that case also static IPv6
addresses are lost.
We should always reapply the IP configuration when the link goes up.
(cherry picked from commit d0b16b9283dc16e9db642280be9d6b10a04092a8)
(cherry picked from commit 4482ca64ba5bbf1c173ea5b4a3854da0173542a8)
---
src/devices/nm-device.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 7bf1eb4ce..510d9792e 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -3890,16 +3890,12 @@ device_link_changed (NMDevice *self)
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->ip_state_4 == NM_DEVICE_IP_STATE_DONE) {
- if (!ip_config_merge_and_apply (self, AF_INET, TRUE))
- _LOGW (LOGD_IP4, "failed applying IP4 config after link comes up again");
- }
+ if (!ip_config_merge_and_apply (self, AF_INET, TRUE))
+ _LOGW (LOGD_IP4, "failed applying IP4 config after link comes up again");
priv->linklocal6_dad_counter = 0;
- if (priv->ip_state_6 == NM_DEVICE_IP_STATE_DONE) {
- if (!ip_config_merge_and_apply (self, AF_INET6, TRUE))
- _LOGW (LOGD_IP6, "failed applying IP6 config after link comes up again");
- }
+ if (!ip_config_merge_and_apply (self, AF_INET6, TRUE))
+ _LOGW (LOGD_IP6, "failed applying IP6 config after link comes up again");
}
if (update_unmanaged_specs)
--
2.20.1
From b3f9c33557951ed90767ff50e9e72e533a211b45 Mon Sep 17 00:00:00 2001
From: Beniamino Galvani <bgalvani@redhat.com>
Date: Tue, 7 May 2019 16:32:12 +0200
Subject: [PATCH 3/3] device: fix intersecting IPv6 configurations
If the link is down we shouldn't drop the link-local address from
configuration as it wasn't removed by user but by kernel.
(cherry picked from commit 18d2edfaa13d97597ddf5551e6dd5ea854f1fdbf)
(cherry picked from commit 6f6914450072b79a91731e042e498ca26892696c)
---
src/devices/nm-device.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 510d9792e..06a95110b 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -12882,7 +12882,8 @@ update_ext_ip_config (NMDevice *self, int addr_family, gboolean intersect_config
for (iter = priv->vpn_configs_6; iter; iter = iter->next)
nm_ip6_config_intersect (iter->data, priv->ext_ip_config_6, is_up, is_up, 0);
- if ( priv->ipv6ll_has
+ if ( is_up
+ && priv->ipv6ll_has
&& !nm_ip6_config_lookup_address (priv->ext_ip_config_6, &priv->ipv6ll_addr))
priv->ipv6ll_has = FALSE;
}
--
2.20.1