about summary refs log tree commit diff
path: root/src/nm-cloud-setup/main.c
diff options
context:
space:
mode:
authorSebastien Bacher <seb128@ubuntu.com>2021-08-25 15:23:22 +0200
committerSebastien Bacher <seb128@ubuntu.com>2021-08-25 15:23:22 +0200
commitcfb80376641fa49137b9996130352697e7f8b436 (patch)
tree4ac3eb90a08f27a8bff2372052f8ae78f7e7c3aa /src/nm-cloud-setup/main.c
parent35779c6675728fa6f0fd0a21cefb904408509c23 (diff)
New upstream version 1.32.10
Diffstat (limited to 'src/nm-cloud-setup/main.c')
-rw-r--r--src/nm-cloud-setup/main.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/nm-cloud-setup/main.c b/src/nm-cloud-setup/main.c
index 0667532b..8dc67851 100644
--- a/src/nm-cloud-setup/main.c
+++ b/src/nm-cloud-setup/main.c
@@ -8,6 +8,7 @@
 #include "nmcs-provider-ec2.h"
 #include "nmcs-provider-gcp.h"
 #include "nmcs-provider-azure.h"
+#include "nmcs-provider-aliyun.h"
 #include "libnm-core-aux-intern/nm-libnm-core-utils.h"
 
 /*****************************************************************************/
@@ -85,6 +86,7 @@ _provider_detect(GCancellable *sigterm_cancellable)
         NMCS_TYPE_PROVIDER_EC2,
         NMCS_TYPE_PROVIDER_GCP,
         NMCS_TYPE_PROVIDER_AZURE,
+        NMCS_TYPE_PROVIDER_ALIYUN,
     };
     int    i;
     gulong cancellable_signal_id;
@@ -338,11 +340,13 @@ _nmc_mangle_connection(NMDevice *                            device,
             if (entry)
                 g_ptr_array_add(addrs_new, entry);
         }
-
-        gateway = nm_utils_ip4_address_clear_host_address(config_data->cidr_addr,
-                                                          config_data->cidr_prefix);
-        ((guint8 *) &gateway)[3] += 1;
-
+        if (config_data->has_gateway && config_data->gateway) {
+            gateway = config_data->gateway;
+        } else {
+            gateway = nm_utils_ip4_address_clear_host_address(config_data->cidr_addr,
+                                                              config_data->cidr_prefix);
+            ((guint8 *) &gateway)[3] += 1;
+        }
         rt_metric = 10;
         rt_table  = 30400 + config_data->iface_idx;