summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2021-01-05 16:32:04 +0100
committerThomas Haller <thaller@redhat.com>2021-01-08 16:32:49 +0100
commit288b38e7190a03a52279429c9ba5331e1b70d2aa (patch)
treeb8142bd802c4521fcc793d51f71d8e1bdd48b632
parent30e1f733473f8990040cc8a4a7531c7d46b87aea (diff)
downloadNetworkManager-288b38e7190a03a52279429c9ba5331e1b70d2aa.tar.gz
cloud-setup: use nmcs_utils_ipaddr_normalize_gbytes() in GCP provider
-rw-r--r--clients/cloud-setup/nmcs-provider-gcp.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/clients/cloud-setup/nmcs-provider-gcp.c b/clients/cloud-setup/nmcs-provider-gcp.c
index aa01356113..41b56ff4fd 100644
--- a/clients/cloud-setup/nmcs-provider-gcp.c
+++ b/clients/cloud-setup/nmcs-provider-gcp.c
@@ -109,7 +109,7 @@ _get_config_fip_cb(GObject *source, GAsyncResult *result, gpointer user_data)
gs_unref_bytes GBytes *response = NULL;
GCPIfaceData * iface_data = user_data;
gs_free_error GError *error = NULL;
- const char * fip_str = NULL;
+ gs_free char * ipaddr = NULL;
NMIPRoute ** routes_arr;
NMIPRoute * route_new;
@@ -123,8 +123,8 @@ _get_config_fip_cb(GObject *source, GAsyncResult *result, gpointer user_data)
if (error)
goto out_done;
- fip_str = g_bytes_get_data(response, NULL);
- if (!nm_utils_ipaddr_valid(AF_INET, fip_str)) {
+ ipaddr = nmcs_utils_ipaddr_normalize_gbytes(AF_INET, response);
+ if (!ipaddr) {
error =
nm_utils_error_new(NM_UTILS_ERROR_UNKNOWN, "forwarded-ip is not a valid ip address");
goto out_done;
@@ -132,12 +132,12 @@ _get_config_fip_cb(GObject *source, GAsyncResult *result, gpointer user_data)
_LOGI("GCP interface[%" G_GSSIZE_FORMAT "]: adding forwarded-ip %s",
iface_data->iface_idx,
- fip_str);
+ ipaddr);
iface_get_config = iface_data->iface_get_config;
routes_arr = iface_get_config->iproutes_arr;
- route_new = nm_ip_route_new(AF_INET, fip_str, 32, NULL, 100, &error);
+ route_new = nm_ip_route_new(AF_INET, ipaddr, 32, NULL, 100, &error);
if (error)
goto out_done;