]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
datatype: fix mark parsing if string is used
authorPablo Neira Ayuso <pablo@netfilter.org>
Wed, 4 Sep 2013 11:13:35 +0000 (13:13 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 4 Sep 2013 11:15:42 +0000 (13:15 +0200)
This fixes string mark parsing. Note that /etc/iproute2/rt_marks may
contain mapping between string and mark values.

This fixes here:

add rule filter output meta mark 0 counter

Assumming that:

cat /etc/iproute2/rt_marks

says:

0 test

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

index 12e876cf3cbe8d605b9c8db67d14ab22f34fcbf2..c4fc131ded5ed93c720687f2335d7c61a3e57bdc 100644 (file)
@@ -632,6 +632,17 @@ static struct error_record *mark_type_parse(const struct expr *sym,
                                            struct expr **res)
 {
        struct error_record *erec;
+       const struct symbolic_constant *s;
+
+       for (s = mark_tbl->symbols; s->identifier != NULL; s++) {
+               if (!strcmp(sym->identifier, s->identifier)) {
+                       *res = constant_expr_alloc(&sym->location, sym->dtype,
+                                                  sym->dtype->byteorder,
+                                                  sym->dtype->size,
+                                                  &s->value);
+                       return NULL;
+               }
+       }
 
        erec = sym->dtype->basetype->parse(sym, res);
        if (erec != NULL)