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:
Robert Watson 2009-04-23 19:29:45 +00:00
parent 3f795dd3c7
commit 530ee5c971

View File

@ -539,7 +539,6 @@ nve_attach(device_t dev)
if_initname(ifp, device_get_name(dev), device_get_unit(dev));
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
ifp->if_ioctl = nve_ioctl;
ifp->if_output = ether_output;
ifp->if_start = nve_ifstart;
ifp->if_watchdog = nve_watchdog;
ifp->if_timer = 0;
@ -585,11 +584,11 @@ nve_detach(device_t dev)
ifp = sc->ifp;
if (device_is_attached(dev)) {
ether_ifdetach(ifp);
NVE_LOCK(sc);
nve_stop(sc);
NVE_UNLOCK(sc);
callout_drain(&sc->stat_callout);
ether_ifdetach(ifp);
}
if (sc->miibus)