diff options
Diffstat (limited to 'clients/cli/utils.c')
| -rw-r--r-- | clients/cli/utils.c | 116 |
1 files changed, 0 insertions, 116 deletions
diff --git a/clients/cli/utils.c b/clients/cli/utils.c index d05ea285..a406eee4 100644 --- a/clients/cli/utils.c +++ b/clients/cli/utils.c @@ -182,60 +182,6 @@ ssid_to_hex (const char *str, gsize len) } /* - * Converts IPv4 address from guint32 in network-byte order to text representation. - * Returns: text form of the IP or NULL (then error is set) - */ -char * -nmc_ip4_address_as_string (guint32 ip, GError **error) -{ - guint32 tmp_addr; - char buf[INET_ADDRSTRLEN]; - - g_return_val_if_fail (error == NULL || *error == NULL, NULL); - - memset (&buf, '\0', sizeof (buf)); - tmp_addr = ip; - - if (inet_ntop (AF_INET, &tmp_addr, buf, INET_ADDRSTRLEN)) { - return g_strdup (buf); - } else { - g_set_error (error, NMCLI_ERROR, 0, _("Error converting IP4 address '0x%X' to text form"), - ntohl (tmp_addr)); - return NULL; - } -} - -/* - * Converts IPv6 address in in6_addr structure to text representation. - * Returns: text form of the IP or NULL (then error is set) - */ -char * -nmc_ip6_address_as_string (const struct in6_addr *ip, GError **error) -{ - char buf[INET6_ADDRSTRLEN]; - - g_return_val_if_fail (error == NULL || *error == NULL, NULL); - - memset (&buf, '\0', sizeof (buf)); - - if (inet_ntop (AF_INET6, ip, buf, INET6_ADDRSTRLEN)) { - return g_strdup (buf); - } else { - if (error) { - int j; - GString *ip6_str = g_string_new (NULL); - g_string_append_printf (ip6_str, "%02X", ip->s6_addr[0]); - for (j = 1; j < 16; j++) - g_string_append_printf (ip6_str, " %02X", ip->s6_addr[j]); - g_set_error (error, NMCLI_ERROR, 0, _("Error converting IP6 address '%s' to text form"), - ip6_str->str); - g_string_free (ip6_str, TRUE); - } - return NULL; - } -} - -/* * Erase terminal line using ANSI escape sequences. * It prints <ESC>[2K sequence to erase the line and then \r to return back * to the beginning of the line. @@ -707,23 +653,6 @@ finish: } /* - * Convert string array (char **) to GSList. - * - * Returns: pointer to newly created GSList. Caller should free it. - */ -GSList * -nmc_util_strv_to_slist (char **strv) -{ - GSList *list = NULL; - guint i = 0; - - while (strv && strv[i]) - list = g_slist_prepend (list, g_strdup (strv[i++])); - - return g_slist_reverse (list); -} - -/* * Convert string array (char **) to description string in the form of: * "[string1, string2, ]" * @@ -1359,48 +1288,3 @@ print_data (NmCli *nmc) } } -/* -* Compare versions of nmcli and NM daemon. -* Return: TRUE - the versions match (when only major and minor match, print a warning) -* FALSE - versions mismatch -*/ -gboolean -nmc_versions_match (NmCli *nmc) -{ - const char *nm_ver = NULL; - const char *dot; - gboolean match = FALSE; - - g_return_val_if_fail (nmc != NULL, FALSE); - - /* --nocheck option - don't compare the versions */ - if (nmc->nocheck_ver) - return TRUE; - - nmc->get_client (nmc); - nm_ver = nm_client_get_version (nmc->client); - if (nm_ver) { - if (!strcmp (nm_ver, VERSION)) - match = TRUE; - else { - dot = strchr (nm_ver, '.'); - if (dot) { - dot = strchr (dot + 1, '.'); - if (dot && !strncmp (nm_ver, VERSION, dot-nm_ver)) { - g_printerr (_("Warning: nmcli (%s) and NetworkManager (%s) versions don't match. Use --nocheck to suppress the warning.\n"), - VERSION, nm_ver); - match = TRUE; - } - } - } - } - - if (!match) { - g_string_printf (nmc->return_text, _("Error: nmcli (%s) and NetworkManager (%s) versions don't match. Force execution using --nocheck, but the results are unpredictable."), - VERSION, nm_ver ? nm_ver : _("unknown")); - nmc->return_value = NMC_RESULT_ERROR_VERSIONS_MISMATCH; - } - - return match; -} - |