diff options
author | 2017-10-09 08:35:38 +0000 | |
---|---|---|
committer | 2017-10-09 08:35:38 +0000 | |
commit | df4a15bc1fe47e27f4c1e62e865ee303c6e12c79 (patch) | |
tree | a59104b5975da8c5e1e2cfb35e2bffb33fc729ab /sys/netinet/ip_ipip.c | |
parent | Correct logic check preventing the device to attach. (diff) | |
download | wireguard-openbsd-df4a15bc1fe47e27f4c1e62e865ee303c6e12c79.tar.xz wireguard-openbsd-df4a15bc1fe47e27f4c1e62e865ee303c6e12c79.zip |
Reduces the scope of the NET_LOCK() in sysctl(2) path.
Exposes per-CPU counters to real parrallelism.
ok visa@, bluhm@, jca@
Diffstat (limited to 'sys/netinet/ip_ipip.c')
-rw-r--r-- | sys/netinet/ip_ipip.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/netinet/ip_ipip.c b/sys/netinet/ip_ipip.c index 1eb94e06d70..7b552557586 100644 --- a/sys/netinet/ip_ipip.c +++ b/sys/netinet/ip_ipip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ipip.c,v 1.86 2017/07/05 11:34:10 bluhm Exp $ */ +/* $OpenBSD: ip_ipip.c,v 1.87 2017/10/09 08:35:38 mpi Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -592,13 +592,18 @@ int ipip_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, size_t newlen) { + int error; + /* All sysctl names at this level are terminal. */ if (namelen != 1) return (ENOTDIR); switch (name[0]) { case IPIPCTL_ALLOW: - return (sysctl_int(oldp, oldlenp, newp, newlen, &ipip_allow)); + NET_LOCK(); + error = sysctl_int(oldp, oldlenp, newp, newlen, &ipip_allow); + NET_UNLOCK(); + return (error); case IPIPCTL_STATS: return (ipip_sysctl_ipipstat(oldp, oldlenp, newp)); default: |