summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2017-08-12 20:27:29 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2017-08-12 20:27:29 +0000
commitf6a38e1bb80e3269c443288fcaae22c215d0ff1d (patch)
treeac30bae25e3013ad3b291a71ecb974a0ea708cf2 /sys/net
parente61dc1cee63f6c8912df0ea44e062727eecfa9f1 (diff)
Use the NET_LOCK() macro instead of handrolling it.
Tested by Hrvoje Popovski.
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if.c10
-rw-r--r--sys/net/if_pflow.c10
-rw-r--r--sys/net/if_pppx.c10
3 files changed, 14 insertions, 16 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 0f75f4e229a..b4b419dd845 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.510 2017/08/11 21:24:19 mpi Exp $ */
+/* $OpenBSD: if.c,v 1.511 2017/08/12 20:27:28 mpi Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -1176,9 +1176,9 @@ if_clone_create(const char *name, int rdomain)
return (EEXIST);
/* XXXSMP breaks atomicity */
- rw_exit_write(&netlock);
+ NET_UNLOCK();
ret = (*ifc->ifc_create)(ifc, unit);
- rw_enter_write(&netlock);
+ NET_LOCK();
if (ret != 0 || (ifp = ifunit(name)) == NULL)
return (ret);
@@ -1221,9 +1221,9 @@ if_clone_destroy(const char *name)
}
/* XXXSMP breaks atomicity */
- rw_exit_write(&netlock);
+ NET_UNLOCK();
ret = (*ifc->ifc_destroy)(ifp);
- rw_enter_write(&netlock);
+ NET_LOCK();
return (ret);
}
diff --git a/sys/net/if_pflow.c b/sys/net/if_pflow.c
index 1a89cbd111a..58899d81240 100644
--- a/sys/net/if_pflow.c
+++ b/sys/net/if_pflow.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pflow.c,v 1.82 2017/08/11 21:24:19 mpi Exp $ */
+/* $OpenBSD: if_pflow.c,v 1.83 2017/08/12 20:27:28 mpi Exp $ */
/*
* Copyright (c) 2011 Florian Obser <florian@narrans.de>
@@ -527,12 +527,11 @@ pflowioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
return (error);
/* XXXSMP breaks atomicity */
- rw_exit_write(&netlock);
+ NET_UNLOCK();
error = pflow_set(sc, &pflowr);
- if (error != 0) {
- rw_enter_write(&netlock);
+ NET_LOCK();
+ if (error != 0)
return (error);
- }
if ((ifp->if_flags & IFF_UP) && sc->so != NULL) {
ifp->if_flags |= IFF_RUNNING;
@@ -542,7 +541,6 @@ pflowioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
} else
ifp->if_flags &= ~IFF_RUNNING;
- rw_enter_write(&netlock);
break;
default:
diff --git a/sys/net/if_pppx.c b/sys/net/if_pppx.c
index aac69060956..c4df48c0f00 100644
--- a/sys/net/if_pppx.c
+++ b/sys/net/if_pppx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pppx.c,v 1.62 2017/08/11 21:24:19 mpi Exp $ */
+/* $OpenBSD: if_pppx.c,v 1.63 2017/08/12 20:27:28 mpi Exp $ */
/*
* Copyright (c) 2010 Claudio Jeker <claudio@openbsd.org>
@@ -855,9 +855,9 @@ pppx_add_session(struct pppx_dev *pxd, struct pipex_session_req *req)
pipex_timer_start();
/* XXXSMP breaks atomicity */
- rw_exit_write(&netlock);
+ NET_UNLOCK();
if_attach(ifp);
- rw_enter_write(&netlock);
+ NET_LOCK();
if_addgroup(ifp, "pppx");
if_alloc_sadl(ifp);
@@ -970,9 +970,9 @@ pppx_if_destroy(struct pppx_dev *pxd, struct pppx_if *pxi)
pipex_timer_stop();
/* XXXSMP breaks atomicity */
- rw_exit_write(&netlock);
+ NET_UNLOCK();
if_detach(ifp);
- rw_enter_write(&netlock);
+ NET_LOCK();
rw_enter_write(&pppx_ifs_lk);
if (RBT_REMOVE(pppx_ifs, &pppx_ifs, pxi) == NULL)