From df84fdeb32c7a76388dd456a835b5f29e0c9caa1 Mon Sep 17 00:00:00 2001 From: Eric Leblond Date: Sat, 6 Jul 2013 17:33:57 +0200 Subject: src: Add support for insertion inside rule list This patch adds support to insert and to add rule using a rule handle as reference. The rule handle syntax has an new optional position field which take a handle as argument. Two examples: nft add rule filter output position 5 ip daddr 1.2.3.1 drop nft insert rule filter output position 5 ip daddr 1.2.3.1 drop Signed-off-by: Eric Leblond Signed-off-by: Pablo Neira Ayuso --- src/netlink.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/netlink.c') diff --git a/src/netlink.c b/src/netlink.c index 2a7bdb56..5129cac6 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -105,6 +105,8 @@ struct nft_rule *alloc_nft_rule(const struct handle *h) nft_rule_attr_set_str(nlr, NFT_RULE_ATTR_CHAIN, h->chain); if (h->handle) nft_rule_attr_set_u64(nlr, NFT_RULE_ATTR_HANDLE, h->handle); + if (h->position) + nft_rule_attr_set_u64(nlr, NFT_RULE_ATTR_POSITION, h->position); return nlr; } -- cgit v1.2.3