From 78c4b630124ee09dff17026b3e2cd5820942093b Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Wed, 4 Sep 2013 13:13:35 +0200 Subject: 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 --- src/datatype.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/datatype.c') 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) -- cgit v1.2.3