Set IFF_RUNNING flag on the interface as soon as the control device is opened.

This commit is contained in:
Maksim Yevmenkin 2004-08-11 00:12:27 +00:00
parent 39dfb406e1
commit 285b72aa78

View File

@ -340,7 +340,8 @@ tapopen(dev, flag, mode, td)
struct thread *td; struct thread *td;
{ {
struct tap_softc *tp = NULL; struct tap_softc *tp = NULL;
int error; struct ifnet *ifp = NULL;
int error, s;
if ((error = suser(td)) != 0) if ((error = suser(td)) != 0)
return (error); return (error);
@ -368,10 +369,15 @@ tapopen(dev, flag, mode, td)
bcopy(tp->arpcom.ac_enaddr, tp->ether_addr, sizeof(tp->ether_addr)); bcopy(tp->arpcom.ac_enaddr, tp->ether_addr, sizeof(tp->ether_addr));
tp->tap_pid = td->td_proc->p_pid; tp->tap_pid = td->td_proc->p_pid;
tp->tap_flags |= TAP_OPEN; tp->tap_flags |= TAP_OPEN;
ifp = &tp->tap_if;
mtx_unlock(&tp->tap_mtx); mtx_unlock(&tp->tap_mtx);
TAPDEBUG("%s is open. minor = %#x\n", s = splimp();
tp->tap_if.if_xname, minor(dev)); ifp->if_flags |= IFF_RUNNING;
ifp->if_flags &= ~IFF_OACTIVE;
splx(s);
TAPDEBUG("%s is open. minor = %#x\n", ifp->if_xname, minor(dev));
return (0); return (0);
} /* tapopen */ } /* tapopen */