Similar to gre(4), the global list of interfaces needs to be protected by the NET_LOCK().
ok? Index: net/if_gif.c =================================================================== RCS file: /cvs/src/sys/net/if_gif.c,v retrieving revision 1.94 diff -u -p -r1.94 if_gif.c --- net/if_gif.c 4 May 2017 15:00:24 -0000 1.94 +++ net/if_gif.c 15 May 2017 13:10:13 -0000 @@ -129,9 +129,9 @@ gif_clone_create(struct if_clone *ifc, i #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, 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, 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;