Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: fix clear route-map command (backport #13064) #13067

Merged
merged 2 commits into from
Mar 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions lib/routemap.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
#include "json.h"
#include "jhash.h"

#include "lib/routemap_clippy.c"

DEFINE_MTYPE_STATIC(LIB, ROUTE_MAP, "Route map");
DEFINE_MTYPE(LIB, ROUTE_MAP_NAME, "Route map name");
DEFINE_MTYPE_STATIC(LIB, ROUTE_MAP_INDEX, "Route map index");
Expand Down Expand Up @@ -3097,27 +3099,24 @@ static void clear_route_map_helper(struct route_map *map)
index->applied_clear = index->applied;
}

DEFUN (rmap_clear_counters,
DEFPY (rmap_clear_counters,
rmap_clear_counters_cmd,
"clear route-map counters [WORD]",
"clear route-map counters [RMAP_NAME$rmapname]",
CLEAR_STR
"route-map information\n"
"counters associated with the specified route-map\n"
"route-map name\n")
{
int idx_word = 2;
struct route_map *map;

const char *name = (argc == 3 ) ? argv[idx_word]->arg : NULL;

if (name) {
map = route_map_lookup_by_name(name);
if (rmapname) {
map = route_map_lookup_by_name(rmapname);

if (map)
clear_route_map_helper(map);
else {
vty_out(vty, "%s: 'route-map %s' not found\n",
frr_protonameinst, name);
frr_protonameinst, rmapname);
return CMD_SUCCESS;
}
} else {
Expand Down
1 change: 1 addition & 0 deletions lib/subdir.am
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ clippy_scan += \
lib/nexthop_group.c \
lib/northbound_cli.c \
lib/plist.c \
lib/routemap.c \
lib/routemap_cli.c \
lib/thread.c \
lib/vty.c \
Expand Down