From patchwork Tue Jul 16 22:30:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giuseppe Longo X-Patchwork-Id: 260733 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 F18B42C008C for ; Tue, 23 Jul 2013 00:32:00 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755657Ab3GVOcA (ORCPT ); Mon, 22 Jul 2013 10:32:00 -0400 Received: from mail-ea0-f179.google.com ([209.85.215.179]:33355 "EHLO mail-ea0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753637Ab3GVOb7 (ORCPT ); Mon, 22 Jul 2013 10:31:59 -0400 Received: by mail-ea0-f179.google.com with SMTP id b15so3929332eae.10 for ; Mon, 22 Jul 2013 07:31:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:from:date:message-id:in-reply-to:references:user-agent :mime-version:content-type:content-transfer-encoding; bh=AX9kk1bv6gMjB55CQU/sOSZaMX2SwKlSZCIHoGsI0Ig=; b=eO75RfKicOlfwiIgo/BFZVgGApkQKMlCEDNgpMwjtQKvhMwUJBuA0QiXpPBb5aPRyu 0dFex4dFsAF+f0+eaj/XbGDINN+xNY+L0xKivVEdnoqvPjAxlQU9vWg2EaAIh+ySa+zr LdFxuW6he072NZKWRVxnshJKTl2iyoLcv56ybqUqQgGV8vJFTT6WZBKc3H07U0Yu8yD6 AgU0rB5/RRlTZdMJAkUhCMK9j/A7RVkxZJJtB6Fz4HP8nCnRMeMyiz4kcPmJ27iUiBcJ WlOR43BQeTwE8BjPoRx8KcSyHkLSy+Hw8vLfKcyV3bANZTVMbkWK0FXqV+AxAMLW8PRt Pv7w== X-Received: by 10.15.41.71 with SMTP id r47mr27717539eev.63.1374503518524; Mon, 22 Jul 2013 07:31:58 -0700 (PDT) Received: from [127.0.1.1] ([37.77.121.31]) by mx.google.com with ESMTPSA id bj46sm51148843eeb.13.2013.07.22.07.31.56 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 22 Jul 2013 07:31:57 -0700 (PDT) Subject: [xtables-arptables PATCH 2/4] nft: search builtin tables via nft_handle tables pointer To: netfilter-devel@vger.kernel.org From: Giuseppe Longo Date: Wed, 17 Jul 2013 00:30:43 +0200 Message-ID: <20130716223043.13253.17600.stgit@nftables> In-Reply-To: <20130716222925.13253.93123.stgit@nftables> References: <20130716222925.13253.93123.stgit@nftables> User-Agent: StGit/0.15 MIME-Version: 1.0 Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org Signed-off-by: Giuseppe Longo --- iptables/nft.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/iptables/nft.c b/iptables/nft.c index 02c12f6..9a8986a 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);