From patchwork Fri Jul 26 11:05:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giuseppe Longo X-Patchwork-Id: 262126 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 179442C00C7 for ; Fri, 26 Jul 2013 21:06:00 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757604Ab3GZLF7 (ORCPT ); Fri, 26 Jul 2013 07:05:59 -0400 Received: from mail-wi0-f170.google.com ([209.85.212.170]:57339 "EHLO mail-wi0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756790Ab3GZLF6 (ORCPT ); Fri, 26 Jul 2013 07:05:58 -0400 Received: by mail-wi0-f170.google.com with SMTP id ey16so735845wid.3 for ; Fri, 26 Jul 2013 04:05:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=ZjzWLZAF6YzdCJrfCAvFTvMq8FMdyevaVUwWa2WqMOo=; b=MG2udr49chLYgBlPXORES3rpdmrGdKeaTD7PFKF8AqPdffmYyMPYiJavrz38YsiWI1 eg7SlTRRYaHr4PAaqhilYx8IWTMo9Tx0W+bEktBXa9bB8+YgJRLUyBMm08VXEzjGGLym 0vwn8s+9BAJEuiORaEQ3Xga9+Ty6LXS/3Aum04iBdFSBFfKeOIxFFR81hYoq4lWx9fj7 kZgc+rWuubFl15XzEUdLMfnH9meWX1JgoEpa6bwCI5E5UF1mp9ZP+qk6ioNsmXd4chEA LXDzaf/i04R1qSXI4extwgP2h0Uj6errSfB3PgIv4RcD8fN2yO0LXQrdVfT16RxYtNyX UKgw== X-Received: by 10.194.95.100 with SMTP id dj4mr13221753wjb.55.1374836757395; Fri, 26 Jul 2013 04:05:57 -0700 (PDT) Received: from localhost.localdomain ([37.77.119.234]) by mx.google.com with ESMTPSA id x2sm3977498wif.3.2013.07.26.04.05.54 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 26 Jul 2013 04:05:56 -0700 (PDT) From: Giuseppe Longo To: netfilter-devel@vger.kernel.org Cc: Giuseppe Longo Subject: [iptables-nftables PATCH 2/5] nft: search builtin tables via nft_handle tables pointer Date: Fri, 26 Jul 2013 13:05:16 +0200 Message-Id: <1374836719-27596-2-git-send-email-giuseppelng@gmail.com> X-Mailer: git-send-email 1.7.8.6 In-Reply-To: <1374836719-27596-1-git-send-email-giuseppelng@gmail.com> References: <1374836719-27596-1-git-send-email-giuseppelng@gmail.com> Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org This finds built-in tables via tables pointer in nft_handle Signed-off-by: Giuseppe Longo --- iptables/nft.c | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-) diff --git a/iptables/nft.c b/iptables/nft.c index 5665148..0b45c93 100644 --- a/iptables/nft.c +++ b/iptables/nft.c @@ -288,20 +288,21 @@ nft_chain_builtin_add(struct nft_handle *h, struct builtin_table *table, } /* find if built-in table already exists */ -static struct builtin_table *nft_table_builtin_find(const char *table) +static struct builtin_table +*nft_table_builtin_find(struct nft_handle *h, const char *table) { int i; bool found = false; for (i=0; itables[i].name, table) != 0) continue; found = true; break; } - return found ? &tables[i] : NULL; + return found ? &h->tables[i] : NULL; } /* find if built-in chain already exists */ @@ -349,7 +350,7 @@ nft_chain_builtin_init(struct nft_handle *h, const char *table, int ret = 0; struct builtin_table *t; - t = nft_table_builtin_find(table); + t = nft_table_builtin_find(h, table); if (t == NULL) { ret = -1; goto out; @@ -424,7 +425,7 @@ int nft_table_set_dormant(struct nft_handle *h, const char *table) int ret = 0, i; struct builtin_table *t; - t = nft_table_builtin_find(table); + t = nft_table_builtin_find(h, table); if (t == NULL) { ret = -1; goto out; @@ -485,7 +486,7 @@ __nft_chain_set(struct nft_handle *h, const char *table, struct builtin_chain *_c; int ret; - _t = nft_table_builtin_find(table); + _t = nft_table_builtin_find(h, table); /* if this built-in table does not exists, create it */ if (_t != NULL) nft_table_builtin_add(h, _t, false);