mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-18 10:35:55 +00:00
Two ifnet misuse fixes for if_nve:
(1) Don't manually configure if_output(), ether_ifattach() will do that for us as part of link-layer setup. (2) Call if_detach() before stopping nve in order to prevent calls into the device driver after the driver has started shutting down. Reviewed by: jhb MFC after: 2 weeks
This commit is contained in:
parent
3f795dd3c7
commit
530ee5c971
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=191437
@ -539,7 +539,6 @@ nve_attach(device_t dev)
|
|||||||
if_initname(ifp, device_get_name(dev), device_get_unit(dev));
|
if_initname(ifp, device_get_name(dev), device_get_unit(dev));
|
||||||
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
|
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
|
||||||
ifp->if_ioctl = nve_ioctl;
|
ifp->if_ioctl = nve_ioctl;
|
||||||
ifp->if_output = ether_output;
|
|
||||||
ifp->if_start = nve_ifstart;
|
ifp->if_start = nve_ifstart;
|
||||||
ifp->if_watchdog = nve_watchdog;
|
ifp->if_watchdog = nve_watchdog;
|
||||||
ifp->if_timer = 0;
|
ifp->if_timer = 0;
|
||||||
@ -585,11 +584,11 @@ nve_detach(device_t dev)
|
|||||||
ifp = sc->ifp;
|
ifp = sc->ifp;
|
||||||
|
|
||||||
if (device_is_attached(dev)) {
|
if (device_is_attached(dev)) {
|
||||||
|
ether_ifdetach(ifp);
|
||||||
NVE_LOCK(sc);
|
NVE_LOCK(sc);
|
||||||
nve_stop(sc);
|
nve_stop(sc);
|
||||||
NVE_UNLOCK(sc);
|
NVE_UNLOCK(sc);
|
||||||
callout_drain(&sc->stat_callout);
|
callout_drain(&sc->stat_callout);
|
||||||
ether_ifdetach(ifp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sc->miibus)
|
if (sc->miibus)
|
||||||
|
Loading…
Reference in New Issue
Block a user