summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-03-19 20:01:39 +0100
committerThomas Haller <thaller@redhat.com>2018-03-22 17:10:23 +0100
commita8812d010931d0c55722ec3f3c208734f190ada9 (patch)
tree15c4d64d6ddad79192a7f8156e8f7e7ca32f54a6
parent3f1cf87eb1473fc715d81f76accec8c1f334376a (diff)
downloadNetworkManager-th/ipv6-ll-reapply-rh1552069-pt2-v1.tar.gz
device: retry adding routes with a gateway that fail to be addedth/ipv6-ll-reapply-rh1552069-pt2-v1
When the user configures a gateway route without a direct route to the gateway, he might expect that we receive the missing route via DHCP. We still need to wait and retry later to add this route, possibly when we received the requirements from DHCP. This is a horrible hack. Commit 7070d17cedd09d07f12ce977dd1e16cecf8d4b45 already tries to solve this differently. But now that we also call ip_config_merge_and_apply() to handle link local addresses, we reconfigure addresses possibly several times before we receive the DHCP configuration. Sidenote, at some places we take the result of ip_config_merge_and_apply() to determine whether to fail the IP configuration. But we do this very inconsistently and probably wrong. The only reason why this currently doesn't blow up, is because the only case where ip_config_merge_and_apply() can fail, is when we fail to add a manually configured route (NM_IP_CONFIG_SOURCE_USER).
-rw-r--r--src/devices/nm-device.c8
-rw-r--r--src/platform/nm-platform.c26
-rw-r--r--src/platform/nm-platform.h4
3 files changed, 21 insertions, 17 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index e0647d699c..735554a052 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -7996,10 +7996,8 @@ addrconf6_start_with_link_ready (NMDevice *self)
}
/* Apply any manual configuration before starting RA */
- if (!ip_config_merge_and_apply (self, AF_INET6, TRUE)) {
+ if (!ip_config_merge_and_apply (self, AF_INET6, TRUE))
_LOGW (LOGD_IP6, "failed to apply manual IPv6 configuration");
- g_clear_object (&priv->con_ip_config_6);
- }
/* FIXME: These sysctls would probably be better set by the lndp ndisc itself. */
switch (nm_ndisc_get_node_type (priv->ndisc)) {
@@ -10140,6 +10138,8 @@ _route_temporary_not_available_set (NMDevice *self,
if (fail_data->reason == NM_PLATFORM_SYNC_FAIL_REASON_IP6_ROUTE_TENTATIVE_PREF_SRC)
max_age_ms = 20000;
+ else if (fail_data->reason == NM_PLATFORM_SYNC_FAIL_REASON_GATEWAY_NOT_ONLINK)
+ max_age_ms = 60000;
else
continue;
@@ -10179,7 +10179,7 @@ _route_temporary_not_available_set (NMDevice *self,
else
next_timeout_ms = NM_MIN (next_timeout_ms, data->expires_at_ms);
}
- if (g_hash_table_size (route_hash)) {
+ if (g_hash_table_size (route_hash) == 0) {
g_clear_pointer (&priv->route_temporary_not_available_x[IS_IPv4], g_hash_table_unref);
route_hash = NULL;
}
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index fe6b68b1de..ff8930a1d9 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -4020,22 +4020,22 @@ nm_platform_ip_route_sync (NMPlatform *self,
nmp_object_to_string (conf_o, NMP_OBJECT_TO_STRING_PUBLIC, sbuf1, sizeof (sbuf1)),
nm_platform_error_to_string (plerr, sbuf_err, sizeof (sbuf_err)));
_sync_fail_list_append (out_sync_fail_list, conf_o, NM_PLATFORM_SYNC_FAIL_REASON_IP6_ROUTE_TENTATIVE_PREF_SRC);
+ } else if ( ( -((int) plerr) == ENETUNREACH
+ && vt->is_ip4
+ && !!NMP_OBJECT_CAST_IP4_ROUTE (conf_o)->gateway)
+ || ( -((int) plerr) == EHOSTUNREACH
+ && !vt->is_ip4
+ && !IN6_IS_ADDR_UNSPECIFIED (&NMP_OBJECT_CAST_IP6_ROUTE (conf_o)->gateway))) {
+ _LOGD ("route-sync: ignore failure to add IPv%c route with gateway: %s: %s",
+ vt->is_ip4 ? '4' : '6',
+ nmp_object_to_string (conf_o, NMP_OBJECT_TO_STRING_PUBLIC, sbuf1, sizeof (sbuf1)),
+ nm_platform_error_to_string (plerr, sbuf_err, sizeof (sbuf_err)));
+ _sync_fail_list_append (out_sync_fail_list, conf_o, NM_PLATFORM_SYNC_FAIL_REASON_GATEWAY_NOT_ONLINK);
} else {
- const char *reason = "";
-
- if ( ( -((int) plerr) == ENETUNREACH
- && vt->is_ip4
- && !!NMP_OBJECT_CAST_IP4_ROUTE (conf_o)->gateway)
- || ( -((int) plerr) == EHOSTUNREACH
- && !vt->is_ip4
- && !IN6_IS_ADDR_UNSPECIFIED (&NMP_OBJECT_CAST_IP6_ROUTE (conf_o)->gateway)))
- reason = "; is the gateway directly reachable?";
-
- _LOGW ("route-sync: failure to add IPv%c route: %s: %s%s",
+ _LOGW ("route-sync: failure to add IPv%c route: %s: %s",
vt->is_ip4 ? '4' : '6',
nmp_object_to_string (conf_o, NMP_OBJECT_TO_STRING_PUBLIC, sbuf1, sizeof (sbuf1)),
- nm_platform_error_to_string (plerr, sbuf_err, sizeof (sbuf_err)),
- reason);
+ nm_platform_error_to_string (plerr, sbuf_err, sizeof (sbuf_err)));
success = FALSE;
}
}
diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h
index 596eb23930..5b2d6859b8 100644
--- a/src/platform/nm-platform.h
+++ b/src/platform/nm-platform.h
@@ -753,6 +753,10 @@ typedef enum {
* a pref-src that is still tentative. Kernel doesn't allow that (rh #1457196). */
NM_PLATFORM_SYNC_FAIL_REASON_IP6_ROUTE_TENTATIVE_PREF_SRC,
+ /* the IPv4 or IPv6 route couldn't be added, probably because it specifies a
+ * gateway, for which we have no onlink route. */
+ NM_PLATFORM_SYNC_FAIL_REASON_GATEWAY_NOT_ONLINK,
+
} NMPlatformSyncFailReason;
typedef struct {