summaryrefslogtreecommitdiffstats
path: root/include/expression.h
diff options
context:
space:
mode:
authorElise Lennion <elise.lennion@gmail.com>2017-01-06 19:43:32 -0200
committerPablo Neira Ayuso <pablo@netfilter.org>2017-01-10 22:31:12 +0100
commit14ee0a979b622f95676eab77043b61cc5aab4270 (patch)
tree6d02d132ad9beef75d515430d0959d23aba5e8ca /include/expression.h
parente7f1876088cae4d64de3fc9e2c5419fce599d112 (diff)
src: sort set elements in netlink_get_setelems()
So users can better track their ruleset via git. Without sorting, the elements can be listed in a different order every time the set is created, generating unnecessary git changes. Mergesort is used. Doesn't sort sets with 'flags interval' set on. Pablo appends to this changelog description: Currently these interval set elements are dumped in order. We'll likely get new representations soon that may not guarantee this anymore, so let's revisit this later in case we need it. Without this patch, nft list ruleset with a set containing 40000 elements takes on my laptop: real 0m2.742s user 0m0.112s sys 0m0.280s With this patch: real 0m2.846s user 0m0.180s sys 0m0.284s Difference is small, so don't get nft more complicated with yet another getopt() option, enable this by default. Signed-off-by: Elise Lennion <elise.lennion@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include/expression.h')
-rw-r--r--include/expression.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/expression.h b/include/expression.h
index 71e9c43e..ec90265b 100644
--- a/include/expression.h
+++ b/include/expression.h
@@ -396,6 +396,7 @@ extern struct expr *range_expr_alloc(const struct location *loc,
extern void compound_expr_add(struct expr *compound, struct expr *expr);
extern void compound_expr_remove(struct expr *compound, struct expr *expr);
+extern void list_expr_sort(struct list_head *head);
extern struct expr *concat_expr_alloc(const struct location *loc);