Merge pull request #13067 from FRRouting/mergify/bp/stable/8.5/pr-13064

lib: fix clear route-map command (backport #13064)
This commit is contained in:
Donald Sharp 2023-03-21 06:59:44 -04:00 committed by GitHub
commit 8d2666fb03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View File

@ -36,6 +36,8 @@
#include "json.h" #include "json.h"
#include "jhash.h" #include "jhash.h"
#include "lib/routemap_clippy.c"
DEFINE_MTYPE_STATIC(LIB, ROUTE_MAP, "Route map"); DEFINE_MTYPE_STATIC(LIB, ROUTE_MAP, "Route map");
DEFINE_MTYPE(LIB, ROUTE_MAP_NAME, "Route map name"); DEFINE_MTYPE(LIB, ROUTE_MAP_NAME, "Route map name");
DEFINE_MTYPE_STATIC(LIB, ROUTE_MAP_INDEX, "Route map index"); DEFINE_MTYPE_STATIC(LIB, ROUTE_MAP_INDEX, "Route map index");
@ -3097,27 +3099,24 @@ static void clear_route_map_helper(struct route_map *map)
index->applied_clear = index->applied; index->applied_clear = index->applied;
} }
DEFUN (rmap_clear_counters, DEFPY (rmap_clear_counters,
rmap_clear_counters_cmd, rmap_clear_counters_cmd,
"clear route-map counters [WORD]", "clear route-map counters [RMAP_NAME$rmapname]",
CLEAR_STR CLEAR_STR
"route-map information\n" "route-map information\n"
"counters associated with the specified route-map\n" "counters associated with the specified route-map\n"
"route-map name\n") "route-map name\n")
{ {
int idx_word = 2;
struct route_map *map; struct route_map *map;
const char *name = (argc == 3 ) ? argv[idx_word]->arg : NULL; if (rmapname) {
map = route_map_lookup_by_name(rmapname);
if (name) {
map = route_map_lookup_by_name(name);
if (map) if (map)
clear_route_map_helper(map); clear_route_map_helper(map);
else { else {
vty_out(vty, "%s: 'route-map %s' not found\n", vty_out(vty, "%s: 'route-map %s' not found\n",
frr_protonameinst, name); frr_protonameinst, rmapname);
return CMD_SUCCESS; return CMD_SUCCESS;
} }
} else { } else {

View File

@ -152,6 +152,7 @@ clippy_scan += \
lib/nexthop_group.c \ lib/nexthop_group.c \
lib/northbound_cli.c \ lib/northbound_cli.c \
lib/plist.c \ lib/plist.c \
lib/routemap.c \
lib/routemap_cli.c \ lib/routemap_cli.c \
lib/thread.c \ lib/thread.c \
lib/vty.c \ lib/vty.c \