From: Pablo Neira Ayuso Date: Wed, 9 Oct 2019 20:09:52 +0000 (+0200) Subject: datatype: display description for header field < 8 bits X-Git-Tag: v0.9.3~52 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6450e36080e66e4edc90ea688ffb52c60e14f2cd;p=thirdparty%2Fnftables.git datatype: display description for header field < 8 bits # nft describe ip dscp payload expression, datatype dscp (Differentiated Services Code Point) (basetype integer), 6 bits pre-defined symbolic constants (in hexadecimal): nft: datatype.c:209: switch_byteorder: Assertion `len > 0' failed. Aborted Fixes: c89a0801d077 ("datatype: Display pre-defined inet_service values in host byte order") Signed-off-by: Pablo Neira Ayuso --- diff --git a/src/datatype.c b/src/datatype.c index 873f7d4d..b9e167e0 100644 --- a/src/datatype.c +++ b/src/datatype.c @@ -216,8 +216,8 @@ void symbol_table_print(const struct symbol_table *tbl, enum byteorder byteorder, struct output_ctx *octx) { + unsigned int len = div_round_up(dtype->size, BITS_PER_BYTE); const struct symbolic_constant *s; - unsigned int len = dtype->size / BITS_PER_BYTE; uint64_t value; for (s = tbl->symbols; s->identifier != NULL; s++) {