From patchwork Mon May 5 12:56:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Averin X-Patchwork-Id: 345710 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 C0A4A14027A for ; Mon, 5 May 2014 22:58:00 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932561AbaEEM5x (ORCPT ); Mon, 5 May 2014 08:57:53 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:18862 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932214AbaEEM5w (ORCPT ); Mon, 5 May 2014 08:57:52 -0400 Received: from [10.30.3.27] ([10.30.3.27]) (authenticated bits=0) by relay.sw.ru (8.13.4/8.13.4) with ESMTP id s45CvkU0025077 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 5 May 2014 16:57:47 +0400 (MSK) Message-ID: <53678A73.8040502@parallels.com> Date: Mon, 05 May 2014 16:56:19 +0400 From: Vasily Averin Organization: Parallels User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: Florian Westphal , Pablo Neira Ayuso CC: netfilter-devel@vger.kernel.org, Patrick McHardy Subject: [PATCH 5/7] nf: ipv4 defragmentation users counter changes in TPROXY target References: <20140503233908.GA6297@localhost> In-Reply-To: Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org Signed-off-by: Vasily Averin --- net/netfilter/xt_TPROXY.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/net/netfilter/xt_TPROXY.c b/net/netfilter/xt_TPROXY.c index ef8a926..ce99ad4 100644 --- a/net/netfilter/xt_TPROXY.c +++ b/net/netfilter/xt_TPROXY.c @@ -528,14 +528,21 @@ static int tproxy_tg4_check(const struct xt_tgchk_param *par) const struct ipt_ip *i = par->entryinfo; if ((i->proto == IPPROTO_TCP || i->proto == IPPROTO_UDP) - && !(i->invflags & IPT_INV_PROTO)) + && !(i->invflags & IPT_INV_PROTO)) { + inc_br_defrag_ipv4_users_count(par->net); return 0; + } pr_info("Can be used only in combination with " "either -p tcp or -p udp\n"); return -EINVAL; } +void tproxy_tg4_destroy(const struct xt_tgdtor_param *par) +{ + dec_br_defrag_ipv4_users_count(par->net); +} + static struct xt_target tproxy_tg_reg[] __read_mostly = { { .name = "TPROXY", @@ -545,6 +552,7 @@ static struct xt_target tproxy_tg_reg[] __read_mostly = { .revision = 0, .targetsize = sizeof(struct xt_tproxy_target_info), .checkentry = tproxy_tg4_check, + .destroy = tproxy_tg4_destroy, .hooks = 1 << NF_INET_PRE_ROUTING, .me = THIS_MODULE, }, @@ -556,6 +564,7 @@ static struct xt_target tproxy_tg_reg[] __read_mostly = { .revision = 1, .targetsize = sizeof(struct xt_tproxy_target_info_v1), .checkentry = tproxy_tg4_check, + .destroy = tproxy_tg4_destroy, .hooks = 1 << NF_INET_PRE_ROUTING, .me = THIS_MODULE, },