Date: Thu, 9 May 2019 14:06:24 +0000 (UTC) From: Kyle Evans <kevans@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r347394 - head/sys/net Message-ID: <201905091406.x49E6OfK032112@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kevans Date: Thu May 9 14:06:24 2019 New Revision: 347394 URL: https://svnweb.freebsd.org/changeset/base/347394 Log: tuntap: Properly detach tap ifp Modified: head/sys/net/if_tuntap.c Modified: head/sys/net/if_tuntap.c ============================================================================== --- head/sys/net/if_tuntap.c Thu May 9 13:12:43 2019 (r347393) +++ head/sys/net/if_tuntap.c Thu May 9 14:06:24 2019 (r347394) @@ -529,7 +529,6 @@ out: static void tun_destroy(struct tuntap_softc *tp) { - struct cdev *dev; TUN_LOCK(tp); tp->tun_flags |= TUN_DYING; @@ -543,15 +542,18 @@ tun_destroy(struct tuntap_softc *tp) TUN2IFP(tp)->if_softc = NULL; sx_xunlock(&tun_ioctl_sx); - dev = tp->tun_dev; - bpfdetach(TUN2IFP(tp)); - if_detach(TUN2IFP(tp)); - free_unr(tp->tun_drv->unrhdr, TUN2IFP(tp)->if_dunit); - if_free(TUN2IFP(tp)); - destroy_dev(dev); + destroy_dev(tp->tun_dev); seldrain(&tp->tun_rsel); knlist_clear(&tp->tun_rsel.si_note, 0); knlist_destroy(&tp->tun_rsel.si_note); + if ((tp->tun_flags & TUN_L2) != 0) { + ether_ifdetach(TUN2IFP(tp)); + } else { + bpfdetach(TUN2IFP(tp)); + if_detach(TUN2IFP(tp)); + } + free_unr(tp->tun_drv->unrhdr, TUN2IFP(tp)->if_dunit); + if_free(TUN2IFP(tp)); mtx_destroy(&tp->tun_mtx); cv_destroy(&tp->tun_cv); free(tp, M_TUN);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201905091406.x49E6OfK032112>