summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2017-05-17 09:00:09 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2017-05-17 09:00:09 +0000
commit5f166e3d1d51a3d4ec54d8ebe7a1ed2ed2d02dc1 (patch)
treea4d5c316e2312ba387c8f4fd29bbb8dd897eea06
parent937eece798a15c47b36c7f957193490b4de1fb57 (diff)
Protect the global list of interfaces with the NET_LOCK().
ok bluhm@
-rw-r--r--sys/net/if_gif.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c
index c28a089d632..400e4a1e0a2 100644
--- a/sys/net/if_gif.c
+++ b/sys/net/if_gif.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_gif.c,v 1.94 2017/05/04 15:00:24 bluhm Exp $ */
+/* $OpenBSD: if_gif.c,v 1.95 2017/05/17 09:00:08 mpi Exp $ */
/* $KAME: if_gif.c,v 1.43 2001/02/20 08:51:07 itojun Exp $ */
/*
@@ -129,9 +129,9 @@ gif_clone_create(struct if_clone *ifc, int unit)
#if NBPFILTER > 0
bpfattach(&sc->gif_if.if_bpf, &sc->gif_if, DLT_LOOP, sizeof(u_int32_t));
#endif
- s = splnet();
+ NET_LOCK(s);
LIST_INSERT_HEAD(&gif_softc_list, sc, gif_list);
- splx(s);
+ NET_UNLOCK(s);
return (0);
}
@@ -142,9 +142,9 @@ gif_clone_destroy(struct ifnet *ifp)
struct gif_softc *sc = ifp->if_softc;
int s;
- s = splnet();
+ NET_LOCK(s);
LIST_REMOVE(sc, gif_list);
- splx(s);
+ NET_UNLOCK(s);
if_detach(ifp);
@@ -323,7 +323,6 @@ gif_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
int error = 0, size;
struct sockaddr *dst, *src;
struct sockaddr *sa;
- int s;
struct gif_softc *sc2;
switch (cmd) {
@@ -466,10 +465,8 @@ gif_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
bcopy((caddr_t)dst, (caddr_t)sa, dst->sa_len);
sc->gif_pdst = sa;
- s = splnet();
ifp->if_flags |= IFF_RUNNING;
if_up(ifp); /* send up RTM_IFINFO */
- splx(s);
error = 0;
break;