Hi Alexander,

Quick bike-shed followup below.

Alexander Bluhm <alexander.bl...@gmx.net> writes:

> Index: netinet/ip_input.c
> ===================================================================
> RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/ip_input.c,v
> retrieving revision 1.356
> diff -u -p -r1.356 ip_input.c
> --- netinet/ip_input.c        30 Mar 2021 08:37:10 -0000      1.356
> +++ netinet/ip_input.c        23 Apr 2021 17:23:09 -0000
> @@ -126,7 +126,6 @@ const struct sysctl_bounded_args ipctl_v
>       { IPCTL_IPPORT_MAXQUEUE, &ip_maxqueue, 0, 10000 },
>       { IPCTL_MFORWARDING, &ipmforwarding, 0, 1 },
>       { IPCTL_MULTIPATH, &ipmultipath, 0, 1 },

-       { IPCTL_ARPQUEUED, &la_hold_total, 0, 1000 },
+       { IPCTL_ARPQUEUED, &la_hold_total, 1, 0 },

Will make la_hold_total read-only via sysctl.

If there's a good way to document this magic in sysctl_int(9) I'll
happily add something. I converted all the cases of sysctl_rdint I found
reasonable last year.

In the meantime, does this look OK?

>From cc944436f4569ef28fa338626bd90c5f6e6a44a7 Mon Sep 17 00:00:00 2001
From: Greg Steuck <g...@lenny.nest.cx>
Date: Sun, 25 Apr 2021 10:01:03 -0700
Subject: [PATCH] Use sysctl_bounded_args magic to make IPCTL_ARPQUEUED
 read-only

---
 sys/netinet/ip_input.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index 7578303d544..5d43458ac88 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -126,6 +126,7 @@ const struct sysctl_bounded_args ipctl_vars[] = {
        { IPCTL_IPPORT_MAXQUEUE, &ip_maxqueue, 0, 10000 },
        { IPCTL_MFORWARDING, &ipmforwarding, 0, 1 },
        { IPCTL_MULTIPATH, &ipmultipath, 0, 1 },
+       { IPCTL_ARPQUEUED, &la_hold_total, 1, 0 },
        { IPCTL_ARPTIMEOUT, &arpt_keep, 0, INT_MAX },
        { IPCTL_ARPDOWN, &arpt_down, 0, INT_MAX },
 };
@@ -1643,8 +1644,6 @@ ip_sysctl(int *name, u_int namelen, void *oldp, size_t 
*oldlenp, void *newp,
        case IPCTL_ARPQUEUE:
                return (sysctl_niq(name + 1, namelen - 1,
                    oldp, oldlenp, newp, newlen, &arpinq));
-       case IPCTL_ARPQUEUED:
-               return (sysctl_rdint(oldp, oldlenp, newp, la_hold_total));
        case IPCTL_STATS:
                return (ip_sysctl_ipstat(oldp, oldlenp, newp));
 #ifdef MROUTING
-- 
2.31.1

Reply via email to