diff options
author | 2017-01-30 17:41:33 +0000 | |
---|---|---|
committer | 2017-01-30 17:41:33 +0000 | |
commit | 3a1c295ed4e6b77c7216d126b9ceefff0504ff4c (patch) | |
tree | 918444b214e406272a1875b7d076373d76790122 /sys/net/pf_ioctl.c | |
parent | Mention MODGO_LDFLAGS. (diff) | |
download | wireguard-openbsd-3a1c295ed4e6b77c7216d126b9ceefff0504ff4c.tar.xz wireguard-openbsd-3a1c295ed4e6b77c7216d126b9ceefff0504ff4c.zip |
removes the pf_consistency_lock and protects the users with
NET_LOCK(). pfioctl() will need the NET_LOCK() anyway. So better keep
things simple until we're going to redesign PF for a MP world.
fixes the crash reported by Kaya Saman.
ok mpi@, bluhm@
Diffstat (limited to 'sys/net/pf_ioctl.c')
-rw-r--r-- | sys/net/pf_ioctl.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/sys/net/pf_ioctl.c b/sys/net/pf_ioctl.c index 9b278c907f5..56a43a55ab8 100644 --- a/sys/net/pf_ioctl.c +++ b/sys/net/pf_ioctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf_ioctl.c,v 1.306 2017/01/24 10:08:30 krw Exp $ */ +/* $OpenBSD: pf_ioctl.c,v 1.307 2017/01/30 17:41:34 benno Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -111,7 +111,6 @@ void pf_qid2qname(u_int16_t, char *); void pf_qid_unref(u_int16_t); struct pf_rule pf_default_rule, pf_default_rule_new; -struct rwlock pf_consistency_lock = RWLOCK_INITIALIZER("pfcnslk"); struct { char statusif[IFNAMSIZ]; @@ -987,12 +986,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) return (EACCES); } - if (flags & FWRITE) - rw_enter_write(&pf_consistency_lock); - else - rw_enter_read(&pf_consistency_lock); - - s = splsoftnet(); + NET_LOCK(s); switch (cmd) { case DIOCSTART: @@ -2388,11 +2382,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) break; } fail: - splx(s); - if (flags & FWRITE) - rw_exit_write(&pf_consistency_lock); - else - rw_exit_read(&pf_consistency_lock); + NET_UNLOCK(s); return (error); } |