Blame SOURCES/0012-rh1261028-rtnl-neigh-get.patch

e3ad84
From 53d819c68d21accc815b59d887075b6e47e4c07f Mon Sep 17 00:00:00 2001
e3ad84
From: Thomas Graf <tgraf@suug.ch>
e3ad84
Date: Fri, 1 Feb 2013 10:41:45 +0100
e3ad84
Subject: [PATCH 1/2] neigh: Remove check for AF_UNSPEC in rtnl_neigh_get()
e3ad84
e3ad84
This check was introduces to not accidently return AF_BRIDGE objects
e3ad84
to unaware API users as they do differ in structure. However, such
e3ad84
objects are only available if explicitely requests using the
e3ad84
NL_CACHE_AF_ITER flag or by using arg1 == AF_BRIDGE for the cache.
e3ad84
e3ad84
Therefore remove this check and allow rtnl_neigh_get() to be used to
e3ad84
fetch any neighbor object of a cache.
e3ad84
e3ad84
Reported-by: Maxime Bizon <mbizon@freebox.fr>
e3ad84
Signed-off-by: Thomas Graf <tgraf@suug.ch>
e3ad84
(cherry picked from commit 8571f58f23763d8db7365d02c9b27832ad3d7005)
e3ad84
---
e3ad84
 lib/route/neigh.c | 4 ++--
e3ad84
 1 file changed, 2 insertions(+), 2 deletions(-)
e3ad84
e3ad84
diff --git a/lib/route/neigh.c b/lib/route/neigh.c
e3ad84
index c0f80a2..288bb85 100644
e3ad84
--- a/lib/route/neigh.c
e3ad84
+++ b/lib/route/neigh.c
e3ad84
@@ -532,6 +532,7 @@ int rtnl_neigh_alloc_cache(struct nl_sock *sock, struct nl_cache **result)
e3ad84
  * @arg cache		neighbour cache
e3ad84
  * @arg ifindex		interface index the neighbour is on
e3ad84
  * @arg dst		destination address of the neighbour
e3ad84
+ *
e3ad84
  * @return neighbour handle or NULL if no match was found.
e3ad84
  */
e3ad84
 struct rtnl_neigh * rtnl_neigh_get(struct nl_cache *cache, int ifindex,
e3ad84
@@ -540,8 +541,7 @@ struct rtnl_neigh * rtnl_neigh_get(struct nl_cache *cache, int ifindex,
e3ad84
 	struct rtnl_neigh *neigh;
e3ad84
 
e3ad84
 	nl_list_for_each_entry(neigh, &cache->c_items, ce_list) {
e3ad84
-		if (neigh->n_family == AF_UNSPEC &&
e3ad84
-		    neigh->n_ifindex == ifindex &&
e3ad84
+		if (neigh->n_ifindex == ifindex &&
e3ad84
 		    !nl_addr_cmp(neigh->n_dst, dst)) {
e3ad84
 			nl_object_get((struct nl_object *) neigh);
e3ad84
 			return neigh;
e3ad84
-- 
e3ad84
2.4.3
e3ad84
e3ad84
e3ad84
From 6212b5522f5b40110729cd3fe4ac9c3dcaa2eb88 Mon Sep 17 00:00:00 2001
e3ad84
From: Thomas Haller <thaller@redhat.com>
e3ad84
Date: Tue, 29 Sep 2015 18:32:23 +0200
e3ad84
Subject: [PATCH 2/2] route: add capability indicating the behavior of
e3ad84
 rtnl_neigh_get()
e3ad84
e3ad84
A wrong behavior for rtnl_neigh_get() was introduced between 3.2.14 and 3.2.15
e3ad84
(commit 64fcb47a36ec12d7e7f00605f6a8952ce985dd08).
e3ad84
e3ad84
It was later fixed between 3.2.21 and 3.2.22
e3ad84
(commit 8571f58f23763d8db7365d02c9b27832ad3d7005).
e3ad84
e3ad84
Add a capability NL_CAPABILITY_RTNL_NEIGH_GET_FILTER_AF_UNSPEC_FIX
e3ad84
to indicate that this buggy behavior was fixed.
e3ad84
e3ad84
https://bugzilla.redhat.com/show_bug.cgi?id=1261028
e3ad84
http://lists.infradead.org/pipermail/libnl/2015-August/001951.html
e3ad84
Signed-off-by: Thomas Haller <thaller@redhat.com>
e3ad84
(cherry picked from commit 2a8a7c31e6accf1a22caebace8da4c03028d5500)
e3ad84
---
e3ad84
 include/netlink/utils.h | 8 ++++++++
e3ad84
 lib/utils.c             | 9 +++++++++
e3ad84
 2 files changed, 17 insertions(+)
e3ad84
e3ad84
diff --git a/include/netlink/utils.h b/include/netlink/utils.h
e3ad84
index 5b0d275..4b15372 100644
e3ad84
--- a/include/netlink/utils.h
e3ad84
+++ b/include/netlink/utils.h
e3ad84
@@ -99,6 +99,14 @@ enum {
e3ad84
 	NL_CAPABILITY_NL_CONNECT_RETRY_GENERATE_PORT_ON_ADDRINUSE = 4,
e3ad84
 #define NL_CAPABILITY_NL_CONNECT_RETRY_GENERATE_PORT_ON_ADDRINUSE NL_CAPABILITY_NL_CONNECT_RETRY_GENERATE_PORT_ON_ADDRINUSE
e3ad84
 
e3ad84
+	/**
e3ad84
+	 * Between 3.2.14 (64fcb47a36ec12d7e7f00605f6a8952ce985dd08) and 3.2.22 (8571f58f23763d8db7365d02c9b27832ad3d7005),
e3ad84
+	 * rtnl_neigh_get() behaved differently and only returned objects with family AF_UNSPEC.
e3ad84
+	 * This capability indicates, that the function was fixed. The absense of the capability,
e3ad84
+	 * doesn't indicate however which behavior the function will have. So beware. */
e3ad84
+	NL_CAPABILITY_RTNL_NEIGH_GET_FILTER_AF_UNSPEC_FIX = 10,
e3ad84
+#define NL_CAPABILITY_RTNL_NEIGH_GET_FILTER_AF_UNSPEC_FIX NL_CAPABILITY_RTNL_NEIGH_GET_FILTER_AF_UNSPEC_FIX
e3ad84
+
e3ad84
 	__NL_CAPABILITY_MAX
e3ad84
 #define NL_CAPABILITY_MAX                               (__NL_CAPABILITY_MAX - 1)
e3ad84
 };
e3ad84
diff --git a/lib/utils.c b/lib/utils.c
e3ad84
index 5149e07..6b6a87c 100644
e3ad84
--- a/lib/utils.c
e3ad84
+++ b/lib/utils.c
e3ad84
@@ -1143,6 +1143,15 @@ int nl_has_capability (int capability)
e3ad84
 			0,
e3ad84
 			0,
e3ad84
 			0),
e3ad84
+		_NL_SET(1,
e3ad84
+			0,
e3ad84
+			NL_CAPABILITY_RTNL_NEIGH_GET_FILTER_AF_UNSPEC_FIX,
e3ad84
+			0,
e3ad84
+			0,
e3ad84
+			0,
e3ad84
+			0,
e3ad84
+			0,
e3ad84
+			0),
e3ad84
 #undef _NL_SET
e3ad84
 #undef _NL_SETV
e3ad84
 #undef _NL_ASSERT
e3ad84
-- 
e3ad84
2.4.3
e3ad84