Netfilter-Devel Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH nft,v2] datatype: display description for header field < 8 bits
@ 2019-10-10  8:01 Pablo Neira Ayuso
  0 siblings, 0 replies; only message in thread
From: Pablo Neira Ayuso @ 2019-10-10  8:01 UTC (permalink / raw)
  To: netfilter-devel; +Cc: fw

 # 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 <pablo@netfilter.org>
---
v2: use div_round_up() - Florian Westphal.

 src/datatype.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/datatype.c b/src/datatype.c
index 873f7d4d358b..b9e167e03765 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++) {
-- 
2.11.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-10  8:01 [PATCH nft,v2] datatype: display description for header field < 8 bits Pablo Neira Ayuso

Netfilter-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/netfilter-devel/0 netfilter-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 netfilter-devel netfilter-devel/ https://lore.kernel.org/netfilter-devel \
		netfilter-devel@vger.kernel.org netfilter-devel@archiver.kernel.org
	public-inbox-index netfilter-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.netfilter-devel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox