aboutsummaryrefslogtreecommitdiff
path: root/kernel/sysctl.c
diff options
context:
space:
mode:
authorPaolo Abeni <pabeni@redhat.com>2022-06-30 13:14:38 +0200
committerPaolo Abeni <pabeni@redhat.com>2022-06-30 13:14:38 +0200
commitbf48c3fae6d78d6418f62bd3259cd62dd16f83ec (patch)
treec6ee46505746d9109d1e4aaff25c15a00b34da27 /kernel/sysctl.c
parentd19b4c52f7c99fdc5198a6f5885ba818245966cd (diff)
parent211da42eaa45db7b0edfde187dd88a85fbd466b5 (diff)
Merge branch 'net-neigh-introduce-interval_probe_time-for-periodic-probe'
Yuwei Wang says: ==================== net, neigh: introduce interval_probe_time for periodic probe This series adds a new option `interval_probe_time_ms` in net, neigh for periodic probe, and add a limitation to prevent it set to 0 ==================== Link: https://lore.kernel.org/r/20220629084832.2842973-1-wangyuweihx@gmail.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'kernel/sysctl.c')
-rw-r--r--kernel/sysctl.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index e52b6e372c60..85c92e2c2570 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1237,6 +1237,30 @@ static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp,
return 0;
}
+static int do_proc_dointvec_ms_jiffies_minmax_conv(bool *negp, unsigned long *lvalp,
+ int *valp, int write, void *data)
+{
+ int tmp, ret;
+ struct do_proc_dointvec_minmax_conv_param *param = data;
+ /*
+ * If writing, first do so via a temporary local int so we can
+ * bounds-check it before touching *valp.
+ */
+ int *ip = write ? &tmp : valp;
+
+ ret = do_proc_dointvec_ms_jiffies_conv(negp, lvalp, ip, write, data);
+ if (ret)
+ return ret;
+
+ if (write) {
+ if ((param->min && *param->min > tmp) ||
+ (param->max && *param->max < tmp))
+ return -EINVAL;
+ *valp = tmp;
+ }
+ return 0;
+}
+
/**
* proc_dointvec_jiffies - read a vector of integers as seconds
* @table: the sysctl table
@@ -1259,6 +1283,17 @@ int proc_dointvec_jiffies(struct ctl_table *table, int write,
do_proc_dointvec_jiffies_conv,NULL);
}
+int proc_dointvec_ms_jiffies_minmax(struct ctl_table *table, int write,
+ void *buffer, size_t *lenp, loff_t *ppos)
+{
+ struct do_proc_dointvec_minmax_conv_param param = {
+ .min = (int *) table->extra1,
+ .max = (int *) table->extra2,
+ };
+ return do_proc_dointvec(table, write, buffer, lenp, ppos,
+ do_proc_dointvec_ms_jiffies_minmax_conv, &param);
+}
+
/**
* proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
* @table: the sysctl table
@@ -1523,6 +1558,12 @@ int proc_dointvec_jiffies(struct ctl_table *table, int write,
return -ENOSYS;
}
+int proc_dointvec_ms_jiffies_minmax(struct ctl_table *table, int write,
+ void *buffer, size_t *lenp, loff_t *ppos)
+{
+ return -ENOSYS;
+}
+
int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
void *buffer, size_t *lenp, loff_t *ppos)
{