From 5bf7d66d5430b614b072d3a9e6a262b78992faca Mon Sep 17 00:00:00 2001 From: Arturo Borrero Date: Mon, 14 Jul 2014 13:56:52 +0200 Subject: netlink: monitor: fix how rules with intervals are printed 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 Signed-off-by: Pablo Neira Ayuso --- src/netlink.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/netlink.c b/src/netlink.c index c0597971..05fae103 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -1753,6 +1753,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) { @@ -1773,6 +1779,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); -- cgit v1.2.3