From b229d9b82fbe035a908e7e9ba0e87290961e43e6 Mon Sep 17 00:00:00 2001
From: Andrei Gherzan <andrei.gherzan@huawei.com>
Date: Wed, 8 Dec 2021 16:01:50 +0100
Subject: [PATCH] networkmanager: Drop version 1.22.16

meta-networking now comes with a newer version: 1.32.12. 1.22.16 version
was an upgrade for dunfell but now that we move to newer layers, we can
drop it and use the latest in upstream.

This also drops the whitelist of CVE-2021-20297. This is fine because
the upstream version is not affected (1.32.12).

Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com>
---
 .../networkmanager-openvpn_1.8.12.bb          |  52 ------
 ...e.ac-Fix-pkgconfig-sysroot-locations.patch |  22 ---
 ...ttings-settings-property-documentati.patch |  74 --------
 .../networkmanager/fix-strerror_r.patch       |  34 ----
 .../fix_reallocarray_check.patch              |  27 ---
 ...Fix-build-with-musl-systemd-specific.patch | 165 -----------------
 .../musl/0002-Fix-build-with-musl.patch       | 116 ------------
 ...0003-Fix-build-with-musl-for-n-dhcp4.patch |  61 -------
 ...Fix-build-with-musl-systemd-specific.patch |  26 ---
 .../networkmanager/networkmanager.initd       | 110 -----------
 .../networkmanager/networkmanager_1.22.16.bb  | 172 ------------------
 11 files changed, 859 deletions(-)
 delete mode 100644 meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager-openvpn_1.8.12.bb
 delete mode 100644 meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager/0001-Fixed-configure.ac-Fix-pkgconfig-sysroot-locations.patch
 delete mode 100644 meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager/0002-Do-not-create-settings-settings-property-documentati.patch
 delete mode 100644 meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager/fix-strerror_r.patch
 delete mode 100644 meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager/fix_reallocarray_check.patch
 delete mode 100644 meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager/musl/0001-Fix-build-with-musl-systemd-specific.patch
 delete mode 100644 meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager/musl/0002-Fix-build-with-musl.patch
 delete mode 100644 meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager/musl/0003-Fix-build-with-musl-for-n-dhcp4.patch
 delete mode 100644 meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager/musl/0004-Fix-build-with-musl-systemd-specific.patch
 delete mode 100644 meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager/networkmanager.initd
 delete mode 100644 meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager_1.22.16.bb

diff --git a/meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager-openvpn_1.8.12.bb b/meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager-openvpn_1.8.12.bb
deleted file mode 100644
index d455a0f0..00000000
--- a/meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager-openvpn_1.8.12.bb
+++ /dev/null
@@ -1,52 +0,0 @@
-SUMMARY = "NetworkManager-openvpn-plugin"
-SECTION = "net/misc"
-
-LICENSE = "GPLv2+"
-LIC_FILES_CHKSUM = "file://COPYING;md5=100d5a599bead70ddcd70dcd73f2e29c"
-
-DEPENDS = "dbus dbus-glib networkmanager openvpn intltool-native glib-2.0-native"
-
-inherit gnomebase useradd gettext systemd
-
-SRC_URI = "${GNOME_MIRROR}/NetworkManager-openvpn/${@gnome_verdir("${PV}")}/NetworkManager-openvpn-${PV}.tar.xz"
-
-SRC_URI[md5sum] = "e8b1210011ece18d0278310fbff45af5"
-SRC_URI[sha256sum] = "0efda8878aaf0e6eb5071a053aea5d7f9d42aac097b3ff89e7cbc9233f815318"
-
-S = "${WORKDIR}/NetworkManager-openvpn-${PV}"
-
-# meta-gnome in layers is required using gnome:
-PACKAGECONFIG[gnome] = "--with-gnome,--without-gnome,gtk+3 libnma libsecret"
-
-do_configure_append() {
-    # network-manager-openvpn.metainfo.xml is created in source folder but
-    # compile expects it in build folder. As long as nobody comes up with a
-    # better solution just support build:
-    if [ -e ${S}/appdata/network-manager-openvpn.metainfo.xml ]; then
-        mkdir -p ${B}/appdata
-        cp -f ${S}/appdata/network-manager-openvpn.metainfo.xml ${B}/appdata/
-    fi
-}
-
-do_install_append () {
-    rm -rf ${D}${libdir}/NetworkManager/*.la
-}
-
-# Create user and group nm-openvpn that are needed since version 1.0.6
-USERADD_PACKAGES = "${PN}"
-USERADD_PARAM_${PN} = "--system nm-openvpn"
-
-FILES_${PN} += " \
-    ${datadir}/dbus-1 \
-    ${libdir}/NetworkManager/*.so \
-    ${nonarch_libdir}/NetworkManager/VPN/nm-openvpn-service.name \
-"
-
-FILES_${PN}-staticdev += " \
-    ${libdir}/NetworkManager/*.a \
-"
-
-RDEPENDS_${PN} = " \
-    networkmanager \
-    openvpn \
-"
diff --git a/meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager/0001-Fixed-configure.ac-Fix-pkgconfig-sysroot-locations.patch b/meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager/0001-Fixed-configure.ac-Fix-pkgconfig-sysroot-locations.patch
deleted file mode 100644
index 19c8c748..00000000
--- a/meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager/0001-Fixed-configure.ac-Fix-pkgconfig-sysroot-locations.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-From 9bcf4c81a559d1e7deac47b2e510d7f1e5837a02 Mon Sep 17 00:00:00 2001
-From: Pablo Saavedra <psaavedra@igalia.com>
-Date: Tue, 13 Mar 2018 17:36:20 +0100
-Subject: [PATCH] Fixed configure.ac: Fix pkgconfig sysroot locations
-
----
- configure.ac | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/configure.ac b/configure.ac
-index 65ceffb..ad4b0fc 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -561,7 +561,7 @@ if test "$have_jansson" = "yes"; then
- 	AC_DEFINE(WITH_JANSSON, 1, [Define if JANSSON is enabled])
- 
- 	AC_CHECK_TOOLS(READELF, [eu-readelf readelf])
--	JANSSON_LIBDIR=`$PKG_CONFIG --variable=libdir jansson`
-+	JANSSON_LIBDIR=${PKG_CONFIG_SYSROOT_DIR}`$PKG_CONFIG --variable=libdir jansson`
- 	JANSSON_SONAME=`$READELF -d $JANSSON_LIBDIR/libjansson.so |sed -n 's/.*SONAME.*\[[\([^]]*\)]]/\1/p'`
- 
- 	if test "$JANSSON_SONAME" = ""; then
diff --git a/meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager/0002-Do-not-create-settings-settings-property-documentati.patch b/meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager/0002-Do-not-create-settings-settings-property-documentati.patch
deleted file mode 100644
index 446637b2..00000000
--- a/meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager/0002-Do-not-create-settings-settings-property-documentati.patch
+++ /dev/null
@@ -1,74 +0,0 @@
-From 9eab96351a726e9ce6a15d158f743e35d73a8900 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@gmail.com>
-Date: Thu, 22 Mar 2018 11:08:30 +0100
-Subject: [PATCH] Do not create settings settings/property documentation
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@gmail.com>
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-It was tried to get this work but gi / GirRepository could not be found by
-python. Anyway it is not necessary for us to have the settings/property docs.
-
-Upstream-Status: Inappropriate [OE specific]
-
-Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
-
----
- Makefile.am  | 11 -----------
- configure.ac |  5 -----
- 2 files changed, 16 deletions(-)
-
-diff --git a/Makefile.am b/Makefile.am
-index d5cbcf5..2a1819a 100644
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -1473,9 +1473,7 @@ libnm/libnm.typelib: libnm/libnm.gir
- INTROSPECTION_GIRS += libnm/NM-1.0.gir
- 
- libnm_noinst_data = \
--	libnm/nm-property-docs.xml \
- 	libnm/nm-settings-docs-overrides.xml \
--	libnm/nm-settings-docs.xml \
- 	libnm/nm-settings-keyfile-docs.xml \
- 	libnm/nm-settings-ifcfg-rh-docs.xml
- 
-@@ -4236,18 +4234,9 @@ $(clients_common_libnmc_base_la_OBJECTS): $(libnm_lib_h_pub_mkenums)
- $(clients_common_libnmc_base_la_OBJECTS): clients/common/.dirstamp
- 
- clients_common_settings_doc_h = clients/common/settings-docs.h
--if HAVE_INTROSPECTION
--$(clients_common_settings_doc_h): clients/common/settings-docs.xsl libnm/nm-property-docs.xml clients/common/.dirstamp
--	$(AM_V_GEN) $(XSLTPROC) --output $@ $< $(word 2,$^)
--DISTCLEANFILES += $(clients_common_settings_doc_h)
--check-local-settings-docs: $(clients_common_settings_doc_h)
--	$(srcdir)/tools/check-settings-docs.sh "$(srcdir)" "$(builddir)" "$(clients_common_settings_doc_h)"
--check_local += check-local-settings-docs
--else
- $(clients_common_settings_doc_h): $(clients_common_settings_doc_h).in clients/common/.dirstamp
- 	$(AM_V_GEN) cp "$(srcdir)/$(clients_common_settings_doc_h).in" "$(builddir)/$(clients_common_settings_doc_h)"
- check-local-settings-docs:
--endif
- EXTRA_DIST += \
- 	$(clients_common_settings_doc_h) \
- 	$(clients_common_settings_doc_h).in
-diff --git a/configure.ac b/configure.ac
-index ad4b0fc..0092092 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -1201,11 +1201,6 @@ GTK_DOC_CHECK(1.0)
- # check if we can build setting property documentation
- build_docs=no
- if test -n "$INTROSPECTION_MAKEFILE"; then
--	# If g-i is installed we know we have python, but we might not have pygobject
--	if ! "$PYTHON" -c 'from gi.repository import GObject' >& /dev/null; then
--		AC_MSG_ERROR(["--enable-introspection aims to build the settings documentation. This requires GObject introspection for python (pygobject)])
--	fi
--
- 	AC_PATH_PROG(PERL, perl)
- 	if test -z "$PERL"; then
- 		AC_MSG_ERROR([--enable-introspection requires perl])
diff --git a/meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager/fix-strerror_r.patch b/meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager/fix-strerror_r.patch
deleted file mode 100644
index c284f75e..00000000
--- a/meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager/fix-strerror_r.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From 18765456467af24786bc2397ca72affe42149504 Wed Sep  8 22:33:40 2021
-From: Bernhard Rosenkraenzer <bernhard.rosenkraenzer.ext@huawei.com>
-Date: Wed,  8 Sep 2021 22:33:40 +0200
-Subject: [PATCH] Fix crash on startup when using musl
-
-nm_strerror_native_r makes use of a glibc extension to strerror_r
-when _GNU_SOURCE is defined -- even when not using glibc.
-
-musl uses _GNU_SOURCE for some extensions, but doesn't have the
-strerror_r for unknown error codes extension -- resulting in a
-NULL pointer being passed to UTF-8 check functions that don't
-check for it.
-
-Use the non-glibc code path when __GLIBC__ isn't set.
-
-Signed-off-by: Bernhard Rosenkraenzer <bernhard.rosenkraenzer.ext@huawei.com>
-Upstream-status: Inappropriate [problem doesn't exist in current releases]
-
----
- nm-errno.c |    2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff -up NetworkManager-1.22.10/shared/nm-glib-aux/nm-errno.c.omv~ NetworkManager-1.22.10/shared/nm-glib-aux/nm-errno.c
---- NetworkManager-1.22.10/shared/nm-glib-aux/nm-errno.c.omv~	2021-09-08 22:10:10.753007649 +0200
-+++ NetworkManager-1.22.10/shared/nm-glib-aux/nm-errno.c	2021-09-08 22:18:11.975338808 +0200
-@@ -106,7 +106,7 @@ nm_strerror_native_r (int errsv, char *b
- 	nm_assert (buf);
- 	nm_assert (buf_size > 0);
- 
--#if (_POSIX_C_SOURCE >= 200112L) && !  _GNU_SOURCE
-+#if !defined(__GLIBC__) || ((_POSIX_C_SOURCE >= 200112L) && !  _GNU_SOURCE)
- 	/* XSI-compliant */
- 	{
- 		int errno_saved = errno;
diff --git a/meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager/fix_reallocarray_check.patch b/meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager/fix_reallocarray_check.patch
deleted file mode 100644
index 0a8de541..00000000
--- a/meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager/fix_reallocarray_check.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-reallocarray() is coming from stdlib.h which maybe indirectly included
-by malloc.h but not on all libc implementations
-
-Upstream-Status: Pending
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
---- a/meson.build
-+++ b/meson.build
-@@ -114,7 +114,7 @@ config_h.set10('HAVE_GETRANDOM', use_sys
- # FIXME secure_getenv check is not useful?
- config_h.set('HAVE_SECURE_GETENV', cc.has_function('secure_getenv'))
- config_h.set('HAVE___SECURE_GETENV', cc.has_function('__secure_getenv'))
--config_h.set10('HAVE_DECL_REALLOCARRAY', cc.has_function('reallocarray', prefix: '#include <malloc.h>'))
-+config_h.set10('HAVE_DECL_REALLOCARRAY', cc.has_function('reallocarray', prefix: '#include <stdlib.h>'))
- config_h.set10('HAVE_DECL_EXPLICIT_BZERO', cc.has_function('explicit_bzero', prefix: '#include <string.h>'))
- config_h.set10('HAVE_DECL_MEMFD_CREATE', cc.has_function('memfd_create', prefix: '#include <sys/mman.h>'))
- 
---- a/configure.ac
-+++ b/configure.ac
-@@ -82,7 +82,7 @@ AC_CHECK_DECLS([
- AC_CHECK_DECLS([
- 	reallocarray],
- 	[], [], [[
--#include <malloc.h>
-+#include <stdlib.h>
- ]])
- 
- AC_CHECK_DECLS([
diff --git a/meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager/musl/0001-Fix-build-with-musl-systemd-specific.patch b/meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager/musl/0001-Fix-build-with-musl-systemd-specific.patch
deleted file mode 100644
index c23fc308..00000000
--- a/meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager/musl/0001-Fix-build-with-musl-systemd-specific.patch
+++ /dev/null
@@ -1,165 +0,0 @@
-From e7ed91c48e1a07527a860637a7865eb67ce34cf3 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@gmail.com>
-Date: Tue, 2 Apr 2019 01:34:35 +0200
-Subject: [PATCH] Fix build with musl - systemd specific
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Networkmanager imported some code from systemd. This requires some adjustments
-for musl.
-
-Upstream-Status: Pending
-
-Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
-
----
- shared/systemd/src/basic/in-addr-util.c |  1 +
- shared/systemd/src/basic/process-util.c |  9 +++++++++
- shared/systemd/src/basic/socket-util.h  |  6 ++++++
- shared/systemd/src/basic/sort-util.h    | 27 ++++---------------------
- shared/systemd/src/basic/stdio-util.h   |  2 ++
- shared/systemd/src/basic/string-util.h  |  5 +++++
- 6 files changed, 27 insertions(+), 23 deletions(-)
-
-diff --git a/shared/systemd/src/basic/in-addr-util.c b/shared/systemd/src/basic/in-addr-util.c
-index 91d687c..8388304 100644
---- a/shared/systemd/src/basic/in-addr-util.c
-+++ b/shared/systemd/src/basic/in-addr-util.c
-@@ -15,6 +15,7 @@
- #include "in-addr-util.h"
- #include "macro.h"
- #include "parse-util.h"
-+#include "string-util.h"
- #include "random-util.h"
- #include "strxcpyx.h"
- #include "util.h"
-diff --git a/shared/systemd/src/basic/process-util.c b/shared/systemd/src/basic/process-util.c
-index 1456167..42f51a0 100644
---- a/shared/systemd/src/basic/process-util.c
-+++ b/shared/systemd/src/basic/process-util.c
-@@ -17,6 +17,9 @@
- #include <sys/wait.h>
- #include <syslog.h>
- #include <unistd.h>
-+#ifndef __GLIBC__
-+#include <pthread.h>
-+#endif
- #if 0 /* NM_IGNORED */
- #if HAVE_VALGRIND_VALGRIND_H
- #include <valgrind/valgrind.h>
-@@ -1123,11 +1126,13 @@ void reset_cached_pid(void) {
-         cached_pid = CACHED_PID_UNSET;
- }
- 
-+#ifdef __GLIBC__
- /* We use glibc __register_atfork() + __dso_handle directly here, as they are not included in the glibc
-  * headers. __register_atfork() is mostly equivalent to pthread_atfork(), but doesn't require us to link against
-  * libpthread, as it is part of glibc anyway. */
- extern int __register_atfork(void (*prepare) (void), void (*parent) (void), void (*child) (void), void *dso_handle);
- extern void* __dso_handle _weak_;
-+#endif
- 
- pid_t getpid_cached(void) {
-         static bool installed = false;
-@@ -1156,7 +1161,11 @@ pid_t getpid_cached(void) {
-                          * only half-documented (glibc doesn't document it but LSB does — though only superficially)
-                          * we'll check for errors only in the most generic fashion possible. */
- 
-+#ifdef __GLIBC__
-                         if (__register_atfork(NULL, NULL, reset_cached_pid, __dso_handle) != 0) {
-+#else
-+                        if (pthread_atfork(NULL, NULL, reset_cached_pid) != 0) {
-+#endif
-                                 /* OOM? Let's try again later */
-                                 cached_pid = CACHED_PID_UNSET;
-                                 return new_pid;
-diff --git a/shared/systemd/src/basic/socket-util.h b/shared/systemd/src/basic/socket-util.h
-index a0886e0..da47d14 100644
---- a/shared/systemd/src/basic/socket-util.h
-+++ b/shared/systemd/src/basic/socket-util.h
-@@ -14,6 +14,12 @@
- #include <sys/types.h>
- #include <sys/un.h>
- 
-+#if !defined(__GLIBC__)
-+/* SIOCGSTAMPNS from linux/asm-generic.h
-+ * for src/systemd/src/libsystemd-network/sd-lldp.c */
-+#include <linux/sockios.h>
-+#endif
-+
- #include "macro.h"
- #include "missing_socket.h"
- #include "sparse-endian.h"
-diff --git a/shared/systemd/src/basic/sort-util.h b/shared/systemd/src/basic/sort-util.h
-index e029f86..1e8b6e1 100644
---- a/shared/systemd/src/basic/sort-util.h
-+++ b/shared/systemd/src/basic/sort-util.h
-@@ -5,15 +5,10 @@
- 
- #include "macro.h"
- 
--void *xbsearch_r(const void *key, const void *base, size_t nmemb, size_t size,
--                 __compar_d_fn_t compar, void *arg);
--
--#define typesafe_bsearch_r(k, b, n, func, userdata)                     \
--        ({                                                              \
--                const typeof(b[0]) *_k = k;                             \
--                int (*_func_)(const typeof(b[0])*, const typeof(b[0])*, typeof(userdata)) = func; \
--                xbsearch_r((const void*) _k, (b), (n), sizeof((b)[0]), (__compar_d_fn_t) _func_, userdata); \
--        })
-+#if !defined(__GLIBC__)
-+typedef int (*__compar_fn_t) (const void*, const void*);
-+typedef __compar_fn_t comparison_fn_t;
-+#endif
- 
- /**
-  * Normal bsearch requires base to be nonnull. Here were require
-@@ -54,17 +49,3 @@ static inline void qsort_safe(void *base, size_t nmemb, size_t size, __compar_fn
-                 int (*_func_)(const typeof(p[0])*, const typeof(p[0])*) = func; \
-                 qsort_safe((p), (n), sizeof((p)[0]), (__compar_fn_t) _func_); \
-         })
--
--static inline void qsort_r_safe(void *base, size_t nmemb, size_t size, __compar_d_fn_t compar, void *userdata) {
--        if (nmemb <= 1)
--                return;
--
--        assert(base);
--        qsort_r(base, nmemb, size, compar, userdata);
--}
--
--#define typesafe_qsort_r(p, n, func, userdata)                          \
--        ({                                                              \
--                int (*_func_)(const typeof(p[0])*, const typeof(p[0])*, typeof(userdata)) = func; \
--                qsort_r_safe((p), (n), sizeof((p)[0]), (__compar_d_fn_t) _func_, userdata); \
--        })
-diff --git a/shared/systemd/src/basic/stdio-util.h b/shared/systemd/src/basic/stdio-util.h
-index c3b9448..e80a938 100644
---- a/shared/systemd/src/basic/stdio-util.h
-+++ b/shared/systemd/src/basic/stdio-util.h
-@@ -1,7 +1,9 @@
- /* SPDX-License-Identifier: LGPL-2.1+ */
- #pragma once
- 
-+#if defined(__GLIBC__)
- #include <printf.h>
-+#endif
- #include <stdarg.h>
- #include <stdio.h>
- #include <sys/types.h>
-diff --git a/shared/systemd/src/basic/string-util.h b/shared/systemd/src/basic/string-util.h
-index 04cc82b..2cf589a 100644
---- a/shared/systemd/src/basic/string-util.h
-+++ b/shared/systemd/src/basic/string-util.h
-@@ -26,6 +26,11 @@
- #define strcaseeq(a,b) (strcasecmp((a),(b)) == 0)
- #define strncaseeq(a, b, n) (strncasecmp((a), (b), (n)) == 0)
- 
-+/* musl does not know strndupa */
-+#if !defined(__GLIBC__)
-+#define strndupa(x,s) strncpy(alloca(strlen(x)+1),x,s)
-+#endif
-+
- int strcmp_ptr(const char *a, const char *b) _pure_;
- 
- static inline bool streq_ptr(const char *a, const char *b) {
diff --git a/meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager/musl/0002-Fix-build-with-musl.patch b/meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager/musl/0002-Fix-build-with-musl.patch
deleted file mode 100644
index 196a3358..00000000
--- a/meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager/musl/0002-Fix-build-with-musl.patch
+++ /dev/null
@@ -1,116 +0,0 @@
-From 877fbb4e848629ff57371b5bdb0d56369abe9d81 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@gmail.com>
-Date: Mon, 8 Apr 2019 23:10:43 +0200
-Subject: [PATCH] Fix build with musl
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-The build issues caused by definition conflicts musl vs linux-libc headers
-(error: redefinition of ...) can be reduced to two headers:
-
-1. netinet/if_ether.h <-> linux/if_ether.h: linux-libc header plays well with
-   glibc and musl headers in case libc's variant (netinet/if_ether.h) is
-   included BEFORE linux variant [1]. We add include at two positions:
-   1. shared/nm-default.h: This is a global which used for networkmanager and
-      is included at the very beginning of all c-files.
-   2. libnm-core/nm-utils.h: This file makes it into installation and is used
-      by dependent packages as network-manager-applet
-2. net/if_arp. <-> linux/if_ether.h: linux-libc: Unfortunaly these files do
-   not play together in harmony. Therefore the libc variant is included early in
-   shared/nm-default.h and occurances linux/if_arp.h are removed.
-
-Note:
-Be aware that this is still nasty business: We have to trust that musl headers
-define same signatures as linux would do - just because musl-makers consider
-linux-libc headers 'notoriously broken for userspace' [2] (search for
-'error: redefinition of').
-
-[1] http://lists.openembedded.org/pipermail/openembedded-core/2019-March/280440.html
-[2] https://wiki.musl-libc.org/faq.html
-
-Upstream-Status: Pending
-
-Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
-
----
- clients/tui/nmt-device-entry.c   | 1 -
- libnm-core/nm-utils.h            | 4 ++++
- shared/nm-default.h              | 3 +++
- src/devices/nm-device.c          | 2 +-
- src/platform/nm-linux-platform.c | 1 -
- 5 files changed, 8 insertions(+), 3 deletions(-)
-
-diff --git a/clients/tui/nmt-device-entry.c b/clients/tui/nmt-device-entry.c
-index 4ab5932..915248c 100644
---- a/clients/tui/nmt-device-entry.c
-+++ b/clients/tui/nmt-device-entry.c
-@@ -26,7 +26,6 @@
- #include "nmt-device-entry.h"
- 
- #include <sys/socket.h>
--#include <linux/if_arp.h>
- 
- #include "nmtui.h"
- 
-diff --git a/libnm-core/nm-utils.h b/libnm-core/nm-utils.h
-index 5418a1e..f492da6 100644
---- a/libnm-core/nm-utils.h
-+++ b/libnm-core/nm-utils.h
-@@ -10,6 +10,10 @@
- #error "Only <NetworkManager.h> can be included directly."
- #endif
- 
-+/* include as early as possible for musl */
-+#include <netinet/if_ether.h>
-+/* #include <net/if_arp.h> - uncoment for broken dependents?? */
-+
- #include <glib.h>
- 
- #include <netinet/in.h>
-diff --git a/shared/nm-default.h b/shared/nm-default.h
-index ace6ede..25357da 100644
---- a/shared/nm-default.h
-+++ b/shared/nm-default.h
-@@ -182,6 +182,9 @@
- #endif
- 
- #include <stdlib.h>
-+/* include as early as possible for musl */
-+#include <netinet/if_ether.h>
-+#include <net/if_arp.h>
- 
- /*****************************************************************************/
- 
-diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
-index 3bbc975..4e8a3f6 100644
---- a/src/devices/nm-device.c
-+++ b/src/devices/nm-device.c
-@@ -9,6 +9,7 @@
- #include "nm-device.h"
- 
- #include <netinet/in.h>
-+#include <net/if.h>
- #include <unistd.h>
- #include <sys/ioctl.h>
- #include <signal.h>
-@@ -17,7 +18,6 @@
- #include <arpa/inet.h>
- #include <fcntl.h>
- #include <linux/if_addr.h>
--#include <linux/if_arp.h>
- #include <linux/rtnetlink.h>
- #include <linux/pkt_sched.h>
- 
-diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
-index 7abe4df..9f53147 100644
---- a/src/platform/nm-linux-platform.c
-+++ b/src/platform/nm-linux-platform.c
-@@ -14,7 +14,6 @@
- #include <libudev.h>
- #include <linux/fib_rules.h>
- #include <linux/ip.h>
--#include <linux/if_arp.h>
- #include <linux/if_bridge.h>
- #include <linux/if_link.h>
- #include <linux/if_tun.h>
diff --git a/meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager/musl/0003-Fix-build-with-musl-for-n-dhcp4.patch b/meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager/musl/0003-Fix-build-with-musl-for-n-dhcp4.patch
deleted file mode 100644
index 62252826..00000000
--- a/meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager/musl/0003-Fix-build-with-musl-for-n-dhcp4.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-From aff5cded8847f3eee59f5cec22afb8630d401a85 Mon Sep 17 00:00:00 2001
-From: Adrian Freihofer <adrian.freihofer@siemens.com>
-Date: Sat, 7 Mar 2020 14:22:36 +0100
-Subject: [PATCH 3/4] Fix build with musl for n-dhcp4
-
----
- shared/n-dhcp4/src/n-dhcp4-c-probe.c | 8 ++++++++
- shared/n-dhcp4/src/n-dhcp4-private.h | 4 ++++
- 2 files changed, 12 insertions(+)
-
-diff --git a/shared/n-dhcp4/src/n-dhcp4-c-probe.c b/shared/n-dhcp4/src/n-dhcp4-c-probe.c
-index e4477a7..75713c8 100644
---- a/shared/n-dhcp4/src/n-dhcp4-c-probe.c
-+++ b/shared/n-dhcp4/src/n-dhcp4-c-probe.c
-@@ -360,8 +360,12 @@ static void n_dhcp4_client_probe_config_initialize_random_seed(NDhcp4ClientProbe
-         seed16v[1] = (u64 >> 16) ^ (u64 >>  0);
-         seed16v[2] = (u64 >> 32) ^ (u64 >> 16);
- 
-+#ifdef __GLIBC__
-         r = seed48_r(seed16v, &config->entropy);
-         c_assert(!r);
-+#else
-+        memcpy(config->entropy, seed16v, sizeof seed16v);
-+#endif
- }
- 
- /**
-@@ -375,10 +379,14 @@ static void n_dhcp4_client_probe_config_initialize_random_seed(NDhcp4ClientProbe
-  */
- uint32_t n_dhcp4_client_probe_config_get_random(NDhcp4ClientProbeConfig *config) {
-         long int result;
-+#ifdef __GLIBC__
-         int r;
- 
-         r = mrand48_r(&config->entropy, &result);
-         c_assert(!r);
-+#else
-+        result = jrand48(config->entropy);
-+#endif
- 
-         return result;
- };
-diff --git a/shared/n-dhcp4/src/n-dhcp4-private.h b/shared/n-dhcp4/src/n-dhcp4-private.h
-index 436ee80..ffcb4b2 100644
---- a/shared/n-dhcp4/src/n-dhcp4-private.h
-+++ b/shared/n-dhcp4/src/n-dhcp4-private.h
-@@ -267,7 +267,11 @@ struct NDhcp4ClientProbeConfig {
-         bool inform_only;
-         bool init_reboot;
-         struct in_addr requested_ip;
-+#ifdef __GLIBC__
-         struct drand48_data entropy;    /* entropy pool */
-+#else
-+        unsigned short entropy[3];      /* entropy pool */
-+#endif
-         uint64_t ms_start_delay;        /* max ms to wait before starting probe */
-         NDhcp4ClientProbeOption *options[UINT8_MAX + 1];
-         int8_t request_parameters[UINT8_MAX + 1];
--- 
-2.24.1
-
diff --git a/meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager/musl/0004-Fix-build-with-musl-systemd-specific.patch b/meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager/musl/0004-Fix-build-with-musl-systemd-specific.patch
deleted file mode 100644
index 55aa4d26..00000000
--- a/meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager/musl/0004-Fix-build-with-musl-systemd-specific.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From 80c7d3391510993cba1a7499bf33a5b2b115280d Mon Sep 17 00:00:00 2001
-From: Adrian Freihofer <adrian.freihofer@siemens.com>
-Date: Sat, 7 Mar 2020 14:24:01 +0100
-Subject: [PATCH 4/4] Fix build with musl - systemd specific
-
----
- src/systemd/src/libsystemd-network/sd-dhcp6-client.c | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/src/systemd/src/libsystemd-network/sd-dhcp6-client.c b/src/systemd/src/libsystemd-network/sd-dhcp6-client.c
-index e1150f9..2c63bac 100644
---- a/src/systemd/src/libsystemd-network/sd-dhcp6-client.c
-+++ b/src/systemd/src/libsystemd-network/sd-dhcp6-client.c
-@@ -7,7 +7,9 @@
- 
- #include <errno.h>
- #include <sys/ioctl.h>
-+#ifdef __GLIBC__  /* musl supplies full set of userspace headers */
- #include <linux/if_arp.h>
-+#endif
- #include <linux/if_infiniband.h>
- 
- #include "sd-dhcp6-client.h"
--- 
-2.24.1
-
diff --git a/meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager/networkmanager.initd b/meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager/networkmanager.initd
deleted file mode 100644
index 4fdd80d4..00000000
--- a/meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager/networkmanager.initd
+++ /dev/null
@@ -1,110 +0,0 @@
-#! /bin/sh
-### BEGIN INIT INFO
-# Provides:          network-manager
-# Required-Start:    $remote_fs dbus udev
-# Required-Stop:     $remote_fs dbus udev
-# Should-Start:      $syslog
-# Should-Stop:       $syslog
-# Default-Start:     2 3 4 5
-# Default-Stop:      0 1 6
-# Short-Description: network connection manager
-# Description:       Daemon for automatically switching network
-#            connections to the best available connection.
-### END INIT INFO
-
-PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
-DESC="network connection manager"
-NAME="NetworkManager"
-
-DAEMON=/usr/sbin/$NAME
-
-PIDFILE=/run/$NAME/$NAME.pid
-
-SCRIPTNAME=/etc/init.d/network-manager
-
-. /etc/init.d/functions || exit 1
-
-# Exit if the package is not installed
-[ -x "$DAEMON" ] || exit 0
-
-log_daemon_msg() {
-    echo -n $*
-}
-
-log_end_msg() {
-    if [ $1 -eq 0 ]; then
-        success
-    else
-        failure
-    fi
-    echo
-}
-
-log_progress_msg () {
-    if [ -z "${1:-}" ]; then
-        return 1
-    fi
-    echo -n " $@"
-}
-
-#
-#   Function that starts the daemon/service.
-#
-d_start() {
-    start-stop-daemon --start --quiet --pidfile $PIDFILE \
-        --exec $DAEMON -- $DAEMON_OPTS
-}
-
-#
-#   Function that stops the daemon/service.
-#
-d_stop() {
-    start-stop-daemon --stop --retry 5 --quiet --pidfile $PIDFILE \
-        --exec $DAEMON
-}
-
-d_reload() {
-    start-stop-daemon --stop --signal HUP --quiet --pidfile $PIDFILE \
-        --exec $DAEMON
-}
-
-case "$1" in
-  start)
-    log_daemon_msg "Starting $DESC" "$NAME"
-    d_start
-    case "$?" in
-        0) log_end_msg 0 ;;
-        1) log_progress_msg "already started"
-           log_end_msg 0 ;;
-        *) log_end_msg 1 ;;
-    esac
-    ;;
-  stop)
-    log_daemon_msg "Stopping $DESC" "$NAME"
-    d_stop
-    case "$?" in
-        0) log_end_msg 0 ;;
-        1) log_progress_msg "already stopped"
-           log_end_msg 0 ;;
-        *) log_end_msg 1 ;;
-    esac
-    ;;
-  reload|force-reload)
-    log_daemon_msg "Reloading $DESC" "$NAME"
-    d_reload
-    log_end_msg $?
-    ;;
-  restart)
-    $0 stop
-    $0 start
-    ;;
-  status)
-    status_of_proc -p $PIDFILE $DAEMON $NAME && exit 0 || exit $?
-    ;;
-  *)
-    echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload|status}" >&2
-    exit 1
-    ;;
-esac
-
-exit 0
diff --git a/meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager_1.22.16.bb b/meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager_1.22.16.bb
deleted file mode 100644
index 32cabd1c..00000000
--- a/meta-oniro-staging/recipes-connectivity/networkmanager/networkmanager_1.22.16.bb
+++ /dev/null
@@ -1,172 +0,0 @@
-SUMMARY = "NetworkManager"
-HOMEPAGE = "https://wiki.gnome.org/Projects/NetworkManager"
-SECTION = "net/misc"
-
-LICENSE = "GPLv2+ & LGPLv2.1+"
-LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
-                    file://COPYING.LGPL;md5=4fbd65380cdd255951079008b364516c \
-"
-
-DEPENDS = " \
-    intltool-native \
-    libxslt-native \
-    libnl \
-    libgudev \
-    util-linux \
-    libndp \
-    libnewt \
-    jansson \
-    curl \
-"
-
-inherit gnomebase gettext update-rc.d systemd bash-completion vala gobject-introspection gtk-doc update-alternatives upstream-version-is-even
-
-SRC_URI = " \
-    ${GNOME_MIRROR}/NetworkManager/${@gnome_verdir("${PV}")}/NetworkManager-${PV}.tar.xz \
-    file://${BPN}.initd \
-    file://0001-Fixed-configure.ac-Fix-pkgconfig-sysroot-locations.patch \
-    file://0002-Do-not-create-settings-settings-property-documentati.patch \
-    file://fix_reallocarray_check.patch \
-    file://fix-strerror_r.patch \
-"
-SRC_URI_append_libc-musl = " \
-    file://musl/0001-Fix-build-with-musl-systemd-specific.patch \
-    file://musl/0002-Fix-build-with-musl.patch \
-    file://musl/0003-Fix-build-with-musl-for-n-dhcp4.patch \
-    file://musl/0004-Fix-build-with-musl-systemd-specific.patch \
-"
-SRC_URI[sha256sum] = "377aa053752eaa304b72c9906f9efcd9fbd5f7f6cb4cd4ad72425a68982cffc6"
-
-S = "${WORKDIR}/NetworkManager-${PV}"
-
-EXTRA_OECONF = " \
-    --disable-ifcfg-rh \
-    --disable-more-warnings \
-    --with-iptables=${sbindir}/iptables \
-    --with-tests \
-    --with-nmtui=yes \
-    --with-udev-dir=${nonarch_base_libdir}/udev \
-"
-
-# stolen from https://github.com/void-linux/void-packages/blob/master/srcpkgs/NetworkManager/template
-# avoids:
-# | ../NetworkManager-1.16.0/libnm-core/nm-json.c:106:50: error: 'RTLD_DEEPBIND' undeclared (first use in this function); did you mean 'RTLD_DEFAULT'?
-CFLAGS_append_libc-musl = " \
-    -DRTLD_DEEPBIND=0 \
-"
-
-do_compile_prepend() {
-    export GIR_EXTRA_LIBS_PATH="${B}/libnm/.libs:${B}/libnm-glib/.libs:${B}/libnm-util/.libs"
-}
-
-PACKAGECONFIG ??= "nss ifupdown dhclient dnsmasq \
-    ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', bb.utils.contains('DISTRO_FEATURES', 'x11', 'consolekit', '', d), d)} \
-    ${@bb.utils.contains('DISTRO_FEATURES', 'bluetooth', 'bluez5', '', d)} \
-    ${@bb.utils.filter('DISTRO_FEATURES', 'wifi polkit', d)} \
-"
-PACKAGECONFIG[systemd] = " \
-    --with-systemdsystemunitdir=${systemd_unitdir}/system --with-session-tracking=systemd, \
-    --without-systemdsystemunitdir, \
-"
-PACKAGECONFIG[polkit] = "--enable-polkit,--disable-polkit,polkit"
-PACKAGECONFIG[bluez5] = "--enable-bluez5-dun,--disable-bluez5-dun,bluez5"
-# consolekit is not picked by shlibs, so add it to RDEPENDS too
-PACKAGECONFIG[consolekit] = "--with-session-tracking=consolekit,,consolekit,consolekit"
-PACKAGECONFIG[modemmanager] = "--with-modem-manager-1=yes,--with-modem-manager-1=no,modemmanager"
-PACKAGECONFIG[firewalld] = "--enable-firewalld-zone,--disable-firewalld-zone,firewalld"
-PACKAGECONFIG[ppp] = "--enable-ppp,--disable-ppp,ppp,ppp"
-# Use full featured dhcp client instead of internal one
-PACKAGECONFIG[dhclient] = "--with-dhclient=${base_sbindir}/dhclient,,,dhcp-client"
-PACKAGECONFIG[dnsmasq] = "--with-dnsmasq=${bindir}/dnsmasq"
-PACKAGECONFIG[nss] = "--with-crypto=nss,,nss"
-PACKAGECONFIG[resolvconf] = "--with-resolvconf=${base_sbindir}/resolvconf,,,resolvconf"
-PACKAGECONFIG[gnutls] = "--with-crypto=gnutls,,gnutls"
-PACKAGECONFIG[wifi] = "--enable-wifi=yes,--enable-wifi=no,,wpa-supplicant"
-PACKAGECONFIG[ifupdown] = "--enable-ifupdown,--disable-ifupdown"
-PACKAGECONFIG[qt4-x11-free] = "--enable-qt,--disable-qt,qt4-x11-free"
-PACKAGECONFIG[cloud-setup] = "--with-nm-cloud-setup=yes,--with-nm-cloud-setup=no"
-
-PACKAGES =+ " \
-  ${PN}-nmtui ${PN}-nmtui-doc \
-  ${PN}-adsl ${PN}-cloud-setup \
-"
-
-SYSTEMD_PACKAGES = "${PN} ${PN}-cloud-setup"
-
-FILES_${PN}-adsl = "${libdir}/NetworkManager/${PV}/libnm-device-plugin-adsl.so"
-
-FILES_${PN}-cloud-setup = " \
-    ${libexecdir}/nm-cloud-setup \
-    ${systemd_system_unitdir}/nm-cloud-setup.service \
-    ${systemd_system_unitdir}/nm-cloud-setup.timer \
-    ${libdir}/NetworkManager/dispatcher.d/90-nm-cloud-setup.sh \
-    ${libdir}/NetworkManager/dispatcher.d/no-wait.d/90-nm-cloud-setup.sh \
-"
-ALLOW_EMPTY_${PN}-cloud-setup = "1"
-SYSTEMD_SERVICE_${PN}-cloud-setup = "${@bb.utils.contains('PACKAGECONFIG', 'cloud-setup', 'nm-cloud-setup.service nm-cloud-setup.timer', '', d)}"
-
-FILES_${PN} += " \
-    ${libexecdir} \
-    ${libdir}/NetworkManager/${PV}/*.so \
-    ${libdir}/NetworkManager \
-    ${nonarch_libdir}/NetworkManager/conf.d \
-    ${nonarch_libdir}/NetworkManager/dispatcher.d \
-    ${nonarch_libdir}/NetworkManager/dispatcher.d/pre-down.d \
-    ${nonarch_libdir}/NetworkManager/dispatcher.d/pre-up.d \
-    ${nonarch_libdir}/NetworkManager/dispatcher.d/no-wait.d \
-    ${nonarch_libdir}/NetworkManager/VPN \
-    ${nonarch_libdir}/NetworkManager/system-connections \
-    ${datadir}/polkit-1 \
-    ${datadir}/dbus-1 \
-    ${nonarch_base_libdir}/udev/* \
-    ${systemd_system_unitdir} \
-    ${libdir}/pppd \
-"
-
-RRECOMMENDS_${PN} += "iptables \
-    ${@bb.utils.filter('PACKAGECONFIG', 'dnsmasq', d)} \
-"
-RCONFLICTS_${PN} = "connman"
-
-FILES_${PN}-dev += " \
-    ${datadir}/NetworkManager/gdb-cmd \
-    ${libdir}/pppd/*/*.la \
-    ${libdir}/NetworkManager/*.la \
-    ${libdir}/NetworkManager/${PV}/*.la \
-"
-
-FILES_${PN}-nmtui = " \
-    ${bindir}/nmtui \
-    ${bindir}/nmtui-edit \
-    ${bindir}/nmtui-connect \
-    ${bindir}/nmtui-hostname \
-"
-
-FILES_${PN}-nmtui-doc = " \
-    ${mandir}/man1/nmtui* \
-"
-
-INITSCRIPT_NAME = "network-manager"
-SYSTEMD_SERVICE_${PN} = "${@bb.utils.contains('PACKAGECONFIG', 'systemd', 'NetworkManager.service NetworkManager-dispatcher.service', '', d)}"
-
-ALTERNATIVE_PRIORITY = "100"
-ALTERNATIVE_${PN} = "${@bb.utils.contains('DISTRO_FEATURES','systemd','resolv-conf','',d)}"
-ALTERNATIVE_TARGET[resolv-conf] = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${sysconfdir}/resolv-conf.NetworkManager','',d)}"
-ALTERNATIVE_LINK_NAME[resolv-conf] = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${sysconfdir}/resolv.conf','',d)}"
-
-# Issue introduced in 1.26
-CVE_CHECK_WHITELIST = "CVE-2021-20297 "
-
-do_install_append() {
-    install -Dm 0755 ${WORKDIR}/${BPN}.initd ${D}${sysconfdir}/init.d/network-manager
-
-    rm -rf ${D}/run ${D}${localstatedir}/run
-
-    if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
-        # For read-only filesystem, do not create links during bootup
-        ln -sf ../run/NetworkManager/resolv.conf ${D}${sysconfdir}/resolv-conf.NetworkManager
-
-        # systemd v210 and newer do not need this rule file
-        rm ${D}/${nonarch_base_libdir}/udev/rules.d/84-nm-drivers.rules
-    fi
-}
-- 
GitLab