summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2018-08-31 12:17:20 +0200
committerGitHub <noreply@github.com>2018-08-31 12:17:20 +0200
commit479e2eebed53c307a4d3f157613b95ffe1bfa6b5 (patch)
tree9d4589624488ff75619d44fcc7385553a71930a6
parentstatic: Put vty_frame around vrf output in staticd. (diff)
parentlib: sort route-maps for display (diff)
downloadfrr-479e2eebed53c307a4d3f157613b95ffe1bfa6b5.tar.xz
frr-479e2eebed53c307a4d3f157613b95ffe1bfa6b5.zip
Merge pull request #2951 from qlyoung/sort-route-maps
lib: sort route-maps for display
-rw-r--r--lib/routemap.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/lib/routemap.c b/lib/routemap.c
index 4125bb53a..e5613c208 100644
--- a/lib/routemap.c
+++ b/lib/routemap.c
@@ -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)
{
struct route_map *map;
@@ -907,9 +915,19 @@ static int vty_show_route_map(struct vty *vty, const char *name)
return CMD_SUCCESS;
}
} else {
+
+ struct list *maplist = list_new();
+ struct listnode *ln;
+
for (map = route_map_master.head; map; map = map->next)
- if (!map->deleted)
- vty_show_route_map_entry(vty, map);
+ 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);
+
+ list_delete_and_null(&maplist);
}
return CMD_SUCCESS;
}