netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: [PATCH 10/12] netlink: add NLM_F_NONREC flag for deletion requests
Date: Mon,  4 Sep 2017 22:11:12 +0200	[thread overview]
Message-ID: <1504555874-4168-11-git-send-email-pablo@netfilter.org> (raw)
In-Reply-To: <1504555874-4168-1-git-send-email-pablo@netfilter.org>

In the last NFWS in Faro, Portugal, we discussed that netlink is lacking
the semantics to request non recursive deletions, ie. do not delete an
object iff it has child objects that hang from this parent object that
the user requests to be deleted.

We need this new flag to solve a problem for the iptables-compat
backward compatibility utility, that runs iptables commands using the
existing nf_tables netlink interface. Specifically, custom chains in
iptables cannot be deleted if there are rules in it, however, nf_tables
allows to remove any chain that is populated with content. To sort out
this asymmetry, iptables-compat userspace sets this new NLM_F_NONREC
flag to obtain the same semantics that iptables provides.

This new flag should only be used for deletion requests. Note this new
flag value overlaps with the existing:

* NLM_F_ROOT for get requests.
* NLM_F_REPLACE for new requests.

However, those flags should not ever be used in deletion requests.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 include/uapi/linux/netlink.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/uapi/linux/netlink.h b/include/uapi/linux/netlink.h
index f4fc9c9e123d..e8af60a7c56d 100644
--- a/include/uapi/linux/netlink.h
+++ b/include/uapi/linux/netlink.h
@@ -69,6 +69,9 @@ struct nlmsghdr {
 #define NLM_F_CREATE	0x400	/* Create, if it does not exist	*/
 #define NLM_F_APPEND	0x800	/* Add to end of list		*/
 
+/* Modifiers to DELETE request */
+#define NLM_F_NONREC	0x100	/* Do not delete recursively	*/
+
 /* Flags for ACK message */
 #define NLM_F_CAPPED	0x100	/* request was capped */
 #define NLM_F_ACK_TLVS	0x200	/* extended ACK TVLs were included */
-- 
2.1.4

  parent reply	other threads:[~2017-09-04 20:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-04 20:11 [PATCH 00/12] Netfilter updates for next-net (part 2) Pablo Neira Ayuso
2017-09-04 20:11 ` [PATCH 01/12] netfilter: xt_hashlimit: add rate match mode Pablo Neira Ayuso
2017-09-04 20:11 ` [PATCH 02/12] netfilter: nf_tables: add select_ops for stateful objects Pablo Neira Ayuso
2017-09-04 20:11 ` [PATCH 03/12] netfilter: nft_limit: replace pkt_bytes with bytes Pablo Neira Ayuso
2017-09-04 20:11 ` [PATCH 04/12] netfilter: nft_limit: add stateful object type Pablo Neira Ayuso
2017-09-04 20:11 ` [PATCH 05/12] netfilter: remove unused hooknum arg from packet functions Pablo Neira Ayuso
2017-09-04 20:11 ` [PATCH 06/12] net: Replace NF_CT_ASSERT() with WARN_ON() Pablo Neira Ayuso
2017-09-04 20:11 ` [PATCH 07/12] net: Remove CONFIG_NETFILTER_DEBUG and _ASSERT() macros Pablo Neira Ayuso
2017-09-04 20:11 ` [PATCH 08/12] netfilter: nf_tables: add nf_tables_updchain() Pablo Neira Ayuso
2017-09-04 20:11 ` [PATCH 09/12] netfilter: nf_tables: add nf_tables_addchain() Pablo Neira Ayuso
2017-09-04 20:11 ` Pablo Neira Ayuso [this message]
2017-09-04 20:11 ` [PATCH 11/12] netfilter: nf_tables: use NLM_F_NONREC for deletion requests Pablo Neira Ayuso
2017-09-04 20:11 ` [PATCH 12/12] netfilter: nf_tables: support for recursive chain deletion Pablo Neira Ayuso
2017-09-04 22:28 ` [PATCH 00/12] Netfilter updates for next-net (part 2) David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1504555874-4168-11-git-send-email-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).