summaryrefslogtreecommitdiffstats
path: root/lib/route
diff options
context:
space:
mode:
authort0mmmy90 <>2021-07-22 11:01:10 (GMT)
committerThomas Haller <thaller@redhat.com>2022-03-04 09:42:44 (GMT)
commit03bfd2fec97f4ebbadab32f0bb26db6d8c33b51c (patch)
tree320eb52a23ded304ad88f6677bb3f14b432cf262 /lib/route
parent92c92379fee08bfc6c68636b8a5ed54790fa3c42 (diff)
downloadlibnl-03bfd2fec97f4ebbadab32f0bb26db6d8c33b51c.zip
libnl-03bfd2fec97f4ebbadab32f0bb26db6d8c33b51c.tar.gz
libnl-03bfd2fec97f4ebbadab32f0bb26db6d8c33b51c.tar.bz2
route: check if nh exists while updating route
Diffstat (limited to 'lib/route')
-rw-r--r--lib/route/route_obj.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/route/route_obj.c b/lib/route/route_obj.c
index a09598a..cd58b85 100644
--- a/lib/route/route_obj.c
+++ b/lib/route/route_obj.c
@@ -500,8 +500,17 @@ static int route_update(struct nl_object *old_obj, struct nl_object *new_obj)
switch(action) {
case RTM_NEWROUTE : {
struct rtnl_nexthop *cloned_nh;
+ struct rtnl_nexthop *old_nh;
/*
+ * Do not add the nexthop to old route if it was already added before
+ */
+ nl_list_for_each_entry(old_nh, &old_route->rt_nexthops, rtnh_list) {
+ if (!rtnl_route_nh_compare(old_nh, new_nh, ~0, 0)) {
+ return -NLE_OPNOTSUPP;
+ }
+ }
+ /*
* Add the nexthop to old route
*/
cloned_nh = rtnl_route_nh_clone(new_nh);