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:24:42 +0200
committerSebastien Bacher <seb128@ubuntu.com>2021-08-25 15:24:42 +0200
commitdbb91282fa488964fb20595f9494a9f0e4f36a58 (patch)
tree142bc942e5320b35514cdf03a5f9f47a9b89df0e /src/nm-cloud-setup/main.c
parent5f2ede3a2813b0e9204befdcfc67509d34be71c6 (diff)
parentcfb80376641fa49137b9996130352697e7f8b436 (diff)
Update upstream source from tag 'upstream/1.32.10'
Update to upstream version '1.32.10'
with Debian dir fcf2778b50b013ede3e7375bc1d829e984175658
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;