network-config-manager: Patched to fix incorrect IPv6 config source

Issue - nmctl status <device> -j is showing ConfigSource as foreign
for all kind of address like static, dynamic and foreign.

Now on existing flow to get a link address info nmctl get the info
from dbus and parse the info similar for address as well. While parsing
the address from json object to ip, prefix length is not appended to address.
Hence ip matching with address always failing for IPv6, cause of this
ConfigSource always set to foreign regardless of address is static or dynamic.

Fix - Fixed in json_array_to_ip parsing to take care of prefix value as well
while returning the ip address after parsing the json object.

Change-Id: I07a61a6ea64d7a49c3b6fa08beb33b2be20d580e
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/c/photon/+/24313
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Tapas Kundu <tapas.kundu@broadcom.com>
Reviewed-by: Harinadh Dommaraju <harinadh.dommaraju@broadcom.com>
This commit is contained in:
Nitesh Kumar 2024-07-23 12:19:03 +05:30 committed by Harinadh Dommaraju
parent 622b8f66a7
commit 0410d74595
2 changed files with 49 additions and 1 deletions

View File

@ -0,0 +1,44 @@
From 52eb0b1c7202a54d735f1ee79c0477b8b50fb2e2 Mon Sep 17 00:00:00 2001
From: Nitesh <kunitesh@vmware.com>
Date: Wed, 10 Jul 2024 11:50:21 +0530
Subject: [PATCH] Fixed incorrect config source for IPv6 address
---
src/json/network-json.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/json/network-json.c b/src/json/network-json.c
index 61ee73c..a4c3b26 100644
--- a/src/json/network-json.c
+++ b/src/json/network-json.c
@@ -1157,22 +1157,22 @@ static int json_array_to_ip(const json_object *obj, const int family, const int
}
}
+ if (prefix > 0)
+ g_string_append_printf(v, "/%d", prefix);
+
if (family == AF_INET6) {
_auto_cleanup_ IPAddress *addr = NULL;
int r;
- r = parse_ipv6(v->str, &addr);
+ r = parse_ip_from_str(v->str, &addr);
if (r < 0)
return r;
- r = ip_to_str(AF_INET6, addr, &ip);
+ r = ip_to_str_prefix(AF_INET6, addr, &ip);
if (r < 0)
return r;
}
- if (prefix > 0)
- g_string_append_printf(v, "/%d", prefix);
-
if (family == AF_INET6)
*ret = steal_ptr(ip);
else {
--
2.34.1

View File

@ -1,7 +1,7 @@
Summary: Configure and introspect the state of the network
Name: network-config-manager
Version: 0.7.3
Release: 1%{?dist}
Release: 2%{?dist}
License: Apache 2.0
Group: Applications/System
Vendor: VMware, Inc.
@ -11,6 +11,8 @@ URL: https://github.com/vmware/network-config-manager
Source0: https://github.com/vmware/network-config-manager/archive/%{name}-%{version}.tar.gz
%define sha512 %{name}-%{version}=34a587a87a91792b7063af57459f668b30436ad91a077f6a93eab32bb5a0d72862966a6a3c6b9473fae41ee638daad69534f4aca2014c56e04548e744c22df37
Patch0: 0001-Fixed-incorrect-config-source-for-IPv6-address.patch
BuildRequires: glib-devel
BuildRequires: json-c-devel
BuildRequires: meson
@ -80,6 +82,8 @@ mv %{buildroot}/lib/systemd %{buildroot}/usr/lib/
%{_libdir}/pkgconfig/%{name}.pc
%changelog
* Tue Jul 23 2024 Nitesh Kumar <nitesh-nk.kumar@broadcom.com> 0.7.3-2
- Patched to fix incorrect ConfigSource for IPv6 Address
* Thu May 02 2024 Nitesh Kumar <nitesh-nk.kumar@broadcom.com> 0.7.3-1
- Version upgrade to v0.7.3
* Thu Feb 22 2024 Shreenidhi Shedi <shreenidhi.shedi@broadcom.com> 0.7.1-2