]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
segtree: missing comments in range and prefix expressions in sets
authorPablo Neira Ayuso <pablo@netfilter.org>
Wed, 16 May 2018 19:59:12 +0000 (21:59 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 16 May 2018 21:00:57 +0000 (23:00 +0200)
 table inet filter {
        set spamhaus {
                type ipv4_addr
                flags interval
                elements = { 1.2.3.8/31 comment "evil people", 3.3.3.16-3.3.3.20 comment "more than evil" }
        }
 }

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/segtree.c

index e1339daf1341449d960f86bc881e3a9c51e81951..7a443632ece5ea939eeb51f78c989c5a6c6e0265 100644 (file)
@@ -829,6 +829,9 @@ void interval_map_decompose(struct expr *set)
 
                        tmp = range_expr_alloc(&low->location, expr_value(low), tmp);
                        tmp = set_elem_expr_alloc(&low->location, tmp);
+                       if (low->comment)
+                               tmp->comment = xstrdup(low->comment);
+
                        if (low->ops->type == EXPR_MAPPING)
                                tmp = mapping_expr_alloc(&tmp->location, tmp, low->right);
 
@@ -843,6 +846,9 @@ void interval_map_decompose(struct expr *set)
                        prefix->len = expr_value(i)->len;
 
                        prefix = set_elem_expr_alloc(&low->location, prefix);
+                       if (low->comment)
+                               prefix->comment = xstrdup(low->comment);
+
                        if (low->ops->type == EXPR_MAPPING)
                                prefix = mapping_expr_alloc(&low->location, prefix,
                                                            low->right);