mirror of
https://github.com/openharmony/third_party_libnl.git
synced 2026-07-01 06:41:52 -04:00
ef5fd49261
Signed-off-by: Bruin06 <419738327@qq.com> Signed-off-by: Bruin06 <15325335+bruin06@user.noreply.gitee.com>
237 lines
7.5 KiB
Diff
237 lines
7.5 KiB
Diff
diff -urN libnl/lib/utils.c libnl-libnl3_11_0-new/lib/utils.c
|
|
--- libnl/lib/utils.c 2024-10-30 15:13:01.000000000 +0800
|
|
+++ libnl-libnl3_11_0-new/lib/utils.c 2025-06-18 10:02:10.472222700 +0800
|
|
@@ -279,8 +279,8 @@
|
|
|
|
int nl_rate2str(unsigned long long rate, int type, char *buf, size_t len)
|
|
{
|
|
- char *unit;
|
|
- double frac;
|
|
+ char *unit = NULL;
|
|
+ double frac = 0.0;
|
|
|
|
switch (type) {
|
|
case NL_BYTE_RATE:
|
|
@@ -427,6 +427,7 @@
|
|
}
|
|
|
|
BUG();
|
|
+ return buf;
|
|
}
|
|
|
|
/**
|
|
diff -urN libnl/lib/route/mdb.c libnl-libnl3_11_0-new/lib/route/mdb.c
|
|
--- libnl/lib/route/mdb.c 2024-10-30 15:13:01.000000000 +0800
|
|
+++ libnl-libnl3_11_0-new/lib/route/mdb.c 2025-06-18 10:08:22.230880000 +0800
|
|
@@ -5,7 +5,7 @@
|
|
|
|
#include "nl-default.h"
|
|
|
|
-#include <linux/if_bridge.h>
|
|
+#include <linux-private/linux/if_bridge.h>
|
|
|
|
#include <netlink/netlink.h>
|
|
#include <netlink/route/mdb.h>
|
|
diff -urN libnl/lib/route/neigh.c libnl-libnl3_11_0-new/lib/route/neigh.c
|
|
--- libnl/lib/route/neigh.c 2024-10-30 15:13:01.000000000 +0800
|
|
+++ libnl-libnl3_11_0-new/lib/route/neigh.c 2025-06-18 10:14:10.647307300 +0800
|
|
@@ -461,10 +461,12 @@
|
|
neigh->ce_mask |= NEIGH_ATTR_NHID;
|
|
}
|
|
|
|
+#ifdef OPEN_HARMONY_UPDATE_ADAPT_KERNEL_VERSION
|
|
if (tb[NDA_FLAGS_EXT]) {
|
|
neigh->n_ext_flags = nla_get_u32(tb[NDA_FLAGS_EXT]);
|
|
neigh->ce_mask |= NEIGH_ATTR_EXT_FLAGS;
|
|
}
|
|
+#endif
|
|
|
|
/*
|
|
* Get the bridge index for AF_BRIDGE family entries
|
|
@@ -777,6 +779,7 @@
|
|
if (tmpl->ce_mask & NEIGH_ATTR_NHID)
|
|
NLA_PUT_U32(msg, NDA_NH_ID, tmpl->n_nhid);
|
|
|
|
+#ifdef OPEN_HARMONY_UPDATE_ADAPT_KERNEL_VERSION
|
|
if (tmpl->ce_mask & NEIGH_ATTR_EXT_FLAGS) {
|
|
/* The kernel does not allow setting the locked flag from
|
|
* userspace, so unset it in the request. */
|
|
@@ -786,6 +789,7 @@
|
|
if (ext_flags)
|
|
NLA_PUT_U32(msg, NDA_FLAGS_EXT, ext_flags);
|
|
}
|
|
+#endif
|
|
|
|
*result = msg;
|
|
return 0;
|
|
diff -urN libnl/lib/route/link/bridge.c libnl-libnl3_11_0-new/lib/route/link/bridge.c
|
|
--- libnl/lib/route/link/bridge.c 2024-10-30 15:13:01.000000000 +0800
|
|
+++ libnl-libnl3_11_0-new/lib/route/link/bridge.c 2025-06-18 10:21:45.632085400 +0800
|
|
@@ -13,7 +13,7 @@
|
|
|
|
#include "nl-default.h"
|
|
|
|
-#include <linux/if_bridge.h>
|
|
+#include <linux-private/linux/if_bridge.h>
|
|
#include <linux/rtnetlink.h>
|
|
|
|
#include <netlink/netlink.h>
|
|
@@ -40,6 +40,7 @@
|
|
#define BRIDGE_ATTR_MST (1UL << 7)
|
|
|
|
#define PRIV_FLAG_NEW_ATTRS (1UL << 0)
|
|
+#define RTEXT_FILTER_MST (1 << 7)
|
|
|
|
struct bridge_data
|
|
{
|
|
@@ -248,9 +249,11 @@
|
|
[IFLA_BRPORT_BCAST_FLOOD] = { .type = NLA_U8 },
|
|
[IFLA_BRPORT_NEIGH_SUPPRESS] = { .type = NLA_U8 },
|
|
[IFLA_BRPORT_ISOLATED] = { .type = NLA_U8 },
|
|
+#ifdef OPEN_HARMONY_UPDATE_ADAPT_KERNEL_VERSION
|
|
[IFLA_BRPORT_LOCKED] = { .type = NLA_U8 },
|
|
[IFLA_BRPORT_MAB] = { .type = NLA_U8 },
|
|
[IFLA_BRPORT_NEIGH_VLAN_SUPPRESS] = { .type = NLA_U8 },
|
|
+#endif
|
|
};
|
|
|
|
static void check_flag(struct rtnl_link *link, struct nlattr *attrs[],
|
|
@@ -322,10 +325,12 @@
|
|
check_flag(link, br_attrs, IFLA_BRPORT_NEIGH_SUPPRESS,
|
|
RTNL_BRIDGE_NEIGH_SUPPRESS);
|
|
check_flag(link, br_attrs, IFLA_BRPORT_ISOLATED, RTNL_BRIDGE_ISOLATED);
|
|
+#ifdef OPEN_HARMONY_UPDATE_ADAPT_KERNEL_VERSION
|
|
check_flag(link, br_attrs, IFLA_BRPORT_LOCKED, RTNL_BRIDGE_LOCKED);
|
|
check_flag(link, br_attrs, IFLA_BRPORT_MAB, RTNL_BRIDGE_MAB);
|
|
check_flag(link, br_attrs, IFLA_BRPORT_NEIGH_VLAN_SUPPRESS,
|
|
RTNL_BRIDGE_NEIGH_VLAN_SUPPRESS);
|
|
+#endif
|
|
|
|
return 0;
|
|
}
|
|
@@ -720,6 +725,7 @@
|
|
NLA_PUT_U8(msg, IFLA_BRPORT_ISOLATED,
|
|
!!(bd->b_flags & RTNL_BRIDGE_ISOLATED));
|
|
}
|
|
+#ifdef OPEN_HARMONY_UPDATE_ADAPT_KERNEL_VERSION
|
|
if (bd->b_flags_mask & RTNL_BRIDGE_LOCKED) {
|
|
NLA_PUT_U8(msg, IFLA_BRPORT_LOCKED,
|
|
!!(bd->b_flags & RTNL_BRIDGE_LOCKED));
|
|
@@ -733,6 +739,7 @@
|
|
!!(bd->b_flags &
|
|
RTNL_BRIDGE_NEIGH_VLAN_SUPPRESS));
|
|
}
|
|
+#endif
|
|
}
|
|
|
|
if (bd->ce_mask & BRIDGE_ATTR_COST)
|
|
diff -urN libnl/include/base/nl-base-utils.h libnl-libnl3_11_0-new/include/base/nl-base-utils.h
|
|
--- libnl/include/base/nl-base-utils.h 2024-10-30 15:13:01.000000000 +0800
|
|
+++ libnl-libnl3_11_0-new/include/base/nl-base-utils.h 2025-06-18 10:32:27.489011600 +0800
|
|
@@ -20,6 +20,11 @@
|
|
#include <netinet/in.h>
|
|
#include <arpa/inet.h>
|
|
|
|
+#define NTF_EXT_MANAGED (1 << 0)
|
|
+#define NTF_EXT_LOCKED (1 << 1)
|
|
+
|
|
+#define NDA_MAX (__NDA_MAX - 1)
|
|
+
|
|
#ifndef DISABLE_PTHREADS
|
|
#include <pthread.h>
|
|
#endif
|
|
@@ -162,10 +167,8 @@
|
|
|
|
#define _nl_assert_addr_family(addr_family) \
|
|
do { \
|
|
- typeof(addr_family) _addr_family = (addr_family); \
|
|
- \
|
|
- _nl_assert(_addr_family == AF_INET || \
|
|
- _addr_family == AF_INET6); \
|
|
+ _nl_assert(addr_family == AF_INET || \
|
|
+ addr_family == AF_INET6); \
|
|
} while (0)
|
|
|
|
/*****************************************************************************/
|
|
@@ -185,9 +188,11 @@
|
|
|
|
/*****************************************************************************/
|
|
|
|
+#ifndef ARRAY_SIZE
|
|
#define _NL_N_ELEMENTS(arr) (sizeof(arr) / sizeof((arr)[0]))
|
|
|
|
#define ARRAY_SIZE(arr) _NL_N_ELEMENTS(arr)
|
|
+#endif
|
|
|
|
/*****************************************************************************/
|
|
|
|
@@ -258,7 +263,7 @@
|
|
return _nl_memcmp(s1, s2, len) == 0;
|
|
}
|
|
|
|
-static inline void *_nl_memcpy(void *restrict dest, const void *restrict src,
|
|
+static inline void *_nl_memcpy(void *__restrict dest, const void *__restrict src,
|
|
size_t n)
|
|
{
|
|
/* Workaround undefined behavior in memcpy() with NULL pointers. */
|
|
@@ -703,7 +708,7 @@
|
|
static inline char *_nl_inet_ntop_dup(int addr_family, const void *addr)
|
|
{
|
|
return (char *)_nl_inet_ntop(addr_family, addr,
|
|
- malloc((addr_family == AF_INET) ?
|
|
+ (char *)malloc((addr_family == AF_INET) ?
|
|
INET_ADDRSTRLEN :
|
|
INET6_ADDRSTRLEN));
|
|
}
|
|
diff -urN libnl/include/config.h libnl-libnl3_11_0-new/include/config.h
|
|
--- libnl/include/config.h 2024-10-30 15:13:01.000000000 +0800
|
|
+++ libnl-libnl3_11_0-new/include/config.h 2025-06-18 10:32:27.489011600 +0800
|
|
@@ -6,11 +6,11 @@
|
|
|
|
/* Define to 1 if you have the declaration of `getprotobyname_r', and to 0 if
|
|
you don't. */
|
|
-#define HAVE_DECL_GETPROTOBYNAME_R 1
|
|
+#define HAVE_DECL_GETPROTOBYNAME_R 0
|
|
|
|
/* Define to 1 if you have the declaration of `getprotobynumber_r', and to 0
|
|
if you don't. */
|
|
-#define HAVE_DECL_GETPROTOBYNUMBER_R 1
|
|
+#define HAVE_DECL_GETPROTOBYNUMBER_R 0
|
|
|
|
/* Define to 1 if you have the <dlfcn.h> header file. */
|
|
#define HAVE_DLFCN_H 1
|
|
@@ -34,7 +34,7 @@
|
|
#define HAVE_STDLIB_H 1
|
|
|
|
/* Define to 1 if you have the `strerror_l' function. */
|
|
-#define HAVE_STRERROR_L 1
|
|
+#define HAVE_STRERROR_L 0
|
|
|
|
/* Define to 1 if you have the <strings.h> header file. */
|
|
#define HAVE_STRINGS_H 1
|
|
diff -urN libnl/include/nl-priv-dynamic-core/nl-core.h libnl-libnl3_11_0-new/include/nl-priv-dynamic-core/nl-core.h
|
|
--- libnl/include/nl-priv-dynamic-core/nl-core.h 2024-10-30 15:13:01.000000000 +0800
|
|
+++ libnl-libnl3_11_0-new/include/nl-priv-dynamic-core/nl-core.h 2025-06-19 19:37:09.297502900 +0800
|
|
@@ -6,6 +6,8 @@
|
|
#ifndef __NL_SHARED_CORE_NL_CORE_H__
|
|
#define __NL_SHARED_CORE_NL_CORE_H__
|
|
|
|
+#include <base/nl-base-utils.h>
|
|
+
|
|
#define NL_SOCK_PASSCRED (1 << 1)
|
|
#define NL_OWN_PORT (1 << 2)
|
|
#define NL_MSG_PEEK (1 << 3)
|
|
diff -urN libnl/src/lib/utils.c libnl-libnl3_11_0-new/src/lib/utils.c
|
|
--- libnl/src/lib/utils.c 2024-10-30 15:13:01.000000000 +0800
|
|
+++ libnl-libnl3_11_0-new/src/lib/utils.c 2025-09-01 21:06:31.381794800 +0800
|
|
@@ -222,9 +222,6 @@
|
|
{
|
|
char path[FILENAME_MAX+1];
|
|
|
|
- snprintf(path, sizeof(path), "%s/%s/%s.so",
|
|
- _NL_PKGLIBDIR, prefix, name);
|
|
-
|
|
#ifdef HAVE_DLFCN_H
|
|
{
|
|
void *handle;
|