From: Pablo Neira Ayuso Date: Wed, 4 Sep 2013 11:13:35 +0000 (+0200) Subject: datatype: fix mark parsing if string is used X-Git-Tag: v0.099~78 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=78c4b630124ee09dff17026b3e2cd5820942093b;p=thirdparty%2Fnftables.git datatype: fix mark parsing if string is used 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 --- diff --git a/src/datatype.c b/src/datatype.c index 12e876cf..c4fc131d 100644 --- a/src/datatype.c +++ b/src/datatype.c @@ -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)