From 55858394f285942f1ed374abcc915f8d2fc98a55 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 20 Jun 2019 15:03:05 -0400 Subject: [PATCH] lib: Order `show run` route-map order to be alphabetical When running `show run` of route-maps the order is basically the order read in some fashion. Convert the display to always be the alphabetically sorted order. Suggested-by: Manuel Schweizer Signed-off-by: Donald Sharp --- lib/routemap.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/routemap.c b/lib/routemap.c index b666852bee..e0fa0fe766 100644 --- a/lib/routemap.c +++ b/lib/routemap.c @@ -3133,8 +3133,15 @@ static int route_map_config_write(struct vty *vty) struct route_map_rule *rule; int first = 1; int write = 0; + struct listnode *ln; + struct list *maplist = list_new(); for (map = route_map_master.head; map; map = map->next) + listnode_add(maplist, map); + + list_sort(maplist, sort_route_map); + + for (ALL_LIST_ELEMENTS_RO(maplist, ln, map)) for (index = map->head; index; index = index->next) { if (!first) vty_out(vty, "!\n"); @@ -3167,6 +3174,8 @@ static int route_map_config_write(struct vty *vty) write++; } + + list_delete(&maplist); return write; } -- 2.39.5