diff options
author | brian <brian@FreeBSD.org> | 1998-07-03 17:24:38 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1998-07-03 17:24:38 +0000 |
commit | e15057ae7cfa8d8f9f129ea1ec98514ab36f269d (patch) | |
tree | f742a04526d50cb7837da4c074d36fe3c520dc0a /usr.sbin/ppp | |
parent | 4a55b250d402fbee412172e44607f4469a953273 (diff) | |
download | FreeBSD-src-e15057ae7cfa8d8f9f129ea1ec98514ab36f269d.zip FreeBSD-src-e15057ae7cfa8d8f9f129ea1ec98514ab36f269d.tar.gz |
Only start checking carrier when the datalink state machine
exceeds DATALINK_READY. When we go back to READY or less
(eg. ``close lcp''), switch the carrier-checking-timer off again.
This fixes the callback example in ppp.conf.sample.
Noted as broken by: Damian Kuczynski <damian@best.pw.edu.pl>
Diffstat (limited to 'usr.sbin/ppp')
-rw-r--r-- | usr.sbin/ppp/datalink.c | 6 | ||||
-rw-r--r-- | usr.sbin/ppp/modem.c | 18 |
2 files changed, 12 insertions, 12 deletions
diff --git a/usr.sbin/ppp/datalink.c b/usr.sbin/ppp/datalink.c index fc2a841..5ab9794 100644 --- a/usr.sbin/ppp/datalink.c +++ b/usr.sbin/ppp/datalink.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: datalink.c,v 1.14 1998/06/27 14:18:04 brian Exp $ + * $Id: datalink.c,v 1.15 1998/06/30 23:04:14 brian Exp $ */ #include <sys/types.h> @@ -174,6 +174,7 @@ datalink_LoginDone(struct datalink *dl) modem_Offline(dl->physical); chat_Init(&dl->chat, dl->physical, dl->cfg.script.hangup, 1, NULL); } else { + timer_Stop(&dl->physical->Timer); if (dl->physical->type == PHYS_DEDICATED) /* force a redial timeout */ modem_Close(dl->physical); @@ -289,7 +290,7 @@ datalink_UpdateSet(struct descriptor *d, fd_set *r, fd_set *w, fd_set *e, case DATALINK_DIAL: case DATALINK_LOGIN: datalink_NewState(dl, DATALINK_HANGUP); - modem_Offline(dl->physical); + modem_Offline(dl->physical); /* Is this required ? */ chat_Init(&dl->chat, dl->physical, dl->cfg.script.hangup, 1, NULL); return datalink_UpdateSet(d, r, w, e, n); } @@ -402,6 +403,7 @@ datalink_ComeDown(struct datalink *dl, int how) if (dl->state >= DATALINK_READY && dl->stayonline) { dl->stayonline = 0; + timer_Stop(&dl->physical->Timer); datalink_NewState(dl, DATALINK_READY); } else if (dl->state != DATALINK_CLOSED && dl->state != DATALINK_HANGUP) { modem_Offline(dl->physical); diff --git a/usr.sbin/ppp/modem.c b/usr.sbin/ppp/modem.c index 236f7ed..4768093 100644 --- a/usr.sbin/ppp/modem.c +++ b/usr.sbin/ppp/modem.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: modem.c,v 1.93 1998/06/24 19:33:32 brian Exp $ + * $Id: modem.c,v 1.94 1998/06/27 14:18:07 brian Exp $ * * TODO: */ @@ -668,9 +668,6 @@ modem_Open(struct physical *modem, struct bundle *bundle) return (-1); } fcntl(modem->fd, F_SETFL, oldflag & ~O_NONBLOCK); - - /* We do the timer only for ttys */ - modem_StartTimer(bundle, modem); } return modem->fd; @@ -723,12 +720,12 @@ modem_Raw(struct physical *modem, struct bundle *bundle) fcntl(modem->fd, F_SETFL, oldflag | O_NONBLOCK); if (modem->dev_is_modem && ioctl(modem->fd, TIOCMGET, &modem->mbits) == 0 && - !(modem->mbits & TIOCM_CD)) { - log_Printf(LogDEBUG, "%s: Switching off timer - %s doesn't support CD\n", - modem->link.name, modem->name.full); - timer_Stop(&modem->Timer); - } else + (modem->mbits & TIOCM_CD)) { + modem_StartTimer(bundle, modem); modem_Timeout(modem); + } else + log_Printf(LogDEBUG, "%s: %s doesn't support CD\n", + modem->link.name, modem->name.full); return 0; } @@ -753,10 +750,10 @@ modem_PhysicalClose(struct physical *modem) int newsid; log_Printf(LogDEBUG, "%s: Physical Close\n", modem->link.name); + timer_Stop(&modem->Timer); newsid = tcgetpgrp(modem->fd) == getpgrp(); close(modem->fd); modem->fd = -1; - timer_Stop(&modem->Timer); log_SetTtyCommandMode(modem->dl); throughput_stop(&modem->link.throughput); throughput_log(&modem->link.throughput, LogPHASE, modem->link.name); @@ -774,6 +771,7 @@ modem_Offline(struct physical *modem) if (modem->fd >= 0) { struct termios tio; + timer_Stop(&modem->Timer); modem->mbits &= ~TIOCM_DTR; if (isatty(modem->fd) && Online(modem)) { tcgetattr(modem->fd, &tio); |