diff options
author | Robert Ancell <robert.ancell@canonical.com> | 2020-07-17 11:34:08 +1200 |
---|---|---|
committer | Robert Ancell <robert.ancell@gmail.com> | 2020-08-07 03:40:01 +0000 |
commit | f1d892f46bef36d2ee26e510b3ae06e9da5a62ee (patch) | |
tree | f4f5eec73b563aba2a2ff56fba3c477f143d1790 | |
parent | 3b9954ab37f1a0c83b9cf9909ca9987838f46a99 (diff) | |
download | gnome-control-center-f1d892f46bef36d2ee26e510b3ae06e9da5a62ee.tar.gz |
network: Fix logic in showing IP6 route metric.
The logic was inverted and ensured the value was always <= 0.
-rw-r--r-- | panels/network/connection-editor/ce-page-ip6.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/panels/network/connection-editor/ce-page-ip6.c b/panels/network/connection-editor/ce-page-ip6.c index 6fe27b55c..6b714292b 100644 --- a/panels/network/connection-editor/ce-page-ip6.c +++ b/panels/network/connection-editor/ce-page-ip6.c @@ -432,7 +432,7 @@ add_routes_box (CEPageIP6 *self) route = nm_setting_ip_config_get_route (self->setting, i); prefix = g_strdup_printf ("%u", nm_ip_route_get_prefix (route)); - metric = g_strdup_printf ("%u", (guint32) MIN (0, nm_ip_route_get_metric (route))); + metric = g_strdup_printf ("%" G_GINT64_FORMAT, nm_ip_route_get_metric (route)); add_route_row (self, nm_ip_route_get_dest (route), prefix, nm_ip_route_get_next_hop (route), @@ -662,7 +662,8 @@ ui_to_setting (CEPageIP6 *self) const gchar *text_prefix; const gchar *text_gateway; const gchar *text_metric; - guint32 prefix, metric; + guint32 prefix; + gint64 metric; gchar *end; NMIPRoute *route; @@ -706,10 +707,10 @@ ui_to_setting (CEPageIP6 *self) widget_unset_error (g_object_get_data (G_OBJECT (row), "gateway")); } - metric = 0; + metric = -1; if (*text_metric) { errno = 0; - metric = strtoul (text_metric, NULL, 10); + metric = g_ascii_strtoull (text_metric, NULL, 10); if (errno) { widget_set_error (g_object_get_data (G_OBJECT (row), "metric")); ret = FALSE; |