summaryrefslogtreecommitdiffstats
path: root/sys/netinet6
diff options
context:
space:
mode:
authorbluhm <bluhm@openbsd.org>2016-12-20 18:33:43 +0000
committerbluhm <bluhm@openbsd.org>2016-12-20 18:33:43 +0000
commit4eb8db84bc9d6a660b66b3f79301db47bc24b926 (patch)
tree0ccaf106b2bfb5c91eb9a0858f2bd9eae444e8c1 /sys/netinet6
parentIn midiread() and midiwrite(), add a second goto label to (diff)
downloadwireguard-openbsd-4eb8db84bc9d6a660b66b3f79301db47bc24b926.tar.xz
wireguard-openbsd-4eb8db84bc9d6a660b66b3f79301db47bc24b926.zip
A NET_LOCK() was is missing in tcp_sysctl() which shows up as spl
softnet assert failures. It is better to place the lock into net_sysctl() where all the protocol sysctls are called via pr_sysctl. As calling sysctl(2) is in the slow path, doing fine grained locking has no benefit. Many sysctl cases copy out a struct. Having a lock around that keeps the struct consistent. Put assertions in the protocol sysctls that need it. OK mpi@
Diffstat (limited to 'sys/netinet6')
-rw-r--r--sys/netinet6/ip6_input.c11
-rw-r--r--sys/netinet6/nd6.c16
2 files changed, 10 insertions, 17 deletions
diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c
index 3643cedd8ea..ee25a811a43 100644
--- a/sys/netinet6/ip6_input.c
+++ b/sys/netinet6/ip6_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_input.c,v 1.171 2016/12/19 08:36:50 mpi Exp $ */
+/* $OpenBSD: ip6_input.c,v 1.172 2016/12/20 18:33:43 bluhm Exp $ */
/* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */
/*
@@ -1369,7 +1369,9 @@ ip6_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp,
extern int ip6_mrtproto;
extern struct mrt6stat mrt6stat;
#endif
- int error, s;
+ int error;
+
+ NET_ASSERT_LOCKED();
/* Almost all sysctl names at this level are terminal. */
if (namelen != 1 && name[0] != IPV6CTL_IFQUEUE)
@@ -1409,12 +1411,9 @@ ip6_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp,
case IPV6CTL_MTUDISCTIMEOUT:
error = sysctl_int(oldp, oldlenp, newp, newlen,
&ip6_mtudisc_timeout);
- if (icmp6_mtudisc_timeout_q != NULL) {
- s = splsoftnet();
+ if (icmp6_mtudisc_timeout_q != NULL)
rt_timer_queue_change(icmp6_mtudisc_timeout_q,
ip6_mtudisc_timeout);
- splx(s);
- }
return (error);
case IPV6CTL_IFQUEUE:
return (sysctl_niq(name + 1, namelen - 1,
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
index 0f0c83b2400..cf59c02f31e 100644
--- a/sys/netinet6/nd6.c
+++ b/sys/netinet6/nd6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6.c,v 1.198 2016/12/19 08:36:50 mpi Exp $ */
+/* $OpenBSD: nd6.c,v 1.199 2016/12/20 18:33:43 bluhm Exp $ */
/* $KAME: nd6.c,v 1.280 2002/06/08 19:52:07 itojun Exp $ */
/*
@@ -1639,6 +1639,8 @@ nd6_sysctl(int name, void *oldp, size_t *oldlenp, void *newp, size_t newlen)
size_t ol;
int error;
+ NET_ASSERT_LOCKED();
+
error = 0;
if (newp)
@@ -1678,14 +1680,12 @@ nd6_sysctl(int name, void *oldp, size_t *oldlenp, void *newp, size_t newlen)
int
fill_drlist(void *oldp, size_t *oldlenp, size_t ol)
{
- int error = 0, s;
+ int error = 0;
struct in6_defrouter *d = NULL, *de = NULL;
struct nd_defrouter *dr;
time_t expire;
size_t l;
- s = splsoftnet();
-
if (oldp) {
d = (struct in6_defrouter *)oldp;
de = (struct in6_defrouter *)((caddr_t)oldp + *oldlenp);
@@ -1721,22 +1721,18 @@ fill_drlist(void *oldp, size_t *oldlenp, size_t ol)
} else
*oldlenp = l;
- splx(s);
-
return (error);
}
int
fill_prlist(void *oldp, size_t *oldlenp, size_t ol)
{
- int error = 0, s;
+ int error = 0;
struct nd_prefix *pr;
char *p = NULL, *ps = NULL;
char *pe = NULL;
size_t l;
- s = splsoftnet();
-
if (oldp) {
ps = p = (char *)oldp;
pe = (char *)oldp + *oldlenp;
@@ -1817,7 +1813,5 @@ fill_prlist(void *oldp, size_t *oldlenp, size_t ol)
} else
*oldlenp = l;
- splx(s);
-
return (error);
}