mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 00:56:19 +00:00
Merge pull request #3091 from donaldsharp/routemap_countemup
lib: Allow some usage statistics for route-maps
This commit is contained in:
commit
979ee88491
@ -854,11 +854,13 @@ static void vty_show_route_map_entry(struct vty *vty, struct route_map *map)
|
|||||||
struct route_map_index *index;
|
struct route_map_index *index;
|
||||||
struct route_map_rule *rule;
|
struct route_map_rule *rule;
|
||||||
|
|
||||||
vty_out(vty, "%s:\n", frr_protonameinst);
|
vty_out(vty, "route-map: %s Invoked: %" PRIu64 "\n",
|
||||||
|
map->name, map->applied);
|
||||||
|
|
||||||
for (index = map->head; index; index = index->next) {
|
for (index = map->head; index; index = index->next) {
|
||||||
vty_out(vty, "route-map %s, %s, sequence %d\n", map->name,
|
vty_out(vty, " %s, sequence %d Invoked %" PRIu64 "\n",
|
||||||
route_map_type_str(index->type), index->pref);
|
route_map_type_str(index->type), index->pref,
|
||||||
|
index->applied);
|
||||||
|
|
||||||
/* Description */
|
/* Description */
|
||||||
if (index->description)
|
if (index->description)
|
||||||
@ -904,6 +906,8 @@ static int vty_show_route_map(struct vty *vty, const char *name)
|
|||||||
{
|
{
|
||||||
struct route_map *map;
|
struct route_map *map;
|
||||||
|
|
||||||
|
vty_out(vty, "%s:\n", frr_protonameinst);
|
||||||
|
|
||||||
if (name) {
|
if (name) {
|
||||||
map = route_map_lookup_by_name(name);
|
map = route_map_lookup_by_name(name);
|
||||||
|
|
||||||
@ -1457,8 +1461,10 @@ route_map_result_t route_map_apply(struct route_map *map,
|
|||||||
if (map == NULL)
|
if (map == NULL)
|
||||||
return RMAP_DENYMATCH;
|
return RMAP_DENYMATCH;
|
||||||
|
|
||||||
|
map->applied++;
|
||||||
for (index = map->head; index; index = index->next) {
|
for (index = map->head; index; index = index->next) {
|
||||||
/* Apply this index. */
|
/* Apply this index. */
|
||||||
|
index->applied++;
|
||||||
ret = route_map_apply_match(&index->match_list, prefix, type,
|
ret = route_map_apply_match(&index->match_list, prefix, type,
|
||||||
object);
|
object);
|
||||||
|
|
||||||
|
@ -142,6 +142,9 @@ struct route_map_index {
|
|||||||
struct route_map_index *next;
|
struct route_map_index *next;
|
||||||
struct route_map_index *prev;
|
struct route_map_index *prev;
|
||||||
|
|
||||||
|
/* Keep track how many times we've try to apply */
|
||||||
|
uint64_t applied;
|
||||||
|
|
||||||
QOBJ_FIELDS
|
QOBJ_FIELDS
|
||||||
};
|
};
|
||||||
DECLARE_QOBJ_TYPE(route_map_index)
|
DECLARE_QOBJ_TYPE(route_map_index)
|
||||||
@ -163,6 +166,9 @@ struct route_map {
|
|||||||
bool to_be_processed; /* True if modification isn't acted on yet */
|
bool to_be_processed; /* True if modification isn't acted on yet */
|
||||||
bool deleted; /* If 1, then this node will be deleted */
|
bool deleted; /* If 1, then this node will be deleted */
|
||||||
|
|
||||||
|
/* How many times have we applied this route-map */
|
||||||
|
uint64_t applied;
|
||||||
|
|
||||||
QOBJ_FIELDS
|
QOBJ_FIELDS
|
||||||
};
|
};
|
||||||
DECLARE_QOBJ_TYPE(route_map)
|
DECLARE_QOBJ_TYPE(route_map)
|
||||||
|
Loading…
Reference in New Issue
Block a user