summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-09-01 09:32:09 +0200
committerThomas Haller <thaller@redhat.com>2017-09-01 13:07:59 +0200
commitd2aaaa35f7c0a126b632ccacaf4d6362242563f7 (patch)
treeb6408694e75dcbc413a0dc4611a4fe3e3817978e
parente51ddb5b96b2a7074f595703f9717069fe7084e2 (diff)
downloadNetworkManager-th/match-gateway-route-rh1487384.tar.gz
-rw-r--r--src/NetworkManagerUtils.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/NetworkManagerUtils.c b/src/NetworkManagerUtils.c
index b2f7aa1ae2..b69864f112 100644
--- a/src/NetworkManagerUtils.c
+++ b/src/NetworkManagerUtils.c
@@ -777,6 +777,7 @@ nm_utils_match_connection (NMConnection *const*connections,
GHashTableIter s_iter, p_iter;
gpointer setting_name, setting;
gpointer property_name, value;
+ gboolean has_ip4_routes = FALSE;
diff_string = g_string_new (NULL);
g_hash_table_iter_init (&s_iter, diffs);
@@ -788,6 +789,8 @@ nm_utils_match_connection (NMConnection *const*connections,
g_string_append_printf (diff_string, "%s.%s",
(char *) setting_name,
(char *) property_name);
+ has_ip4_routes |= nm_streq (setting_name, NM_SETTING_IP4_CONFIG_SETTING_NAME)
+ && nm_streq (property_name, "routes");
}
}
@@ -795,6 +798,34 @@ nm_utils_match_connection (NMConnection *const*connections,
nm_connection_get_id (original),
nm_connection_get_id (candidate),
diff_string->str);
+
+ if (has_ip4_routes) {
+ NMSettingIPConfig *s_ip;
+ NMIPRoute *r;
+ guint i;
+
+ nm_log_dbg (LOGD_CORE, ">>>>>>> DIFF");
+
+ s_ip = nm_connection_get_setting_ip4_config (original);
+ if (s_ip) {
+ for (i = 0; i < nm_setting_ip_config_get_num_routes (s_ip); i++) {
+ r = nm_setting_ip_config_get_route (s_ip, i);
+ nm_log_dbg (LOGD_CORE, ">>>ORIG[%u]: %s/%u via %s", i,
+ nm_ip_route_get_dest (r), nm_ip_route_get_prefix (r), nm_ip_route_get_next_hop (r) ?: "(none)");
+ }
+ } else
+ nm_log_dbg (LOGD_CORE, ">>>ORIG: no setting");
+
+ s_ip = nm_connection_get_setting_ip4_config (candidate);
+ if (s_ip) {
+ for (i = 0; i < nm_setting_ip_config_get_num_routes (s_ip); i++) {
+ r = nm_setting_ip_config_get_route (s_ip, i);
+ nm_log_dbg (LOGD_CORE, ">>>CAND[%u]: %s/%u via %s", i,
+ nm_ip_route_get_dest (r), nm_ip_route_get_prefix (r), nm_ip_route_get_next_hop (r) ?: "(none)");
+ }
+ } else
+ nm_log_dbg (LOGD_CORE, ">>>CAND: no setting");
+ }
g_string_free (diff_string, TRUE);
}