Import from CS git
This commit is contained in:
parent
97a2d076ca
commit
44e2ae45bb
@ -0,0 +1,144 @@
|
||||
From ad2a6b7d315a89b30206d98a515a3ee3709745c3 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||||
Date: Tue, 27 Aug 2024 12:08:16 +0200
|
||||
Subject: [PATCH] cloud-setup: azure: ensure that primary address is placed
|
||||
first
|
||||
|
||||
The primary address is that placed at position 0 of all the IP Addresses
|
||||
of the interface. Sometimes we put it in a different position in the
|
||||
ipv4s array because we insert them in the order we receive, but it might
|
||||
happen that the HTTP responses comes back in wrong order.
|
||||
|
||||
In order to solve this, we pass the index of the IPv4 address to the
|
||||
callback and the address is added in the right position directly.
|
||||
|
||||
Co-authored-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
|
||||
(cherry picked from commit 72014db629cff33611ade58190d45a714efa1bbf)
|
||||
(cherry picked from commit c976e212372da9683a1e2f8618e3bcfdf21d5e25)
|
||||
(cherry picked from commit 55812963fde9519bb2752c46575a740fa0fea688)
|
||||
(cherry picked from commit 78f48a064b6d2f0faa89ea1a776daa318e14ce73)
|
||||
(cherry picked from commit b5ead8f14003cd8d71d4249657a954821c7f6be7)
|
||||
(cherry picked from commit 43e937607385d040b701ef7da5452ef19ac40c54)
|
||||
---
|
||||
src/nm-cloud-setup/nmcs-provider-azure.c | 43 ++++++++++++++++--------
|
||||
1 file changed, 29 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/src/nm-cloud-setup/nmcs-provider-azure.c b/src/nm-cloud-setup/nmcs-provider-azure.c
|
||||
index e74d042026..3019400291 100644
|
||||
--- a/src/nm-cloud-setup/nmcs-provider-azure.c
|
||||
+++ b/src/nm-cloud-setup/nmcs-provider-azure.c
|
||||
@@ -100,6 +100,11 @@ typedef struct {
|
||||
guint n_iface_data_pending;
|
||||
} AzureIfaceData;
|
||||
|
||||
+typedef struct {
|
||||
+ AzureIfaceData *iface_data;
|
||||
+ guint64 ipaddress_idx;
|
||||
+} AzureIpAddressReqData;
|
||||
+
|
||||
static void
|
||||
_azure_iface_data_destroy(AzureIfaceData *iface_data)
|
||||
{
|
||||
@@ -110,7 +115,8 @@ static void
|
||||
_get_config_fetch_done_cb(NMHttpClient *http_client,
|
||||
GAsyncResult *result,
|
||||
AzureIfaceData *iface_data,
|
||||
- GetConfigFetchType fetch_type)
|
||||
+ GetConfigFetchType fetch_type,
|
||||
+ guint64 ipaddress_idx)
|
||||
{
|
||||
NMCSProviderGetConfigTaskData *get_config_data;
|
||||
NMCSProviderGetConfigIfaceData *iface_get_config;
|
||||
@@ -147,9 +153,7 @@ _get_config_fetch_done_cb(NMHttpClient *http_client,
|
||||
_LOGD("interface[%" G_GSSIZE_FORMAT "]: received address %s",
|
||||
iface_data->intern_iface_idx,
|
||||
_nm_utils_inet4_ntop(tmp_addr, tmp_addr_str));
|
||||
- iface_get_config->ipv4s_arr[iface_get_config->ipv4s_len] = tmp_addr;
|
||||
- iface_get_config->has_ipv4s = TRUE;
|
||||
- iface_get_config->ipv4s_len++;
|
||||
+ iface_get_config->ipv4s_arr[ipaddress_idx] = tmp_addr;
|
||||
break;
|
||||
|
||||
case GET_CONFIG_FETCH_TYPE_IPV4_SUBNET_0_ADDRESS:
|
||||
@@ -201,10 +205,14 @@ _get_config_fetch_done_cb_ipv4_ipaddress_x_privateipaddress(GObject *source
|
||||
GAsyncResult *result,
|
||||
gpointer user_data)
|
||||
{
|
||||
+ AzureIpAddressReqData *ipaddress_req_data = user_data;
|
||||
+
|
||||
_get_config_fetch_done_cb(NM_HTTP_CLIENT(source),
|
||||
result,
|
||||
- user_data,
|
||||
- GET_CONFIG_FETCH_TYPE_IPV4_IPADDRESS_X_PRIVATEIPADDRESS);
|
||||
+ ipaddress_req_data->iface_data,
|
||||
+ GET_CONFIG_FETCH_TYPE_IPV4_IPADDRESS_X_PRIVATEIPADDRESS,
|
||||
+ ipaddress_req_data->ipaddress_idx);
|
||||
+ g_free(ipaddress_req_data);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -215,7 +223,8 @@ _get_config_fetch_done_cb_ipv4_subnet_0_address(GObject *source,
|
||||
_get_config_fetch_done_cb(NM_HTTP_CLIENT(source),
|
||||
result,
|
||||
user_data,
|
||||
- GET_CONFIG_FETCH_TYPE_IPV4_SUBNET_0_ADDRESS);
|
||||
+ GET_CONFIG_FETCH_TYPE_IPV4_SUBNET_0_ADDRESS,
|
||||
+ 0);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -226,7 +235,8 @@ _get_config_fetch_done_cb_ipv4_subnet_0_prefix(GObject *source,
|
||||
_get_config_fetch_done_cb(NM_HTTP_CLIENT(source),
|
||||
result,
|
||||
user_data,
|
||||
- GET_CONFIG_FETCH_TYPE_IPV4_SUBNET_0_PREFIX);
|
||||
+ GET_CONFIG_FETCH_TYPE_IPV4_SUBNET_0_PREFIX,
|
||||
+ 0);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -263,9 +273,10 @@ _get_config_ips_prefix_list_cb(GObject *source, GAsyncResult *result, gpointer u
|
||||
nm_sprintf_buf(iface_idx_str, "%" G_GSSIZE_FORMAT, iface_data->intern_iface_idx);
|
||||
|
||||
while (nm_utils_parse_next_line(&response_str, &response_len, &line, &line_len)) {
|
||||
- gint64 ips_prefix_idx;
|
||||
- gs_free char *uri = NULL;
|
||||
- char buf[100];
|
||||
+ AzureIpAddressReqData *ipaddress_req_data;
|
||||
+ gint64 ips_prefix_idx;
|
||||
+ gs_free char *uri = NULL;
|
||||
+ char buf[100];
|
||||
|
||||
if (line_len == 0)
|
||||
continue;
|
||||
@@ -282,8 +293,11 @@ _get_config_ips_prefix_list_cb(GObject *source, GAsyncResult *result, gpointer u
|
||||
if (ips_prefix_idx < 0)
|
||||
continue;
|
||||
|
||||
- iface_data->n_iface_data_pending++;
|
||||
+ ipaddress_req_data = g_new(AzureIpAddressReqData, 1);
|
||||
+ ipaddress_req_data->iface_data = iface_data;
|
||||
+ ipaddress_req_data->ipaddress_idx = ips_prefix_idx;
|
||||
|
||||
+ iface_data->n_iface_data_pending++;
|
||||
nm_http_client_poll_req(
|
||||
NM_HTTP_CLIENT(source),
|
||||
(uri = _azure_uri_interfaces(iface_idx_str,
|
||||
@@ -300,11 +314,12 @@ _get_config_ips_prefix_list_cb(GObject *source, GAsyncResult *result, gpointer u
|
||||
NULL,
|
||||
NULL,
|
||||
_get_config_fetch_done_cb_ipv4_ipaddress_x_privateipaddress,
|
||||
- iface_data);
|
||||
+ ipaddress_req_data);
|
||||
}
|
||||
|
||||
- iface_data->iface_get_config->ipv4s_len = 0;
|
||||
iface_data->iface_get_config->ipv4s_arr = g_new(in_addr_t, iface_data->n_iface_data_pending);
|
||||
+ iface_data->iface_get_config->has_ipv4s = TRUE;
|
||||
+ iface_data->iface_get_config->ipv4s_len = iface_data->n_iface_data_pending;
|
||||
|
||||
{
|
||||
gs_free char *uri = NULL;
|
||||
--
|
||||
2.47.1
|
||||
|
@ -6,7 +6,7 @@
|
||||
%global epoch_version 1
|
||||
%global real_version 1.40.16
|
||||
%global rpm_version %{real_version}
|
||||
%global release_version 18
|
||||
%global release_version 19
|
||||
%global snapshot %{nil}
|
||||
%global git_sha %{nil}
|
||||
%global bcond_default_debug 0
|
||||
@ -213,6 +213,7 @@ Patch1014: 1014-device-disable-IPv6-in-NetworkManager-when-disabled-rhel-10450.p
|
||||
Patch1015: 1015-use-etc-hosts-for-hostname-resolution-rhel-53200.patch
|
||||
Patch1016: 1016-vpn-place-gateway-route-to-table-defined-in-ipvx-route-table-rhel-73051.patch
|
||||
Patch1017: 1017-vpn-fix-routing-rules-support-in-vpn-conenctions-rhel-73052.patch
|
||||
Patch1018: 1018-cloud-setup-azure-ensure-that-primary-address-is-pla-rhel-69462.patch
|
||||
|
||||
Requires(post): systemd
|
||||
%if 0%{?fedora} || 0%{?rhel} >= 8
|
||||
@ -1248,6 +1249,9 @@ fi
|
||||
|
||||
|
||||
%changelog
|
||||
* Fri Jan 17 2025 Fernando Fernandez Mancera <ferfern@redhat.com> - 1:1.40.16-19
|
||||
- cloud-setup: azure: ensure that primary address is placed first (RHEL-69462)
|
||||
|
||||
* Tue Jan 07 2025 Wen Liang <wenliang@redhat.com> - 1:1.40.16-18
|
||||
- vpn: fix routing rules support in vpn conenctions (RHEL-73052)
|
||||
- vpn: Place gateway route to table defined in ipvx.route-table (RHEL-73051)
|
||||
|
Loading…
Reference in New Issue
Block a user