summaryrefslogtreecommitdiff
path: root/nest/rt-attr.c
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2019-07-10 11:27:08 +0200
committerMaria Matejka <mq@ucw.cz>2019-07-10 11:27:08 +0200
commitb2a4feeb4c877ff56d9b2ebd8119225c53ea40db (patch)
treedb22ae94ddf1208824e9ec70176dce63cb073174 /nest/rt-attr.c
parenteac9250fd5b10809830361b94438339b3b31b270 (diff)
parent422a9334294dd9a5b13abd8563a3dc7233e64b13 (diff)
Merge branch 'master' into mq-filter-stack
Diffstat (limited to 'nest/rt-attr.c')
-rw-r--r--nest/rt-attr.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/nest/rt-attr.c b/nest/rt-attr.c
index 9c38e3ca..8620d321 100644
--- a/nest/rt-attr.c
+++ b/nest/rt-attr.c
@@ -202,7 +202,7 @@ nexthop__same(struct nexthop *x, struct nexthop *y)
}
static int
-nexthop_compare_node(struct nexthop *x, struct nexthop *y)
+nexthop_compare_node(const struct nexthop *x, const struct nexthop *y)
{
int r;
@@ -320,6 +320,24 @@ nexthop_insert(struct nexthop **n, struct nexthop *x)
*n = x;
}
+struct nexthop *
+nexthop_sort(struct nexthop *x)
+{
+ struct nexthop *s = NULL;
+
+ /* Simple insert-sort */
+ while (x)
+ {
+ struct nexthop *n = x;
+ x = n->next;
+ n->next = NULL;
+
+ nexthop_insert(&s, n);
+ }
+
+ return s;
+}
+
int
nexthop_is_sorted(struct nexthop *x)
{