diff options
author | Quentin Young <qlyoung@users.noreply.github.com> | 2021-11-22 15:33:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-22 15:33:52 +0100 |
commit | 7b532137c399fdd0bc9981cb6d749299f1ed56b2 (patch) | |
tree | 63b3eee71f70ed4ba704387f10cd7e3d88220c50 /ospf6d | |
parent | Merge pull request #10083 from karelvanhecke/master (diff) | |
parent | ospf6d: replace memcmp with correct comparisons (diff) | |
download | frr-7b532137c399fdd0bc9981cb6d749299f1ed56b2.tar.xz frr-7b532137c399fdd0bc9981cb6d749299f1ed56b2.zip |
Merge pull request #10070 from idryzhov/ospf6-memcmp-cleanup
Diffstat (limited to 'ospf6d')
-rw-r--r-- | ospf6d/ospf6_route.c | 21 | ||||
-rw-r--r-- | ospf6d/ospf6_route.h | 15 |
2 files changed, 4 insertions, 32 deletions
diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c index 35b567c76..92fcbf71e 100644 --- a/ospf6d/ospf6_route.c +++ b/ospf6d/ospf6_route.c @@ -704,27 +704,6 @@ struct ospf6_route *ospf6_route_add(struct ospf6_route *route, } if (old) { - /* if route does not actually change, return unchanged */ - if (ospf6_route_is_identical(old, route)) { - if (IS_OSPF6_DEBUG_ROUTE(MEMORY)) - zlog_debug( - "%s %p: route add %p: needless update of %p old cost %u", - ospf6_route_table_name(table), - (void *)table, (void *)route, - (void *)old, old->path.cost); - else if (IS_OSPF6_DEBUG_ROUTE(TABLE)) - zlog_debug("%s: route add: needless update", - ospf6_route_table_name(table)); - - ospf6_route_delete(route); - SET_FLAG(old->flag, OSPF6_ROUTE_ADD); - ospf6_route_table_assert(table); - - /* to free the lookup lock */ - route_unlock_node(node); - return old; - } - if (IS_OSPF6_DEBUG_ROUTE(MEMORY)) zlog_debug( "%s %p: route add %p cost %u paths %u nh %u: update of %p cost %u paths %u nh %u", diff --git a/ospf6d/ospf6_route.h b/ospf6d/ospf6_route.h index fd8b6a9c1..633b8d77c 100644 --- a/ospf6d/ospf6_route.h +++ b/ospf6d/ospf6_route.h @@ -291,20 +291,13 @@ extern const char *const ospf6_path_type_substr[OSPF6_PATH_TYPE_MAX]; #define OSPF6_ROUTE_PREFIX_STR "Display the route\n" #define OSPF6_ROUTE_MATCH_STR "Display the route matches the prefix\n" -#define ospf6_route_is_prefix(p, r) \ - (memcmp(p, &(r)->prefix, sizeof(struct prefix)) == 0) +#define ospf6_route_is_prefix(p, r) (prefix_same(p, &(r)->prefix)) #define ospf6_route_is_same(ra, rb) (prefix_same(&(ra)->prefix, &(rb)->prefix)) #define ospf6_route_is_same_origin(ra, rb) \ ((ra)->path.area_id == (rb)->path.area_id \ - && memcmp(&(ra)->path.origin, &(rb)->path.origin, \ - sizeof(struct ospf6_ls_origin)) \ - == 0) -#define ospf6_route_is_identical(ra, rb) \ - ((ra)->type == (rb)->type \ - && memcmp(&(ra)->prefix, &(rb)->prefix, sizeof(struct prefix)) == 0 \ - && memcmp(&(ra)->path, &(rb)->path, sizeof(struct ospf6_path)) == 0 \ - && listcount(ra->paths) == listcount(rb->paths) \ - && ospf6_route_cmp_nexthops(ra, rb) == 0) + && (ra)->path.origin.type == (rb)->path.origin.type \ + && (ra)->path.origin.id == (rb)->path.origin.id \ + && (ra)->path.origin.adv_router == (rb)->path.origin.adv_router) #define ospf6_route_is_best(r) (CHECK_FLAG ((r)->flag, OSPF6_ROUTE_BEST)) |