Skip to contentSkip to conversation

datatype: display description for header field < 8 bits

PATCH New Pablo Neira Ayuso 1 participant 1 message Oct 10, 2019 netfilter

lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH v2 1/1 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")

---
v2: use div_round_up() - Florian Westphal.

 src/datatype.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/datatype.c +1 -1
index 873f7d4d358b..b9e167e03765 100644
@@ -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++) {
Signature · 1 line
2.11.0