summaryrefslogtreecommitdiffstats
path: root/src/set.c
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2020-12-26 19:44:48 +0100
committerPhil Sutter <phil@nwl.cc>2021-03-09 16:24:46 +0100
commit228e8b1746270ee5c4a41b671a01369c75622587 (patch)
tree6912052d62bb6d3fb88f342ba007465fce837bce /src/set.c
parent5048736e76e553b54b445dee488a6316468bce73 (diff)
set_elem: Fix printing of verdict map elements
Elements' data was printed as type DATA_VALUE no matter the actual type. For verdicts, this meant no printing at all (because reg->len is either zero or garbage). To fix this, nftnl_set_elem_snprintf_default() needs type info held in struct nftnl_set. Pass it via parameter to that function, make it non-static and call it from nftnl_set_snprintf_default() instead of the generic nftnl_set_elem_snprintf(). This way no changes have to be done to exported functions, also the output type is already defined when nftnl_set_snprintf_default() runs so checking type value again is pointless. Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'src/set.c')
-rw-r--r--src/set.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/set.c b/src/set.c
index 8c5025d..a21df1f 100644
--- a/src/set.c
+++ b/src/set.c
@@ -829,8 +829,8 @@ static int nftnl_set_snprintf_default(char *buf, size_t size,
ret = snprintf(buf + offset, remain, "\t");
SNPRINTF_BUFFER_SIZE(ret, remain, offset);
- ret = nftnl_set_elem_snprintf(buf + offset, remain, elem, type,
- flags);
+ ret = nftnl_set_elem_snprintf_default(buf + offset, remain,
+ elem, s->data_type);
SNPRINTF_BUFFER_SIZE(ret, remain, offset);
}