Commit e84fb4b3 authored by Matteo Croce's avatar Matteo Croce Committed by Pablo Neira Ayuso

netfilter: conntrack: use shared sysctl constants

Use shared sysctl variables for zero and one constants, as in commit
eec4844f ("proc/sysctl: add shared variables for range check")

Fixes: 8f14c99c ("netfilter: conntrack: limit sysctl setting for boolean options")
Signed-off-by: default avatarMatteo Croce <mcroce@redhat.com>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 8c0bb787
...@@ -511,8 +511,6 @@ static void nf_conntrack_standalone_fini_proc(struct net *net) ...@@ -511,8 +511,6 @@ static void nf_conntrack_standalone_fini_proc(struct net *net)
/* Log invalid packets of a given protocol */ /* Log invalid packets of a given protocol */
static int log_invalid_proto_min __read_mostly; static int log_invalid_proto_min __read_mostly;
static int log_invalid_proto_max __read_mostly = 255; static int log_invalid_proto_max __read_mostly = 255;
static int zero;
static int one = 1;
/* size the user *wants to set */ /* size the user *wants to set */
static unsigned int nf_conntrack_htable_size_user __read_mostly; static unsigned int nf_conntrack_htable_size_user __read_mostly;
...@@ -629,8 +627,8 @@ static struct ctl_table nf_ct_sysctl_table[] = { ...@@ -629,8 +627,8 @@ static struct ctl_table nf_ct_sysctl_table[] = {
.maxlen = sizeof(int), .maxlen = sizeof(int),
.mode = 0644, .mode = 0644,
.proc_handler = proc_dointvec_minmax, .proc_handler = proc_dointvec_minmax,
.extra1 = &zero, .extra1 = SYSCTL_ZERO,
.extra2 = &one, .extra2 = SYSCTL_ONE,
}, },
[NF_SYSCTL_CT_LOG_INVALID] = { [NF_SYSCTL_CT_LOG_INVALID] = {
.procname = "nf_conntrack_log_invalid", .procname = "nf_conntrack_log_invalid",
...@@ -654,8 +652,8 @@ static struct ctl_table nf_ct_sysctl_table[] = { ...@@ -654,8 +652,8 @@ static struct ctl_table nf_ct_sysctl_table[] = {
.maxlen = sizeof(int), .maxlen = sizeof(int),
.mode = 0644, .mode = 0644,
.proc_handler = proc_dointvec_minmax, .proc_handler = proc_dointvec_minmax,
.extra1 = &zero, .extra1 = SYSCTL_ZERO,
.extra2 = &one, .extra2 = SYSCTL_ONE,
}, },
[NF_SYSCTL_CT_HELPER] = { [NF_SYSCTL_CT_HELPER] = {
.procname = "nf_conntrack_helper", .procname = "nf_conntrack_helper",
...@@ -663,8 +661,8 @@ static struct ctl_table nf_ct_sysctl_table[] = { ...@@ -663,8 +661,8 @@ static struct ctl_table nf_ct_sysctl_table[] = {
.maxlen = sizeof(int), .maxlen = sizeof(int),
.mode = 0644, .mode = 0644,
.proc_handler = proc_dointvec_minmax, .proc_handler = proc_dointvec_minmax,
.extra1 = &zero, .extra1 = SYSCTL_ZERO,
.extra2 = &one, .extra2 = SYSCTL_ONE,
}, },
#ifdef CONFIG_NF_CONNTRACK_EVENTS #ifdef CONFIG_NF_CONNTRACK_EVENTS
[NF_SYSCTL_CT_EVENTS] = { [NF_SYSCTL_CT_EVENTS] = {
...@@ -673,8 +671,8 @@ static struct ctl_table nf_ct_sysctl_table[] = { ...@@ -673,8 +671,8 @@ static struct ctl_table nf_ct_sysctl_table[] = {
.maxlen = sizeof(int), .maxlen = sizeof(int),
.mode = 0644, .mode = 0644,
.proc_handler = proc_dointvec_minmax, .proc_handler = proc_dointvec_minmax,
.extra1 = &zero, .extra1 = SYSCTL_ZERO,
.extra2 = &one, .extra2 = SYSCTL_ONE,
}, },
#endif #endif
#ifdef CONFIG_NF_CONNTRACK_TIMESTAMP #ifdef CONFIG_NF_CONNTRACK_TIMESTAMP
...@@ -684,8 +682,8 @@ static struct ctl_table nf_ct_sysctl_table[] = { ...@@ -684,8 +682,8 @@ static struct ctl_table nf_ct_sysctl_table[] = {
.maxlen = sizeof(int), .maxlen = sizeof(int),
.mode = 0644, .mode = 0644,
.proc_handler = proc_dointvec_minmax, .proc_handler = proc_dointvec_minmax,
.extra1 = &zero, .extra1 = SYSCTL_ZERO,
.extra2 = &one, .extra2 = SYSCTL_ONE,
}, },
#endif #endif
[NF_SYSCTL_CT_PROTO_TIMEOUT_GENERIC] = { [NF_SYSCTL_CT_PROTO_TIMEOUT_GENERIC] = {
...@@ -759,16 +757,16 @@ static struct ctl_table nf_ct_sysctl_table[] = { ...@@ -759,16 +757,16 @@ static struct ctl_table nf_ct_sysctl_table[] = {
.maxlen = sizeof(int), .maxlen = sizeof(int),
.mode = 0644, .mode = 0644,
.proc_handler = proc_dointvec_minmax, .proc_handler = proc_dointvec_minmax,
.extra1 = &zero, .extra1 = SYSCTL_ZERO,
.extra2 = &one, .extra2 = SYSCTL_ONE,
}, },
[NF_SYSCTL_CT_PROTO_TCP_LIBERAL] = { [NF_SYSCTL_CT_PROTO_TCP_LIBERAL] = {
.procname = "nf_conntrack_tcp_be_liberal", .procname = "nf_conntrack_tcp_be_liberal",
.maxlen = sizeof(int), .maxlen = sizeof(int),
.mode = 0644, .mode = 0644,
.proc_handler = proc_dointvec_minmax, .proc_handler = proc_dointvec_minmax,
.extra1 = &zero, .extra1 = SYSCTL_ZERO,
.extra2 = &one, .extra2 = SYSCTL_ONE,
}, },
[NF_SYSCTL_CT_PROTO_TCP_MAX_RETRANS] = { [NF_SYSCTL_CT_PROTO_TCP_MAX_RETRANS] = {
.procname = "nf_conntrack_tcp_max_retrans", .procname = "nf_conntrack_tcp_max_retrans",
...@@ -904,8 +902,8 @@ static struct ctl_table nf_ct_sysctl_table[] = { ...@@ -904,8 +902,8 @@ static struct ctl_table nf_ct_sysctl_table[] = {
.maxlen = sizeof(int), .maxlen = sizeof(int),
.mode = 0644, .mode = 0644,
.proc_handler = proc_dointvec_minmax, .proc_handler = proc_dointvec_minmax,
.extra1 = &zero, .extra1 = SYSCTL_ZERO,
.extra2 = &one, .extra2 = SYSCTL_ONE,
}, },
#endif #endif
#ifdef CONFIG_NF_CT_PROTO_GRE #ifdef CONFIG_NF_CT_PROTO_GRE
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment