Upgrade libnl to libnl3_10_0 am: f8397ff3c3 am: 72ca5a0e7c

Original change: https://android-review.googlesource.com/c/platform/external/libnl/+/3185579

Change-Id: Ieb878f96c9a87047b50984df1698d60e25e327ba
Signed-off-by: Automerger Merge Worker <[email protected]>
diff --git a/METADATA b/METADATA
index 8b03e00..386cee3 100644
--- a/METADATA
+++ b/METADATA
@@ -8,13 +8,13 @@
   license_type: RESTRICTED
   last_upgrade_date {
     year: 2024
-    month: 6
-    day: 4
+    month: 7
+    day: 19
   }
   homepage: "https://github.com/thom311/libnl"
   identifier {
     type: "Git"
     value: "https://github.com/thom311/libnl.git"
-    version: "5248e1a45576617b349465997822cef34cbc5053"
+    version: "libnl3_10_0"
   }
 }
diff --git a/configure.ac b/configure.ac
index 4db4385..91d4ae3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6,7 +6,7 @@
 
 # copied from glib
 m4_define([libnl_major_version], [3])
-m4_define([libnl_minor_version], [9])
+m4_define([libnl_minor_version], [10])
 m4_define([libnl_micro_version], [0])
 m4_define([libnl_git_sha], [m4_esyscmd([ ( [ -d ./.git/ ] && [ "$(readlink -f ./.git/)" = "$(readlink -f "$(git rev-parse --git-dir 2>/dev/null)" 2>/dev/null)" ] && git rev-parse --verify -q HEAD 2>/dev/null ) || true ])])
 
diff --git a/doc/configure.ac b/doc/configure.ac
index c16e20e..5b4fd4e 100644
--- a/doc/configure.ac
+++ b/doc/configure.ac
@@ -3,7 +3,7 @@
 # Copyright (c) 2003-2013 Thomas Graf <[email protected]>
 #
 
-AC_INIT(libnl-doc, [3.9.0], [http://www.infradead.org/~tgr/libnl/])
+AC_INIT(libnl-doc, [3.10.0], [http://www.infradead.org/~tgr/libnl/])
 AC_CONFIG_MACRO_DIR([../m4])
 AC_CONFIG_AUX_DIR([build-aux])
 AM_INIT_AUTOMAKE([foreign])
diff --git a/doc/doxygen-link.py b/doc/doxygen-link.py
index 2dcd5f0..1f424fc 100755
--- a/doc/doxygen-link.py
+++ b/doc/doxygen-link.py
@@ -43,4 +43,6 @@
 rc = re.compile(r"\b(" + "|".join(map(re.escape, sorted(links, reverse=True))) + r")\b")
 
 for line in open(sys.argv[2], "r"):
-    print(rc.sub(translate, line), end="")
+    if links:
+        line = rc.sub(translate, line)
+    print(line, end="")
diff --git a/include/netlink/utils.h b/include/netlink/utils.h
index b3a5951..ac91d4c 100644
--- a/include/netlink/utils.h
+++ b/include/netlink/utils.h
@@ -349,6 +349,12 @@
 	NL_CAPABILITY_VERSION_3_12_0 = 38,
 #define NL_CAPABILITY_VERSION_3_12_0 NL_CAPABILITY_VERSION_3_12_0
 
+	/**
+	 * The library version is libnl3 3.13.0 or newer. This capability should never be backported.
+	 */
+	NL_CAPABILITY_VERSION_3_13_0 = 39,
+#define NL_CAPABILITY_VERSION_3_13_0 NL_CAPABILITY_VERSION_3_13_0
+
 	__NL_CAPABILITY_MAX,
 	NL_CAPABILITY_MAX = (__NL_CAPABILITY_MAX - 1),
 #define NL_CAPABILITY_MAX NL_CAPABILITY_MAX
diff --git a/lib/nl.c b/lib/nl.c
index a24c026..1225eba 100644
--- a/lib/nl.c
+++ b/lib/nl.c
@@ -486,7 +486,7 @@
 		nlh->nlmsg_pid = nl_socket_get_local_port(sk);
 
 	if (nlh->nlmsg_seq == NL_AUTO_SEQ)
-		nlh->nlmsg_seq = sk->s_seq_next++;
+		nlh->nlmsg_seq = nl_socket_use_seq(sk);
 
 	if (msg->nm_protocol == -1)
 		msg->nm_protocol = sk->s_proto;
diff --git a/lib/socket.c b/lib/socket.c
index 742cdac..4e64cbb 100644
--- a/lib/socket.c
+++ b/lib/socket.c
@@ -24,6 +24,7 @@
 #include "nl-default.h"
 
 #include <fcntl.h>
+#include <limits.h>
 #include <sys/socket.h>
 
 #include <netlink/netlink.h>
@@ -316,6 +317,10 @@
  */
 unsigned int nl_socket_use_seq(struct nl_sock *sk)
 {
+	if (sk->s_seq_next == UINT_MAX) {
+		sk->s_seq_next = 0;
+		return UINT_MAX;
+	}
 	return sk->s_seq_next++;
 }
 
diff --git a/lib/utils.c b/lib/utils.c
index 679078e..41ff8eb 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -1284,10 +1284,10 @@
 			NL_CAPABILITY_VERSION_3_7_0,
 			NL_CAPABILITY_VERSION_3_8_0,
 			NL_CAPABILITY_VERSION_3_9_0,
-			0, /* NL_CAPABILITY_VERSION_3_10_0 */
+			NL_CAPABILITY_VERSION_3_10_0,
 			0, /* NL_CAPABILITY_VERSION_3_11_0 */
 			0, /* NL_CAPABILITY_VERSION_3_12_0 */
-			0,
+			0, /* NL_CAPABILITY_VERSION_3_13_0 */
 			0),
 		/* IMPORTANT: these capability numbers are intended to be universal and stable
 		 * for libnl3. Don't allocate new numbers on your own that differ from upstream
diff --git a/python/netlink/route/tc.py b/python/netlink/route/tc.py
index daad697..eb0037e 100644
--- a/python/netlink/route/tc.py
+++ b/python/netlink/route/tc.py
@@ -596,7 +596,7 @@
 
 def get_cls(ifindex, parent, handle=None):
 
-    chain = _cls_cache.get(ifindex, dict())
+    chain = _cls_cache.get(ifindex, {})
 
     try:
         cache = chain[parent]
@@ -607,6 +607,6 @@
     cache.refill()
 
     if handle is None:
-        return [cls for cls in cache]
+        return list(cache)
 
     return [cls for cls in cache if cls.handle == handle]
diff --git a/python/netlink/util.py b/python/netlink/util.py
index afe7ef0..3adc509 100644
--- a/python/netlink/util.py
+++ b/python/netlink/util.py
@@ -103,7 +103,7 @@
         if not isinstance(value, property):
             raise ValueError("Invalid formatting string {0}".format(key))
 
-        d = getattr(value.fget, "formatinfo", dict())
+        d = getattr(value.fget, "formatinfo", {})
 
         # value = value.fget() is exactly the same
         value = getattr(self._obj, key)