]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: Order `show run` route-map order to be alphabetical
authorDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 20 Jun 2019 19:03:05 +0000 (15:03 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 20 Jun 2019 19:03:05 +0000 (15:03 -0400)
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 <manuel@cloudscale.ch>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
lib/routemap.c

index b666852bee36f3e58da32efe64e904da198e9aec..e0fa0fe766719a0e61b22323fe3e30ea0eb41e90 100644 (file)
@@ -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;
 }