diff options
author | Vitaliy Makkoveev <mvs@cvs.openbsd.org> | 2023-05-16 19:36:01 +0000 |
---|---|---|
committer | Vitaliy Makkoveev <mvs@cvs.openbsd.org> | 2023-05-16 19:36:01 +0000 |
commit | c4fa174482958ee12e7883ee118d2812f1d27a25 (patch) | |
tree | 210180e03ee20000644e7903611429efae679257 /sys/netinet/ip_input.c | |
parent | b804e52956635d79054cf71c2350f366463a95a1 (diff) |
Introduce temporary PR_MPSYSCTL flag to mark (*pr_sysctl)() handler MP
safe. We have may of them, so use flag instead of pushing kernel lock
within.
Unlock ip_sysctl(). Still take kernel lock within IPCTL_MRTSTATS case.
It looks like `mrtstat' protection is inconsistent, so keep locking as
it was. Since `mrtstat' are counters, it make sense to rework them into
per CPU counters with separate diffs.
Feedback and ok from bluhm@
Diffstat (limited to 'sys/netinet/ip_input.c')
-rw-r--r-- | sys/netinet/ip_input.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 42c1c72d78d..cfa703cca3e 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_input.c,v 1.383 2023/04/05 21:51:47 bluhm Exp $ */ +/* $OpenBSD: ip_input.c,v 1.384 2023/05/16 19:36:00 mvs Exp $ */ /* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */ /* @@ -1704,8 +1704,11 @@ ip_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, return (ip_sysctl_ipstat(oldp, oldlenp, newp)); #ifdef MROUTING case IPCTL_MRTSTATS: - return (sysctl_rdstruct(oldp, oldlenp, newp, - &mrtstat, sizeof(mrtstat))); + KERNEL_LOCK(); + error = sysctl_rdstruct(oldp, oldlenp, newp, + &mrtstat, sizeof(mrtstat)); + KERNEL_UNLOCK(); + return (error); case IPCTL_MRTMFC: if (newp) return (EPERM); |