|
|
4c8f2e |
From bead44cba8cb487d1dee88a7aff832c418657d64 Mon Sep 17 00:00:00 2001
|
|
|
4c8f2e |
From: Thomas Haller <thaller@redhat.com>
|
|
|
4c8f2e |
Date: Thu, 13 Feb 2014 21:31:37 +0100
|
|
|
4c8f2e |
Subject: [PATCH 1/2] route: rtnl_route_build_msg() should not overwrite the
|
|
|
4c8f2e |
route scope
|
|
|
4c8f2e |
|
|
|
4c8f2e |
rtnl_route_build_msg() should allow the user to set the route scope
|
|
|
4c8f2e |
explicitly to RT_SCOPE_NOWHERE.
|
|
|
4c8f2e |
|
|
|
4c8f2e |
This is useful for IPv4 routes, because when deleting a route,
|
|
|
4c8f2e |
the kernel requires the scope to match, unless the scope is set to
|
|
|
4c8f2e |
RT_SCOPE_NOWHERE. Thus by setting the scope to RT_SCOPE_NOWHERE,
|
|
|
4c8f2e |
the user can delete a route, even without knowing its scope.
|
|
|
4c8f2e |
|
|
|
4c8f2e |
rtnl_route_build_msg() should only try to guess the scope, if it was
|
|
|
4c8f2e |
not explicitly specified.
|
|
|
4c8f2e |
|
|
|
4c8f2e |
Signed-off-by: Thomas Haller <thaller@redhat.com>
|
|
|
4c8f2e |
Acked-by: Thomas Graf <tgraf@suug.ch>
|
|
|
4c8f2e |
(cherry picked from commit 85ec9c7ad80c60f4f619472f2bb9d9595da93b26)
|
|
|
4c8f2e |
---
|
|
|
4c8f2e |
lib/route/route_obj.c | 2 +-
|
|
|
4c8f2e |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
4c8f2e |
|
|
|
4c8f2e |
diff --git a/lib/route/route_obj.c b/lib/route/route_obj.c
|
|
|
4c8f2e |
index 8f1e515..57b8f23 100644
|
|
|
4c8f2e |
--- a/lib/route/route_obj.c
|
|
|
4c8f2e |
+++ b/lib/route/route_obj.c
|
|
|
4c8f2e |
@@ -1194,7 +1194,7 @@ int rtnl_route_build_msg(struct nl_msg *msg, struct rtnl_route *route)
|
|
|
4c8f2e |
if (route->rt_src)
|
|
|
4c8f2e |
rtmsg.rtm_src_len = nl_addr_get_prefixlen(route->rt_src);
|
|
|
4c8f2e |
|
|
|
4c8f2e |
- if (rtmsg.rtm_scope == RT_SCOPE_NOWHERE)
|
|
|
4c8f2e |
+ if (!(route->ce_mask & ROUTE_ATTR_SCOPE))
|
|
|
4c8f2e |
rtmsg.rtm_scope = rtnl_route_guess_scope(route);
|
|
|
4c8f2e |
|
|
|
4c8f2e |
if (rtnl_route_get_nnexthops(route) == 1) {
|
|
|
4c8f2e |
--
|
|
|
4c8f2e |
1.8.5.3
|
|
|
4c8f2e |
|
|
|
4c8f2e |
|
|
|
4c8f2e |
From 5ee88135f410a9630321f10b8a2ea824c88b22ba Mon Sep 17 00:00:00 2001
|
|
|
4c8f2e |
From: Thomas Haller <thaller@redhat.com>
|
|
|
4c8f2e |
Date: Thu, 13 Mar 2014 13:16:51 +0100
|
|
|
4c8f2e |
Subject: [PATCH 2/2] utils: indicate capability
|
|
|
4c8f2e |
NL_CAPABILITY_ROUTE_BUILD_MSG_SET_SCOPE
|
|
|
4c8f2e |
|
|
|
4c8f2e |
This capability indicates that libnl does no longer overwrites
|
|
|
4c8f2e |
the route scope in rtnl_route_build_msg(), as fixed by commit
|
|
|
4c8f2e |
85ec9c7ad80c60f4f619472f2bb9d9595da93b26.
|
|
|
4c8f2e |
|
|
|
4c8f2e |
Acked-by: Thomas Graf <tgraf@suug.ch>
|
|
|
4c8f2e |
Signed-off-by: Thomas Haller <thaller@redhat.com>
|
|
|
4c8f2e |
(cherry picked from commit 015c4ee59b786fec35118c2a963532b3e05ba5a2)
|
|
|
4c8f2e |
---
|
|
|
4c8f2e |
include/netlink/utils.h | 8 ++++++++
|
|
|
4c8f2e |
lib/utils.c | 9 +++++++++
|
|
|
4c8f2e |
2 files changed, 17 insertions(+)
|
|
|
4c8f2e |
|
|
|
4c8f2e |
diff --git a/include/netlink/utils.h b/include/netlink/utils.h
|
|
|
4c8f2e |
index da46a55..2094bb4 100644
|
|
|
4c8f2e |
--- a/include/netlink/utils.h
|
|
|
4c8f2e |
+++ b/include/netlink/utils.h
|
|
|
4c8f2e |
@@ -82,6 +82,14 @@ extern void nl_dump_line(struct nl_dump_params *, const char *, ...);
|
|
|
4c8f2e |
enum {
|
|
|
4c8f2e |
NL_CAPABILITY_NONE,
|
|
|
4c8f2e |
|
|
|
4c8f2e |
+ /**
|
|
|
4c8f2e |
+ * rtnl_route_build_msg() no longer guesses the route scope
|
|
|
4c8f2e |
+ * if explicitly set to RT_SCOPE_NOWHERE.
|
|
|
4c8f2e |
+ * @ingroup utils
|
|
|
4c8f2e |
+ */
|
|
|
4c8f2e |
+ NL_CAPABILITY_ROUTE_BUILD_MSG_SET_SCOPE = 1,
|
|
|
4c8f2e |
+#define NL_CAPABILITY_ROUTE_BUILD_MSG_SET_SCOPE NL_CAPABILITY_ROUTE_BUILD_MSG_SET_SCOPE
|
|
|
4c8f2e |
+
|
|
|
4c8f2e |
__NL_CAPABILITY_MAX
|
|
|
4c8f2e |
#define NL_CAPABILITY_MAX (__NL_CAPABILITY_MAX - 1)
|
|
|
4c8f2e |
};
|
|
|
4c8f2e |
diff --git a/lib/utils.c b/lib/utils.c
|
|
|
4c8f2e |
index 7354956..d7f6724 100644
|
|
|
4c8f2e |
--- a/lib/utils.c
|
|
|
4c8f2e |
+++ b/lib/utils.c
|
|
|
4c8f2e |
@@ -1129,6 +1129,15 @@ int nl_has_capability (int capability)
|
|
|
4c8f2e |
_NL_SETV((i), 1, (v1)) | _NL_SETV((i), 5, (v5)) | \
|
|
|
4c8f2e |
_NL_SETV((i), 2, (v2)) | _NL_SETV((i), 6, (v6)) | \
|
|
|
4c8f2e |
_NL_SETV((i), 3, (v3)) | _NL_SETV((i), 7, (v7)) )
|
|
|
4c8f2e |
+ _NL_SET(0,
|
|
|
4c8f2e |
+ NL_CAPABILITY_ROUTE_BUILD_MSG_SET_SCOPE,
|
|
|
4c8f2e |
+ 0,
|
|
|
4c8f2e |
+ 0,
|
|
|
4c8f2e |
+ 0,
|
|
|
4c8f2e |
+ 0,
|
|
|
4c8f2e |
+ 0,
|
|
|
4c8f2e |
+ 0,
|
|
|
4c8f2e |
+ 0),
|
|
|
4c8f2e |
#undef _NL_SET
|
|
|
4c8f2e |
#undef _NL_SETV
|
|
|
4c8f2e |
#undef _NL_ASSERT
|
|
|
4c8f2e |
--
|
|
|
4c8f2e |
1.8.5.3
|
|
|
4c8f2e |
|