[nft PATCH 2/2] monitor: fix how rules with intervals are printed

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

 



Previous to this patch, if we add a rule like this:
 nft add rule filter test ip saddr { 1.1.1.1-2.2.2.2 }

The monitor operation output shows:
 add rule ip filter test ip saddr { 0.0.0.0, 1.1.1.1, 2.2.2.3}

The fix suggested by Pablo is to call interval_map_decompose().

Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@xxxxxxxxx>
---
 src/netlink.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/netlink.c b/src/netlink.c
index 1a5d07b..83a13c3 100644
--- a/src/netlink.c
+++ b/src/netlink.c
@@ -1723,6 +1723,12 @@ out:
 	return MNL_CB_OK;
 }
 
+static void rule_map_decompose_cb(struct set *s, void *data)
+{
+	if (s->flags & NFT_SET_INTERVAL)
+		interval_map_decompose(s->init);
+}
+
 static int netlink_events_rule_cb(const struct nlmsghdr *nlh, int type,
 				  struct netlink_mon_handler *monh)
 {
@@ -1743,6 +1749,7 @@ static int netlink_events_rule_cb(const struct nlmsghdr *nlh, int type,
 
 		if (type == NFT_MSG_NEWRULE) {
 			r = netlink_delinearize_rule(monh->ctx, nlr);
+			nlr_for_each_set(nlr, rule_map_decompose_cb, NULL);
 
 			printf("add rule %s %s %s", family, table, chain);
 			rule_print(r);

--
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