Netdev List
 help / color / mirror / Atom feed
From: Simon Horman <horms@verge.net.au>
To: xiangxia.m.yue@gmail.com
Cc: netdev@vger.kernel.org, Luis Chamberlain <mcgrof@kernel.org>,
	Kees Cook <keescook@chromium.org>,
	Iurii Zaikin <yzaikin@google.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
	David Ahern <dsahern@kernel.org>, Julian Anastasov <ja@ssi.bg>,
	Pablo Neira Ayuso <pablo@netfilter.org>,
	Jozsef Kadlecsik <kadlec@netfilter.org>,
	Florian Westphal <fw@strlen.de>,
	Dmitry Vyukov <dvyukov@google.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Eric Dumazet <edumazet@google.com>,
	Marc Kleine-Budde <mkl@pengutronix.de>,
	Lorenz Bauer <lmb@cloudflare.com>,
	Akhmat Karakotov <hmukos@yandex-team.ru>
Subject: Re: [PATCH v3 2/2] net: sysctl: introduce sysctl SYSCTL_THREE
Date: Tue, 19 Apr 2022 11:05:39 +0200	[thread overview]
Message-ID: <Yl57Y6f/6KqwMRlE@vergenet.net> (raw)
In-Reply-To: <20220415163912.26530-3-xiangxia.m.yue@gmail.com>

On Sat, Apr 16, 2022 at 12:39:12AM +0800, xiangxia.m.yue@gmail.com wrote:
> From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> 
> This patch introdues the SYSCTL_THREE.

...

> diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
> index 7d9cfc730bd4..5851c2a92c0d 100644
> --- a/fs/proc/proc_sysctl.c
> +++ b/fs/proc/proc_sysctl.c
> @@ -26,7 +26,7 @@ static const struct file_operations proc_sys_dir_file_operations;
>  static const struct inode_operations proc_sys_dir_operations;
>  
>  /* shared constants to be used in various sysctls */
> -const int sysctl_vals[] = { -1, 0, 1, 2, 4, 100, 200, 1000, 3000, INT_MAX, 65535 };
> +const int sysctl_vals[] = { 0, 1, 2, 3, 4, 100, 200, 1000, 3000, INT_MAX, 65535, -1 };
>  EXPORT_SYMBOL(sysctl_vals);
>  
>  const unsigned long sysctl_long_vals[] = { 0, 1, LONG_MAX };
> diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
> index 6353d6db69b2..80263f7cdb77 100644
> --- a/include/linux/sysctl.h
> +++ b/include/linux/sysctl.h
> @@ -38,10 +38,10 @@ struct ctl_table_header;
>  struct ctl_dir;
>  
>  /* Keep the same order as in fs/proc/proc_sysctl.c */
> -#define SYSCTL_NEG_ONE			((void *)&sysctl_vals[0])
> -#define SYSCTL_ZERO			((void *)&sysctl_vals[1])
> -#define SYSCTL_ONE			((void *)&sysctl_vals[2])
> -#define SYSCTL_TWO			((void *)&sysctl_vals[3])
> +#define SYSCTL_ZERO			((void *)&sysctl_vals[0])
> +#define SYSCTL_ONE			((void *)&sysctl_vals[1])
> +#define SYSCTL_TWO			((void *)&sysctl_vals[2])
> +#define SYSCTL_THREE			((void *)&sysctl_vals[3])
>  #define SYSCTL_FOUR			((void *)&sysctl_vals[4])
>  #define SYSCTL_ONE_HUNDRED		((void *)&sysctl_vals[5])
>  #define SYSCTL_TWO_HUNDRED		((void *)&sysctl_vals[6])
> @@ -51,6 +51,7 @@ struct ctl_dir;
>  
>  /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
>  #define SYSCTL_MAXOLDUID		((void *)&sysctl_vals[10])
> +#define SYSCTL_NEG_ONE			((void *)&sysctl_vals[11])
>  
>  extern const int sysctl_vals[];

...

> diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
> index 7f645328b47f..efab2b06d373 100644
> --- a/net/netfilter/ipvs/ip_vs_ctl.c
> +++ b/net/netfilter/ipvs/ip_vs_ctl.c
> @@ -1767,8 +1767,6 @@ static int ip_vs_zero_all(struct netns_ipvs *ipvs)
>  
>  #ifdef CONFIG_SYSCTL
>  
> -static int three = 3;
> -
>  static int
>  proc_do_defense_mode(struct ctl_table *table, int write,
>  		     void *buffer, size_t *lenp, loff_t *ppos)
> @@ -1977,7 +1975,7 @@ static struct ctl_table vs_vars[] = {
>  		.mode		= 0644,
>  		.proc_handler	= proc_dointvec_minmax,
>  		.extra1		= SYSCTL_ZERO,
> -		.extra2		= &three,
> +		.extra2		= SYSCTL_THREE,
>  	},
>  	{
>  		.procname	= "nat_icmp_send",

Subjectively, I'm ambivalent towards the merit of this patchset,
perhaps there is some justification for it that I missed.

Objectively, I don't see anything here that would break IPVS.

IPVS portion:

Reviewed-by: Simon Horman <horms@verge.net.au>


  reply	other threads:[~2022-04-19  9:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-15 16:39 [PATCH v3 0/2] use standard sysctl macro xiangxia.m.yue
2022-04-15 16:39 ` [PATCH v3 1/2] net: sysctl: use shared " xiangxia.m.yue
2022-04-15 16:39 ` [PATCH v3 2/2] net: sysctl: introduce sysctl SYSCTL_THREE xiangxia.m.yue
2022-04-19  9:05   ` Simon Horman [this message]
2022-04-20 12:43   ` Tonghao Zhang
2022-04-20 19:56     ` Luis Chamberlain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yl57Y6f/6KqwMRlE@vergenet.net \
    --to=horms@verge.net.au \
    --cc=ast@kernel.org \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=dvyukov@google.com \
    --cc=edumazet@google.com \
    --cc=fw@strlen.de \
    --cc=hmukos@yandex-team.ru \
    --cc=ja@ssi.bg \
    --cc=kadlec@netfilter.org \
    --cc=keescook@chromium.org \
    --cc=kuba@kernel.org \
    --cc=lmb@cloudflare.com \
    --cc=mcgrof@kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=xiangxia.m.yue@gmail.com \
    --cc=yoshfuji@linux-ipv6.org \
    --cc=yzaikin@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox