From: wen.yang@linux.dev
To: Joel Granados <joel.granados@kernel.org>
Cc: Wen Yang <wen.yang@linux.dev>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [RFC PATCH 28/39] net: refresh fragment and remaining dynamic sysctl bounds
Date: Thu, 29 Oct 2026 00:35:07 +0800 [thread overview]
Message-ID: <7f73097867aefe32de84aa588eb4f20866fb431c.1793204511.git.wen.yang@linux.dev> (raw)
In-Reply-To: <cover.1793204511.git.wen.yang@linux.dev>
From: Wen Yang <wen.yang@linux.dev>
Refresh fragment sibling thresholds and use numeric Phonet bounds.
Suggested-by: Joel Granados <joel.granados@kernel.org>
Signed-off-by: Wen Yang <wen.yang@linux.dev>
---
net/ieee802154/6lowpan/reassembly.c | 27 +++++++++++++++++----
net/ipv4/ip_fragment.c | 31 +++++++++++++++++++------
net/ipv6/netfilter/nf_conntrack_reasm.c | 27 +++++++++++++++++----
net/ipv6/reassembly.c | 27 +++++++++++++++++----
net/phonet/sysctl.c | 6 ++---
5 files changed, 92 insertions(+), 26 deletions(-)
diff --git a/net/ieee802154/6lowpan/reassembly.c b/net/ieee802154/6lowpan/reassembly.c
index a2167f76ecc3..00b328378d19 100644
--- a/net/ieee802154/6lowpan/reassembly.c
+++ b/net/ieee802154/6lowpan/reassembly.c
@@ -10,7 +10,6 @@
#define pr_fmt(fmt) "6LoWPAN: " fmt
#include <linux/net.h>
-#include <linux/limits.h>
#include <linux/list.h>
#include <linux/netdevice.h>
#include <linux/random.h>
@@ -327,12 +326,32 @@ int lowpan_frag_rcv(struct sk_buff *skb, u8 frag_type)
#ifdef CONFIG_SYSCTL
+static int lowpan_frags_high_thresh_handler(const struct ctl_table *table,
+ int write, void *buffer, size_t *lenp, loff_t *ppos)
+{
+ struct fqdir *fqdir = container_of(table->data, struct fqdir, high_thresh);
+ struct ctl_table tmp = *table;
+
+ tmp.min = READ_ONCE(fqdir->low_thresh);
+ return proc_doulongvec_minmax(&tmp, write, buffer, lenp, ppos);
+}
+
+static int lowpan_frags_low_thresh_handler(const struct ctl_table *table,
+ int write, void *buffer, size_t *lenp, loff_t *ppos)
+{
+ struct fqdir *fqdir = container_of(table->data, struct fqdir, low_thresh);
+ struct ctl_table tmp = *table;
+
+ tmp.max = READ_ONCE(fqdir->high_thresh);
+ return proc_doulongvec_minmax(&tmp, write, buffer, lenp, ppos);
+}
+
static struct ctl_table lowpan_frags_ns_ctl_table[] = {
{
.procname = "6lowpanfrag_high_thresh",
.maxlen = sizeof(unsigned long),
.mode = 0644,
- .proc_handler = proc_doulongvec_minmax,
+ .proc_handler = lowpan_frags_high_thresh_handler,
.min = 0,
.max = ULONG_MAX,
},
@@ -340,7 +359,7 @@ static struct ctl_table lowpan_frags_ns_ctl_table[] = {
.procname = "6lowpanfrag_low_thresh",
.maxlen = sizeof(unsigned long),
.mode = 0644,
- .proc_handler = proc_doulongvec_minmax,
+ .proc_handler = lowpan_frags_low_thresh_handler,
.min = 0,
.max = ULONG_MAX,
},
@@ -385,9 +404,7 @@ static int __net_init lowpan_frags_ns_sysctl_register(struct net *net)
}
table[0].data = &ieee802154_lowpan->fqdir->high_thresh;
- table[0].extra1 = &ieee802154_lowpan->fqdir->low_thresh;
table[1].data = &ieee802154_lowpan->fqdir->low_thresh;
- table[1].extra2 = &ieee802154_lowpan->fqdir->high_thresh;
table[2].data = &ieee802154_lowpan->fqdir->timeout;
hdr = register_net_sysctl_sz(net, "net/ieee802154/6lowpan", table,
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index 75bc675e5579..c01df071240a 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -24,7 +24,6 @@
#define pr_fmt(fmt) "IPv4: " fmt
#include <linux/compiler.h>
-#include <linux/limits.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/mm.h>
@@ -544,14 +543,33 @@ struct sk_buff *ip_check_defrag(struct net *net, struct sk_buff *skb, u32 user)
EXPORT_SYMBOL(ip_check_defrag);
#ifdef CONFIG_SYSCTL
-static int dist_min;
+
+static int ip4_frags_high_thresh_handler(const struct ctl_table *table,
+ int write, void *buffer, size_t *lenp, loff_t *ppos)
+{
+ struct fqdir *fqdir = container_of(table->data, struct fqdir, high_thresh);
+ struct ctl_table tmp = *table;
+
+ tmp.min = READ_ONCE(fqdir->low_thresh);
+ return proc_doulongvec_minmax(&tmp, write, buffer, lenp, ppos);
+}
+
+static int ip4_frags_low_thresh_handler(const struct ctl_table *table,
+ int write, void *buffer, size_t *lenp, loff_t *ppos)
+{
+ struct fqdir *fqdir = container_of(table->data, struct fqdir, low_thresh);
+ struct ctl_table tmp = *table;
+
+ tmp.max = READ_ONCE(fqdir->high_thresh);
+ return proc_doulongvec_minmax(&tmp, write, buffer, lenp, ppos);
+}
static struct ctl_table ip4_frags_ns_ctl_table[] = {
{
.procname = "ipfrag_high_thresh",
.maxlen = sizeof(unsigned long),
.mode = 0644,
- .proc_handler = proc_doulongvec_minmax,
+ .proc_handler = ip4_frags_high_thresh_handler,
.min = 0,
.max = ULONG_MAX,
},
@@ -559,7 +577,7 @@ static struct ctl_table ip4_frags_ns_ctl_table[] = {
.procname = "ipfrag_low_thresh",
.maxlen = sizeof(unsigned long),
.mode = 0644,
- .proc_handler = proc_doulongvec_minmax,
+ .proc_handler = ip4_frags_low_thresh_handler,
.min = 0,
.max = ULONG_MAX,
},
@@ -574,7 +592,8 @@ static struct ctl_table ip4_frags_ns_ctl_table[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec_minmax,
- .extra1 = &dist_min,
+ .min = 0,
+ .max = INT_MAX,
},
};
@@ -603,9 +622,7 @@ static int __net_init ip4_frags_ns_ctl_register(struct net *net)
}
table[0].data = &net->ipv4.fqdir->high_thresh;
- table[0].extra1 = &net->ipv4.fqdir->low_thresh;
table[1].data = &net->ipv4.fqdir->low_thresh;
- table[1].extra2 = &net->ipv4.fqdir->high_thresh;
table[2].data = &net->ipv4.fqdir->timeout;
table[3].data = &net->ipv4.fqdir->max_dist;
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
index 1f3ba85f6dca..4cb69dc14b11 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -13,7 +13,6 @@
#define pr_fmt(fmt) "IPv6-nf: " fmt
#include <linux/errno.h>
-#include <linux/limits.h>
#include <linux/types.h>
#include <linux/string.h>
#include <linux/net.h>
@@ -44,6 +43,26 @@ static struct nft_ct_frag6_pernet *nf_frag_pernet(struct net *net)
#ifdef CONFIG_SYSCTL
+static int nf_ct_frag6_high_thresh_handler(const struct ctl_table *table,
+ int write, void *buffer, size_t *lenp, loff_t *ppos)
+{
+ struct fqdir *fqdir = container_of(table->data, struct fqdir, high_thresh);
+ struct ctl_table tmp = *table;
+
+ tmp.min = READ_ONCE(fqdir->low_thresh);
+ return proc_doulongvec_minmax(&tmp, write, buffer, lenp, ppos);
+}
+
+static int nf_ct_frag6_low_thresh_handler(const struct ctl_table *table,
+ int write, void *buffer, size_t *lenp, loff_t *ppos)
+{
+ struct fqdir *fqdir = container_of(table->data, struct fqdir, low_thresh);
+ struct ctl_table tmp = *table;
+
+ tmp.max = READ_ONCE(fqdir->high_thresh);
+ return proc_doulongvec_minmax(&tmp, write, buffer, lenp, ppos);
+}
+
static struct ctl_table nf_ct_frag6_sysctl_table[] = {
{
.procname = "nf_conntrack_frag6_timeout",
@@ -55,7 +74,7 @@ static struct ctl_table nf_ct_frag6_sysctl_table[] = {
.procname = "nf_conntrack_frag6_low_thresh",
.maxlen = sizeof(unsigned long),
.mode = 0644,
- .proc_handler = proc_doulongvec_minmax,
+ .proc_handler = nf_ct_frag6_low_thresh_handler,
.min = 0,
.max = ULONG_MAX,
},
@@ -63,7 +82,7 @@ static struct ctl_table nf_ct_frag6_sysctl_table[] = {
.procname = "nf_conntrack_frag6_high_thresh",
.maxlen = sizeof(unsigned long),
.mode = 0644,
- .proc_handler = proc_doulongvec_minmax,
+ .proc_handler = nf_ct_frag6_high_thresh_handler,
.min = 0,
.max = ULONG_MAX,
},
@@ -87,9 +106,7 @@ static int nf_ct_frag6_sysctl_register(struct net *net)
table[0].data = &nf_frag->fqdir->timeout;
table[1].data = &nf_frag->fqdir->low_thresh;
- table[1].extra2 = &nf_frag->fqdir->high_thresh;
table[2].data = &nf_frag->fqdir->high_thresh;
- table[2].extra1 = &nf_frag->fqdir->low_thresh;
hdr = register_net_sysctl_sz(net, "net/netfilter", table,
ARRAY_SIZE(nf_ct_frag6_sysctl_table));
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index 70c845385744..99b819f0cbf5 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -26,7 +26,6 @@
#define pr_fmt(fmt) "IPv6: " fmt
#include <linux/errno.h>
-#include <linux/limits.h>
#include <linux/types.h>
#include <linux/string.h>
#include <linux/socket.h>
@@ -422,12 +421,32 @@ static const struct inet6_protocol frag_protocol = {
#ifdef CONFIG_SYSCTL
+static int ip6_frags_high_thresh_handler(const struct ctl_table *table,
+ int write, void *buffer, size_t *lenp, loff_t *ppos)
+{
+ struct fqdir *fqdir = container_of(table->data, struct fqdir, high_thresh);
+ struct ctl_table tmp = *table;
+
+ tmp.min = READ_ONCE(fqdir->low_thresh);
+ return proc_doulongvec_minmax(&tmp, write, buffer, lenp, ppos);
+}
+
+static int ip6_frags_low_thresh_handler(const struct ctl_table *table,
+ int write, void *buffer, size_t *lenp, loff_t *ppos)
+{
+ struct fqdir *fqdir = container_of(table->data, struct fqdir, low_thresh);
+ struct ctl_table tmp = *table;
+
+ tmp.max = READ_ONCE(fqdir->high_thresh);
+ return proc_doulongvec_minmax(&tmp, write, buffer, lenp, ppos);
+}
+
static struct ctl_table ip6_frags_ns_ctl_table[] = {
{
.procname = "ip6frag_high_thresh",
.maxlen = sizeof(unsigned long),
.mode = 0644,
- .proc_handler = proc_doulongvec_minmax,
+ .proc_handler = ip6_frags_high_thresh_handler,
.min = 0,
.max = ULONG_MAX,
},
@@ -435,7 +454,7 @@ static struct ctl_table ip6_frags_ns_ctl_table[] = {
.procname = "ip6frag_low_thresh",
.maxlen = sizeof(unsigned long),
.mode = 0644,
- .proc_handler = proc_doulongvec_minmax,
+ .proc_handler = ip6_frags_low_thresh_handler,
.min = 0,
.max = ULONG_MAX,
},
@@ -472,9 +491,7 @@ static int __net_init ip6_frags_ns_sysctl_register(struct net *net)
}
table[0].data = &net->ipv6.fqdir->high_thresh;
- table[0].extra1 = &net->ipv6.fqdir->low_thresh;
table[1].data = &net->ipv6.fqdir->low_thresh;
- table[1].extra2 = &net->ipv6.fqdir->high_thresh;
table[2].data = &net->ipv6.fqdir->timeout;
hdr = register_net_sysctl_sz(net, "net/ipv6", table,
diff --git a/net/phonet/sysctl.c b/net/phonet/sysctl.c
index 463a74a27d3e..fe2893b07e2a 100644
--- a/net/phonet/sysctl.c
+++ b/net/phonet/sysctl.c
@@ -22,8 +22,6 @@
#define DYNAMIC_PORT_MAX 0x7f
static DEFINE_SEQLOCK(local_port_range_lock);
-static int local_port_range_min[2] = {0, 0};
-static int local_port_range_max[2] = {1023, 1023};
static int local_port_range[2] = {DYNAMIC_PORT_MIN, DYNAMIC_PORT_MAX};
static struct ctl_table_header *phonet_table_hrd;
@@ -57,8 +55,8 @@ static int proc_local_port_range(const struct ctl_table *table, int write,
.data = &range,
.maxlen = sizeof(range),
.mode = table->mode,
- .extra1 = &local_port_range_min,
- .extra2 = &local_port_range_max,
+ .min = 0,
+ .max = 1023,
};
ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos);
--
2.25.1
next prev parent reply other threads:[~2026-10-28 16:38 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 16:34 [RFC PATCH 00/39] sysctl: replace overloaded extra pointers with typed bounds and context wen.yang
2026-10-28 16:34 ` [RFC PATCH 01/39] " wen.yang
2026-10-28 21:09 ` David Laight
2026-10-28 16:34 ` [RFC PATCH 02/39] test_sysctl: convert bounds to numeric values wen.yang
2026-10-28 16:34 ` [RFC PATCH 03/39] sysctl: add KUnit coverage for numeric bounds and handlers wen.yang
2026-10-28 16:34 ` [RFC PATCH 04/39] sysctl: cover runtime ranges and context lifecycles in KUnit wen.yang
2026-10-28 16:34 ` [RFC PATCH 05/39] sysctl: cover priv in KUnit and the debug test module wen.yang
2026-10-28 16:34 ` [RFC PATCH 06/39] sysctl: convert core table bounds to numeric values wen.yang
2026-10-28 16:34 ` [RFC PATCH 07/39] sysctl: store architecture sysctl bounds by value wen.yang
2026-10-28 16:34 ` [RFC PATCH 08/39] sysctl: store crypto " wen.yang
2026-10-28 16:34 ` [RFC PATCH 09/39] sysctl: store device " wen.yang
2026-10-28 16:34 ` [RFC PATCH 10/39] sysctl: store filesystem " wen.yang
2026-10-28 16:34 ` [RFC PATCH 11/39] sysctl: store message-queue " wen.yang
2026-10-28 16:34 ` [RFC PATCH 12/39] sysctl: store kernel " wen.yang
2026-10-28 16:34 ` [RFC PATCH 13/39] sysctl: store memory-management " wen.yang
2026-10-28 16:34 ` [RFC PATCH 14/39] sysctl: store IPv6 scalar " wen.yang
2026-10-28 16:34 ` [RFC PATCH 15/39] sysctl: store netfilter " wen.yang
2026-10-28 16:34 ` [RFC PATCH 16/39] sysctl: store RPC " wen.yang
2026-10-28 16:34 ` [RFC PATCH 17/39] sysctl: store remaining network " wen.yang
2026-10-28 16:34 ` [RFC PATCH 18/39] sysctl: store security " wen.yang
2026-10-28 16:34 ` [RFC PATCH 19/39] io_uring: store its " wen.yang
2026-10-28 16:34 ` [RFC PATCH 20/39] sysctl: refresh dynamic scheduler and PID bounds per call wen.yang
2026-10-28 16:35 ` [RFC PATCH 21/39] sysctl: refresh device-dependent " wen.yang
2026-10-28 16:35 ` [RFC PATCH 22/39] sysctl: refresh namespace IPC " wen.yang
2026-10-28 16:35 ` [RFC PATCH 23/39] yama: preserve scope locking with numeric sysctl bounds wen.yang
2026-10-28 16:35 ` [RFC PATCH 24/39] net: refresh core sysctl limits without bound pointers wen.yang
2026-10-28 16:35 ` [RFC PATCH 25/39] sctp: resolve numeric ranges from the current namespace wen.yang
2026-10-28 16:35 ` [RFC PATCH 26/39] rds: preserve live reconnect limits with numeric bounds wen.yang
2026-10-28 16:35 ` [RFC PATCH 27/39] ipv4: preserve live and vector bounds with numeric sysctls wen.yang
2026-10-28 16:35 ` wen.yang [this message]
2026-10-28 16:35 ` [RFC PATCH 29/39] neighbour: derive sysctl ownership independently of bounds wen.yang
2026-10-28 16:35 ` [RFC PATCH 30/39] net: resolve sysctl owners from their backing data wen.yang
2026-10-28 16:35 ` [RFC PATCH 31/39] ipvs: derive sysctl ownership from numeric storage wen.yang
2026-10-28 16:35 ` [RFC PATCH 32/39] sysctl: remove obsolete nr_open bound variables wen.yang
2026-10-28 16:35 ` [RFC PATCH 33/39] ipv6: move address sysctl context to priv wen.yang
2026-10-28 16:35 ` [RFC PATCH 34/39] ipv4: move device " wen.yang
2026-10-28 16:35 ` [RFC PATCH 35/39] netfilter: move logger " wen.yang
2026-10-28 16:35 ` [RFC PATCH 36/39] parport: move device " wen.yang
2026-10-28 16:35 ` [RFC PATCH 37/39] net: move namespace " wen.yang
2026-10-28 16:35 ` [RFC PATCH 38/39] arm64: move vector-length " wen.yang
2026-10-28 16:35 ` [RFC PATCH 39/39] sysctl: remove the extra pointers and the compatibility bounds read wen.yang
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=7f73097867aefe32de84aa588eb4f20866fb431c.1793204511.git.wen.yang@linux.dev \
--to=wen.yang@linux.dev \
--cc=joel.granados@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®