netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: kaber@trash.net
Subject: [PATCH 07/10] netfilter: nf_tables: disabling table hooks always succeeds
Date: Fri,  4 Apr 2014 15:48:11 +0200	[thread overview]
Message-ID: <1396619294-26212-8-git-send-email-pablo@netfilter.org> (raw)
In-Reply-To: <1396619294-26212-1-git-send-email-pablo@netfilter.org>

nf_tables_table_disable() always succeeds, make this function void.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/nf_tables_api.c |   12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 2345259..0fa9671 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -381,7 +381,7 @@ err:
 	return err;
 }
 
-static int nf_tables_table_disable(const struct nft_af_info *afi,
+static void nf_tables_table_disable(const struct nft_af_info *afi,
 				   struct nft_table *table)
 {
 	struct nft_chain *chain;
@@ -391,8 +391,6 @@ static int nf_tables_table_disable(const struct nft_af_info *afi,
 			nf_unregister_hooks(nft_base_chain(chain)->ops,
 					    afi->nops);
 	}
-
-	return 0;
 }
 
 static int nf_tables_updtable(struct sock *nlsk, struct sk_buff *skb,
@@ -412,9 +410,8 @@ static int nf_tables_updtable(struct sock *nlsk, struct sk_buff *skb,
 
 		if ((flags & NFT_TABLE_F_DORMANT) &&
 		    !(table->flags & NFT_TABLE_F_DORMANT)) {
-			ret = nf_tables_table_disable(afi, table);
-			if (ret >= 0)
-				table->flags |= NFT_TABLE_F_DORMANT;
+			nf_tables_table_disable(afi, table);
+			table->flags |= NFT_TABLE_F_DORMANT;
 		} else if (!(flags & NFT_TABLE_F_DORMANT) &&
 			   table->flags & NFT_TABLE_F_DORMANT) {
 			ret = nf_tables_table_enable(afi, table);
@@ -963,7 +960,8 @@ static int nf_tables_newchain(struct sock *nlsk, struct sk_buff *skb,
 		}
 
 		nft_ctx_init(&ctx, skb, nlh, afi, table, chain, nla);
-		trans = nft_trans_alloc(&ctx, NFT_MSG_NEWCHAIN);
+		trans = nft_trans_alloc(&ctx, NFT_MSG_NEWCHAIN,
+					sizeof(struct nft_trans_chain));
 		if (trans == NULL)
 			return -ENOMEM;
 
-- 
1.7.10.4


  parent reply	other threads:[~2014-04-04 13:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-04 13:48 [PATCH 00/10] new transaction infrastructure for nf_tables (v3) Pablo Neira Ayuso
2014-04-04 13:48 ` [PATCH 01/10] netfilter: nf_tables: deconstify table and chain in context structure Pablo Neira Ayuso
2014-04-04 13:48 ` [PATCH 02/10] netfilter: nf_tables: generalise transaction infrastructure Pablo Neira Ayuso
2014-04-04 13:48 ` [PATCH 03/10] netfilter: nf_tables: relocate commit and abort routines in the source file Pablo Neira Ayuso
2014-04-04 13:48 ` [PATCH 04/10] netfilter: nf_tables: add message type to transactions Pablo Neira Ayuso
2014-04-04 13:48 ` [PATCH 05/10] netfilter: nf_tables: use new transaction infrastructure to handle sets Pablo Neira Ayuso
2014-04-04 13:48 ` [PATCH 06/10] netfilter: nf_tables: use new transaction infrastructure to handle chain Pablo Neira Ayuso
2014-04-04 13:48 ` Pablo Neira Ayuso [this message]
2014-04-04 13:48 ` [PATCH 08/10] netfilter: nf_tables: pass context to nf_tables_uptable Pablo Neira Ayuso
2014-04-04 13:48 ` [PATCH 09/10] netfilter: nf_tables: use new transaction infrastructure to handle table Pablo Neira Ayuso
2014-04-04 13:48 ` [PATCH 10/10] netfilter: nf_tables: use new transaction infrastructure to handle elements 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=1396619294-26212-8-git-send-email-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=kaber@trash.net \
    --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).