mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-28 05:10:32 +01:00
aliyun: reuse ipv4 gateway address returned by metadata server
The default ipv4 gateway address of the VPC in Aliyun cloud is not the first IP address in the CIDR subnet block, we should instead use the ipv4 gateway address retrieved from the metadata server in `_nmc_mangle_connection()`. https://bugzilla.redhat.com/show_bug.cgi?id=1823315 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/958 Signed-off-by: Wen Liang <liangwen12year@gmail.com> (cherry picked from commit778e1f8493) (cherry picked from commit59633dbe11)
This commit is contained in:
parent
661da869b3
commit
a9e6aa663e
2 changed files with 9 additions and 5 deletions
|
|
@ -347,11 +347,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;
|
||||
|
||||
|
|
|
|||
|
|
@ -23,9 +23,11 @@ typedef struct {
|
|||
gssize iface_idx;
|
||||
|
||||
in_addr_t cidr_addr;
|
||||
in_addr_t gateway;
|
||||
guint8 cidr_prefix;
|
||||
bool has_ipv4s : 1;
|
||||
bool has_cidr : 1;
|
||||
bool has_gateway : 1;
|
||||
|
||||
NMIPRoute **iproutes_arr;
|
||||
gsize iproutes_len;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue