diff options
author | phk <phk@FreeBSD.org> | 2004-06-26 08:44:04 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2004-06-26 08:44:04 +0000 |
commit | 1aa6c5a754b178a4700e8508f2e7a2f5136fd9b6 (patch) | |
tree | 04c3b44b676c0a500305ae7636bab0655dde9123 /sys/net | |
parent | 772718717b358bd1045f527cb6842b45a4838f18 (diff) | |
download | FreeBSD-src-1aa6c5a754b178a4700e8508f2e7a2f5136fd9b6.zip FreeBSD-src-1aa6c5a754b178a4700e8508f2e7a2f5136fd9b6.tar.gz |
Fix line discipline switching issues: If opening a new ldisc fails,
we have to revert to TTYDISC which we know will successfully open
rather than try the previous ldisc which might also fail to open.
Do not let ldisc implementations muck about with ->t_line, and remove
code which checks for reopens, it should never happen.
Move ldisc->l_hotchar to tty->t_hotchar and have ldisc implementation
initialize it in their open routines. Reset to zero when we enter
TTYDISC. ("no" should really be -1 since zero could be a valid
hotchar for certain old european mainframe protocols.)
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/if_sl.c | 9 | ||||
-rw-r--r-- | sys/net/ppp_tty.c | 12 |
2 files changed, 4 insertions, 17 deletions
diff --git a/sys/net/if_sl.c b/sys/net/if_sl.c index c05ecd0..3595b77 100644 --- a/sys/net/if_sl.c +++ b/sys/net/if_sl.c @@ -186,8 +186,7 @@ static int slstart(struct tty *); static struct linesw slipdisc = { slopen, slclose, l_noread, l_nowrite, - sltioctl, slinput, slstart, ttymodem, - FRAME_END + sltioctl, slinput, slstart, ttymodem }; /* @@ -350,17 +349,14 @@ slopen(dev, tp) if (error) return (error); - if (tp->t_line == SLIPDISC) - return (0); - if ((sc = slcreate()) == NULL) return (ENOBUFS); + tp->t_hotchar = FRAME_END; tp->t_sc = (caddr_t)sc; sc->sc_ttyp = tp; sc->sc_if.if_baudrate = tp->t_ospeed; ttyflush(tp, FREAD | FWRITE); - tp->t_line = SLIPDISC; /* * We don't use t_canq or t_rawq, so reduce their @@ -417,7 +413,6 @@ slclose(tp,flag) */ s = splimp(); /* actually, max(spltty, splnet) */ clist_free_cblocks(&tp->t_outq); - tp->t_line = 0; sc = (struct sl_softc *)tp->t_sc; if (sc != NULL) { if (sc->sc_outfill) { diff --git a/sys/net/ppp_tty.c b/sys/net/ppp_tty.c index 0270acb..05ffb16 100644 --- a/sys/net/ppp_tty.c +++ b/sys/net/ppp_tty.c @@ -148,8 +148,7 @@ void pppasyncdetach(void); static struct linesw pppdisc = { pppopen, pppclose, pppread, pppwrite, - ppptioctl, pppinput, pppstart, ttymodem, - PPP_FLAG + ppptioctl, pppinput, pppstart, ttymodem }; void @@ -185,13 +184,7 @@ pppopen(dev, tp) s = spltty(); - if (tp->t_line == PPPDISC) { - sc = (struct ppp_softc *) tp->t_sc; - if (sc != NULL && sc->sc_devp == (void *) tp) { - splx(s); - return (0); - } - } + tp->t_hotchar = PPP_FLAG; if ((sc = pppalloc(td->td_proc->p_pid)) == NULL) { splx(s); @@ -254,7 +247,6 @@ pppclose(tp, flag) ttyflush(tp, FREAD | FWRITE); clist_free_cblocks(&tp->t_canq); clist_free_cblocks(&tp->t_outq); - tp->t_line = 0; sc = (struct ppp_softc *) tp->t_sc; if (sc != NULL) { tp->t_sc = NULL; |