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