From 228e8b1746270ee5c4a41b671a01369c75622587 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Sat, 26 Dec 2020 19:44:48 +0100 Subject: 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 --- include/set_elem.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/set_elem.h b/include/set_elem.h index 9239557..503dced 100644 --- a/include/set_elem.h +++ b/include/set_elem.h @@ -20,4 +20,8 @@ struct nftnl_set_elem { } user; }; +int nftnl_set_elem_snprintf_default(char *buf, size_t size, + const struct nftnl_set_elem *e, + enum nft_data_types dtype); + #endif -- cgit v1.2.3