[PATCH libnftnl] set_elem: nftnl_set_elems_nlmsg_build_payload_iter()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Similar to a24e4b21ee33 ("set_elem: don't add NFTA_SET_ELEM_LIST_ELEMENTS
attribute if set is empty"). This is required by the set flush support.

Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>
---
 src/set_elem.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/set_elem.c b/src/set_elem.c
index 4d2b4f6074b7..083c597e2f8e 100644
--- a/src/set_elem.c
+++ b/src/set_elem.c
@@ -813,6 +813,10 @@ int nftnl_set_elems_nlmsg_build_payload_iter(struct nlmsghdr *nlh,
 
 	nftnl_set_elem_nlmsg_build_def(nlh, iter->set);
 
+	/* This set is empty, don't add an empty list element nest. */
+	if (list_empty(&iter->set->element_list))
+		return ret;
+
 	nest1 = mnl_attr_nest_start(nlh, NFTA_SET_ELEM_LIST_ELEMENTS);
 	elem = nftnl_set_elems_iter_next(iter);
 	while (elem != NULL) {
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux