Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp8044974ybi; Tue, 23 Jul 2019 01:53:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqyksRZmtLcaY/SZJbpfV4Y71oBr4xSQhNy+BY5pT0KJJg165sNO1Pa9Hicgy/Ttv0iJ11tu X-Received: by 2002:aa7:8b51:: with SMTP id i17mr4743442pfd.33.1563872014433; Tue, 23 Jul 2019 01:53:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563872014; cv=none; d=google.com; s=arc-20160816; b=iAbL2LJ9jebnRf1kornZrhu9/J43cCRHQV+PJPTLWNxoiDe82vCn9glrAwbwWeVmsB flAwQpPGVFh42MoLbIofMI9qXkUTMMKYtG46o6dLgElv0/WWy2mVoIMsgzrDG6WG6Eun Mp168SYNa6zLH9sFYBwLcn1B5DW4eb/xKS0I2jMAjauqkpNg3sbXKG8hp3j9LYMX3ipa 7HXU46H7CeLHJ1LLa5fP6n8jdz8oUukQLT4dDYQ6Rdv1Hz/nSNvmOGQWyw1AcV7P8Qbi 05LDQt9K+RomVelrkUUJg6kAn6grYuUk4hd9kQnR0Hr+UQRPPIpow/3MU2B2ZtTFHqJj SxWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=WZU7Jdw+Za8incNJbIujsUd2IOXhC/sdGHLUcurCpXQ=; b=TFtzsXTznQrY+1MZ3xC9BlVVDe0/sNgA747wzbicVUuYAteKkwmgiavyWEeCG7l60Y V7gJp+mGDyUFDUG23EbxK3rnf2Fx7w/H2o2c1+QSuYF6C5DGt8TuAJMn4B+zokR3IfX2 KmmfNwmoy7tywh8oYvfhuYCXgRIqruoFhdh4V17IekWGK8qFfTAFoan+Tt+vQtcLqzg6 kj8c1Qa2uVQXrQHIWRemL3mrGy7q5cAZDHnd7JaiPioEO0yFS6OIaffWfYLNrjd9nrQN G+MeXLBgNMakTB2EY74EbWKTxWXR1BrdcaROG84MGt/kV+YlF4YkzgaPa0x2jGU3CCgN ljQA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c11si12192115pjq.0.2019.07.23.01.53.18; Tue, 23 Jul 2019 01:53:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387778AbfGWBXP (ORCPT + 99 others); Mon, 22 Jul 2019 21:23:15 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:39679 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387701AbfGWBXP (ORCPT ); Mon, 22 Jul 2019 21:23:15 -0400 Received: by mail-wr1-f65.google.com with SMTP id x4so41234807wrt.6 for ; Mon, 22 Jul 2019 18:23:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=WZU7Jdw+Za8incNJbIujsUd2IOXhC/sdGHLUcurCpXQ=; b=CdxTo0dsICKEat8eGZfDw9CcqFRJh2/kGRMmVwqEU80DXhn8i6dJkUSJSITK0KR+Xk shfItbQNX3wSTT54VLZ4GZDVeNAmrYOvG/kRqV5ucctgP4Z3BN7fq+/RqAtTnDvznuuV RCxRUe7GvPE1zLUZDzKauI1xTMb6oX+7qO+lWC8YkHVm+PZwbDuLUFd9gqATA+sug2rn r68f1GzGd6nMLtJ2PjO1bptW0mJqPkfpmfwG699ZEpjkQ2VCjuEJpFORafD4c7kabaFF 3GJO+ug9h/qqSs74sg+YyZz1gJlztEym7LRMKhgcl9YcbkgaJRahbgQ38Y5WVgs6+ej+ bsKA== X-Gm-Message-State: APjAAAWXPjB1HASToFon0ROvfDDlhGKW09FC6SnMBjdTZUCujsmMdNO2 rQZI4OLjqg/5TMlZnipBwikYng== X-Received: by 2002:a5d:630c:: with SMTP id i12mr72191361wru.312.1563844993487; Mon, 22 Jul 2019 18:23:13 -0700 (PDT) Received: from mcroce-redhat.redhat.com (host21-50-dynamic.21-87-r.retail.telecomitalia.it. [87.21.50.21]) by smtp.gmail.com with ESMTPSA id c9sm35196753wml.41.2019.07.22.18.23.12 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 22 Jul 2019 18:23:12 -0700 (PDT) From: Matteo Croce To: netdev@vger.kernel.org, netfilter-devel@vger.kernel.org Cc: Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , linux-kernel@vger.kernel.org, akpm@linux-foundation.org, Tonghao Zhang Subject: [PATCH net-next] netfilter: conntrack: use shared sysctl constants Date: Tue, 23 Jul 2019 03:23:03 +0200 Message-Id: <20190723012303.2221-1-mcroce@redhat.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use shared sysctl variables for zero and one constants, as in commit eec4844fae7c ("proc/sysctl: add shared variables for range check") Fixes: 8f14c99c7eda ("netfilter: conntrack: limit sysctl setting for boolean options") Signed-off-by: Matteo Croce --- net/netfilter/nf_conntrack_standalone.c | 34 ++++++++++++------------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c index e0d392cb3075..d97f4ea47cf3 100644 --- a/net/netfilter/nf_conntrack_standalone.c +++ b/net/netfilter/nf_conntrack_standalone.c @@ -511,8 +511,6 @@ static void nf_conntrack_standalone_fini_proc(struct net *net) /* Log invalid packets of a given protocol */ static int log_invalid_proto_min __read_mostly; static int log_invalid_proto_max __read_mostly = 255; -static int zero; -static int one = 1; /* size the user *wants to set */ static unsigned int nf_conntrack_htable_size_user __read_mostly; @@ -629,8 +627,8 @@ static struct ctl_table nf_ct_sysctl_table[] = { .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dointvec_minmax, - .extra1 = &zero, - .extra2 = &one, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_ONE, }, [NF_SYSCTL_CT_LOG_INVALID] = { .procname = "nf_conntrack_log_invalid", @@ -654,8 +652,8 @@ static struct ctl_table nf_ct_sysctl_table[] = { .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dointvec_minmax, - .extra1 = &zero, - .extra2 = &one, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_ONE, }, [NF_SYSCTL_CT_HELPER] = { .procname = "nf_conntrack_helper", @@ -663,8 +661,8 @@ static struct ctl_table nf_ct_sysctl_table[] = { .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dointvec_minmax, - .extra1 = &zero, - .extra2 = &one, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_ONE, }, #ifdef CONFIG_NF_CONNTRACK_EVENTS [NF_SYSCTL_CT_EVENTS] = { @@ -673,8 +671,8 @@ static struct ctl_table nf_ct_sysctl_table[] = { .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dointvec_minmax, - .extra1 = &zero, - .extra2 = &one, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_ONE, }, #endif #ifdef CONFIG_NF_CONNTRACK_TIMESTAMP @@ -684,8 +682,8 @@ static struct ctl_table nf_ct_sysctl_table[] = { .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dointvec_minmax, - .extra1 = &zero, - .extra2 = &one, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_ONE, }, #endif [NF_SYSCTL_CT_PROTO_TIMEOUT_GENERIC] = { @@ -759,16 +757,16 @@ static struct ctl_table nf_ct_sysctl_table[] = { .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dointvec_minmax, - .extra1 = &zero, - .extra2 = &one, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_ONE, }, [NF_SYSCTL_CT_PROTO_TCP_LIBERAL] = { .procname = "nf_conntrack_tcp_be_liberal", .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dointvec_minmax, - .extra1 = &zero, - .extra2 = &one, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_ONE, }, [NF_SYSCTL_CT_PROTO_TCP_MAX_RETRANS] = { .procname = "nf_conntrack_tcp_max_retrans", @@ -904,8 +902,8 @@ static struct ctl_table nf_ct_sysctl_table[] = { .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dointvec_minmax, - .extra1 = &zero, - .extra2 = &one, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_ONE, }, #endif #ifdef CONFIG_NF_CT_PROTO_GRE -- 2.21.0