diff options
| author | Michael Biebl <biebl@debian.org> | 2016-08-03 22:59:23 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2016-08-03 22:59:23 +0200 |
| commit | d6201f5d8daada3d64a0a3e0038e14eebec683ce (patch) | |
| tree | 035500728cc23e7ee5368c3fd605270265a077f7 /clients/cli/common.c | |
| parent | 73e152af6e3fb4f5848bfb8394484026ff119003 (diff) | |
Imported Upstream version 1.2.4 upstream/1.2.4
Diffstat (limited to 'clients/cli/common.c')
| -rw-r--r-- | clients/cli/common.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/clients/cli/common.c b/clients/cli/common.c index 0888f063..05b76564 100644 --- a/clients/cli/common.c +++ b/clients/cli/common.c @@ -415,10 +415,12 @@ nmc_parse_and_build_route (int family, char *dest = NULL, *plen = NULL; const char *next_hop = NULL; const char *canon_dest; - long int prefix = max_prefix, metric = -1; + long int prefix = max_prefix; + unsigned long int tmp_ulong; NMIPRoute *route = NULL; gboolean success = FALSE; GError *local = NULL; + gint64 metric = -1; g_return_val_if_fail (family == AF_INET || family == AF_INET6, FALSE); g_return_val_if_fail (first != NULL, FALSE); @@ -444,19 +446,21 @@ nmc_parse_and_build_route (int family, next_hop = second; else { /* 'second' can be a metric */ - if (!nmc_string_to_int (second, TRUE, 0, G_MAXUINT32, &metric)) { + if (!nmc_string_to_uint (second, TRUE, 0, G_MAXUINT32, &tmp_ulong)) { g_set_error (error, 1, 0, _("the second component of route ('%s') is neither " "a next hop address nor a metric"), second); goto finish; } + metric = tmp_ulong; } } if (third) { - if (!nmc_string_to_int (third, TRUE, 0, G_MAXUINT32, &metric)) { + if (!nmc_string_to_uint (third, TRUE, 0, G_MAXUINT32, &tmp_ulong)) { g_set_error (error, 1, 0, _("invalid metric '%s'"), third); goto finish; } + metric = tmp_ulong; } route = nm_ip_route_new (family, dest, prefix, next_hop, metric, &local); |