forked from Mirror/frr
lib: sort route-maps for display
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
This commit is contained in:
parent
a91a5dcdd6
commit
78b1bb5ff3
|
@ -891,6 +891,14 @@ static void vty_show_route_map_entry(struct vty *vty, struct route_map *map)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int sort_route_map(const void **map1, const void **map2)
|
||||||
|
{
|
||||||
|
const struct route_map *m1 = *map1;
|
||||||
|
const struct route_map *m2 = *map2;
|
||||||
|
|
||||||
|
return strcmp(m1->name, m2->name);
|
||||||
|
}
|
||||||
|
|
||||||
static int vty_show_route_map(struct vty *vty, const char *name)
|
static int vty_show_route_map(struct vty *vty, const char *name)
|
||||||
{
|
{
|
||||||
struct route_map *map;
|
struct route_map *map;
|
||||||
|
@ -907,9 +915,19 @@ static int vty_show_route_map(struct vty *vty, const char *name)
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
struct list *maplist = list_new();
|
||||||
|
struct listnode *ln;
|
||||||
|
|
||||||
for (map = route_map_master.head; map; map = map->next)
|
for (map = route_map_master.head; map; map = map->next)
|
||||||
if (!map->deleted)
|
listnode_add(maplist, map);
|
||||||
|
|
||||||
|
list_sort(maplist, sort_route_map);
|
||||||
|
|
||||||
|
for (ALL_LIST_ELEMENTS_RO(maplist, ln, map))
|
||||||
vty_show_route_map_entry(vty, map);
|
vty_show_route_map_entry(vty, map);
|
||||||
|
|
||||||
|
list_delete_and_null(&maplist);
|
||||||
}
|
}
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue