netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
To: netfilter-devel@vger.kernel.org
Cc: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Subject: [iptables (nft-compat) PATCH 7/8] nft: A builtin chain might be created when restoring
Date: Tue, 11 Feb 2014 12:46:47 +0200	[thread overview]
Message-ID: <1392115608-6733-8-git-send-email-tomasz.bursztyka@linux.intel.com> (raw)
In-Reply-To: <1392115608-6733-1-git-send-email-tomasz.bursztyka@linux.intel.com>

nft_chain_set() is directly used in xtables-restore.c, however at that
point no builtin chains have been created yet thus the need to request
to create it relevantly.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
---
 iptables/nft.c             | 1 +
 iptables/nft.h             | 1 +
 iptables/xtables-restore.c | 1 +
 3 files changed, 3 insertions(+)

diff --git a/iptables/nft.c b/iptables/nft.c
index a58f9bd..0283d92 100644
--- a/iptables/nft.c
+++ b/iptables/nft.c
@@ -744,6 +744,7 @@ __nft_chain_set(struct nft_handle *h, const char *table,
 	}
 
 	nlh = nft_chain_nlmsg_build_hdr(buf, NFT_MSG_NEWCHAIN, h->family,
+					h->restore ? NLM_F_ACK|NLM_F_CREATE :
 					NLM_F_ACK, h->seq);
 	nft_chain_nlmsg_build_payload(nlh, c);
 
diff --git a/iptables/nft.h b/iptables/nft.h
index 22af66e..8b64f8b 100644
--- a/iptables/nft.h
+++ b/iptables/nft.h
@@ -34,6 +34,7 @@ struct nft_handle {
 	struct mnl_nlmsg_batch	*batch;
 	struct nft_family_ops	*ops;
 	struct builtin_table	*tables;
+	bool			restore;
 };
 
 extern struct builtin_table xtables_ipv4[TABLES_MAX];
diff --git a/iptables/xtables-restore.c b/iptables/xtables-restore.c
index 50d2935..0498abc 100644
--- a/iptables/xtables-restore.c
+++ b/iptables/xtables-restore.c
@@ -170,6 +170,7 @@ xtables_restore_main(int family, const char *progname, int argc, char *argv[])
 {
 	struct nft_handle h = {
 		.family = family,
+		.restore = true,
 	};
 	char buffer[10240];
 	int c;
-- 
1.8.3.2


  parent reply	other threads:[~2014-02-11 10:47 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-11 10:46 [libnftnl/iptables PATCH 0/8] Various fixes Tomasz Bursztyka
2014-02-11 10:46 ` [libnftnl PATCH 1/8] chain: Break the line properly when printing out the chain Tomasz Bursztyka
2014-02-11 10:58   ` Pablo Neira Ayuso
2014-02-11 11:29     ` Tomasz Bursztyka
2014-02-11 11:47       ` Pablo Neira Ayuso
2014-02-11 10:46 ` [libnftnl PATCH 2/8] table: Break the line properly when printing out the table Tomasz Bursztyka
2014-02-11 10:46 ` [iptables (nft-compat) PATCH 3/8] xtables: Handle family is not related to Netlink family Tomasz Bursztyka
2014-02-11 11:02   ` Pablo Neira Ayuso
2014-02-11 11:13     ` Tomasz Bursztyka
2014-02-11 11:23       ` Pablo Neira Ayuso
2014-02-11 11:28         ` Tomasz Bursztyka
2014-02-11 10:46 ` [iptables (nft-compat) PATCH 4/8] xtables: Add backward compatibility with -w option Tomasz Bursztyka
2014-02-11 11:09   ` Pablo Neira Ayuso
2014-02-11 10:46 ` [iptables (nft-compat) PATCH 5/8] nft: Fix error message to output proper origin Tomasz Bursztyka
2014-02-11 11:05   ` Pablo Neira Ayuso
2014-02-11 10:46 ` [iptables (nft-compat) PATCH 6/8] nft: Add useful debug output when a builtin table is created Tomasz Bursztyka
2014-02-11 10:46 ` Tomasz Bursztyka [this message]
2014-02-11 10:46 ` [iptables (nft-compat) PATCH 8/8] nft: Initialize according to requested table, if any Tomasz Bursztyka
2014-02-11 13:07   ` Pablo Neira Ayuso
2014-02-11 13:37     ` Tomasz Bursztyka
2014-02-11 14:44       ` Pablo Neira Ayuso

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=1392115608-6733-8-git-send-email-tomasz.bursztyka@linux.intel.com \
    --to=tomasz.bursztyka@linux.intel.com \
    --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).