|
|
d226fa |
From 2eab63bff2624d154891c949bd815c1fe7082f60 Mon Sep 17 00:00:00 2001
|
|
|
d226fa |
From: Tobias Jungel <tobias.jungel@bisdn.de>
|
|
|
d226fa |
Date: Thu, 4 Aug 2016 10:01:43 +0200
|
|
|
d226fa |
Subject: [PATCH 1/2] route/addr: address attributes based on object
|
|
|
d226fa |
|
|
|
d226fa |
addr_id_attrs_get returned a fixed set of attributes for AF_INET. This
|
|
|
d226fa |
leads to an invalid cache in case the default cache manager is used.
|
|
|
d226fa |
|
|
|
d226fa |
The error was cause by nl_object_identical, which checkes the ce_mask
|
|
|
d226fa |
of an object against the req_attrs. For route/addr objects the ce_mask
|
|
|
d226fa |
may contain the ADDR_ATTR_PEER, but the addr_id_attrs_get always
|
|
|
d226fa |
includes this attribute. Thus nl_object_identical fails always in case
|
|
|
d226fa |
no peer exists, which is the default for local addresses.
|
|
|
d226fa |
|
|
|
d226fa |
Fixes: 83e851ca9c842ccb6dae411d3fff9c7e9561269a
|
|
|
d226fa |
|
|
|
d226fa |
https://github.com/thom311/libnl/pull/105
|
|
|
d226fa |
|
|
|
d226fa |
Signed-off-by: Thomas Haller <thaller@redhat.com>
|
|
|
d226fa |
(cherry picked from commit dfaba51b5b2b5ad7e3c4990c2af3f30acbe5f8d9)
|
|
|
d226fa |
---
|
|
|
d226fa |
lib/route/addr.c | 9 ++++++---
|
|
|
d226fa |
1 file changed, 6 insertions(+), 3 deletions(-)
|
|
|
d226fa |
|
|
|
d226fa |
diff --git a/lib/route/addr.c b/lib/route/addr.c
|
|
|
d226fa |
index b699c64..7d3ff39 100644
|
|
|
d226fa |
--- a/lib/route/addr.c
|
|
|
d226fa |
+++ b/lib/route/addr.c
|
|
|
d226fa |
@@ -467,12 +467,15 @@ static void addr_dump_stats(struct nl_object *obj, struct nl_dump_params *p)
|
|
|
d226fa |
static uint32_t addr_id_attrs_get(struct nl_object *obj)
|
|
|
d226fa |
{
|
|
|
d226fa |
struct rtnl_addr *addr = (struct rtnl_addr *)obj;
|
|
|
d226fa |
+ uint32_t rv;
|
|
|
d226fa |
|
|
|
d226fa |
switch (addr->a_family) {
|
|
|
d226fa |
case AF_INET:
|
|
|
d226fa |
- return (ADDR_ATTR_FAMILY | ADDR_ATTR_IFINDEX |
|
|
|
d226fa |
- ADDR_ATTR_LOCAL | ADDR_ATTR_PREFIXLEN |
|
|
|
d226fa |
- ADDR_ATTR_PEER);
|
|
|
d226fa |
+ rv = (ADDR_ATTR_FAMILY | ADDR_ATTR_IFINDEX |
|
|
|
d226fa |
+ ADDR_ATTR_LOCAL | ADDR_ATTR_PREFIXLEN);
|
|
|
d226fa |
+ if (addr->a_peer)
|
|
|
d226fa |
+ rv |= ADDR_ATTR_PEER;
|
|
|
d226fa |
+ return rv;
|
|
|
d226fa |
case AF_INET6:
|
|
|
d226fa |
return (ADDR_ATTR_FAMILY | ADDR_ATTR_IFINDEX |
|
|
|
d226fa |
ADDR_ATTR_LOCAL);
|
|
|
d226fa |
--
|
|
|
d226fa |
2.7.4
|
|
|
d226fa |
|
|
|
d226fa |
|
|
|
d226fa |
From f2ac27c8a513eaf6b838796aacf2ec444a2c1227 Mon Sep 17 00:00:00 2001
|
|
|
d226fa |
From: Thomas Haller <thaller@redhat.com>
|
|
|
d226fa |
Date: Sun, 14 Aug 2016 11:05:48 +0200
|
|
|
d226fa |
Subject: [PATCH 2/2] lib: capability NL_CAPABILITY_RTNL_ADDR_PEER_ID_FIX for
|
|
|
d226fa |
ID comparison of v4 addresses
|
|
|
d226fa |
|
|
|
d226fa |
The ID attributes for IPv4 addresses were broken which causes wrong
|
|
|
d226fa |
nl_object_identical() and cache lookup.
|
|
|
d226fa |
|
|
|
d226fa |
This capability shall indicate that the bug was fixed.
|
|
|
d226fa |
|
|
|
d226fa |
Signed-off-by: Thomas Haller <thaller@redhat.com>
|
|
|
d226fa |
(cherry picked from commit 99b1d8acf87bcb35efed49f412d54af682bf1738)
|
|
|
d226fa |
---
|
|
|
d226fa |
include/netlink/utils.h | 7 +++++++
|
|
|
d226fa |
lib/utils.c | 2 +-
|
|
|
d226fa |
2 files changed, 8 insertions(+), 1 deletion(-)
|
|
|
d226fa |
|
|
|
d226fa |
diff --git a/include/netlink/utils.h b/include/netlink/utils.h
|
|
|
d226fa |
index 3b10340..1115bb4 100644
|
|
|
d226fa |
--- a/include/netlink/utils.h
|
|
|
d226fa |
+++ b/include/netlink/utils.h
|
|
|
d226fa |
@@ -217,6 +217,13 @@ enum {
|
|
|
d226fa |
NL_CAPABILITY_VERSION_3_2_28 = 19,
|
|
|
d226fa |
#define NL_CAPABILITY_VERSION_3_2_28 NL_CAPABILITY_VERSION_3_2_28
|
|
|
d226fa |
|
|
|
d226fa |
+ /**
|
|
|
d226fa |
+ * After NL_CAPABILITY_RTNL_ADDR_PEER_FIX, a follow up regression to lookup
|
|
|
d226fa |
+ * IPv4 addresses in the cache was fixed (PR#105).
|
|
|
d226fa |
+ */
|
|
|
d226fa |
+ NL_CAPABILITY_RTNL_ADDR_PEER_ID_FIX = 20,
|
|
|
d226fa |
+#define NL_CAPABILITY_RTNL_ADDR_PEER_ID_FIX NL_CAPABILITY_RTNL_ADDR_PEER_ID_FIX
|
|
|
d226fa |
+
|
|
|
d226fa |
__NL_CAPABILITY_MAX,
|
|
|
d226fa |
NL_CAPABILITY_MAX = (__NL_CAPABILITY_MAX - 1),
|
|
|
d226fa |
#define NL_CAPABILITY_MAX NL_CAPABILITY_MAX
|
|
|
d226fa |
diff --git a/lib/utils.c b/lib/utils.c
|
|
|
d226fa |
index 3399c03..0f2a252 100644
|
|
|
d226fa |
--- a/lib/utils.c
|
|
|
d226fa |
+++ b/lib/utils.c
|
|
|
d226fa |
@@ -1164,7 +1164,7 @@ int nl_has_capability (int capability)
|
|
|
d226fa |
NL_CAPABILITY_XFRM_SA_KEY_SIZE,
|
|
|
d226fa |
NL_CAPABILITY_RTNL_ADDR_PEER_FIX,
|
|
|
d226fa |
NL_CAPABILITY_VERSION_3_2_28,
|
|
|
d226fa |
- 0,
|
|
|
d226fa |
+ NL_CAPABILITY_RTNL_ADDR_PEER_ID_FIX,
|
|
|
d226fa |
0,
|
|
|
d226fa |
0,
|
|
|
d226fa |
0,
|
|
|
d226fa |
--
|
|
|
d226fa |
2.7.4
|
|
|
d226fa |
|