diff options
author | brian <brian@FreeBSD.org> | 1997-06-11 03:57:51 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1997-06-11 03:57:51 +0000 |
commit | 5d18065463d00e184ff9bd1aaa17936d5da8ca32 (patch) | |
tree | da1efc12c48d41a835081e367271110485404a69 /usr.sbin/ppp/modem.c | |
parent | 0aa80b0c2ec66ef679d1d850cf3e6217b1748f66 (diff) | |
download | FreeBSD-src-5d18065463d00e184ff9bd1aaa17936d5da8ca32.zip FreeBSD-src-5d18065463d00e184ff9bd1aaa17936d5da8ca32.tar.gz |
Sort out ppp over tcp:
o Allow "set var" with no args to blank var (don't req "").
o Zero VarTerm ASAP if not in interactive mode.
o Never print anything to stdout in -direct mode.
o Count redial when failing to open modem.
o Increase device size to 40 characters (for host:port).
o Remove missed "if (fd == 0) fd = 1;".
o Don't give up on incoming non-terminal connections.
Diffstat (limited to 'usr.sbin/ppp/modem.c')
-rw-r--r-- | usr.sbin/ppp/modem.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/usr.sbin/ppp/modem.c b/usr.sbin/ppp/modem.c index d5dc70f..b34545e 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.41 1997/05/29 02:29:13 brian Exp $ + * $Id: modem.c,v 1.42 1997/06/09 03:27:30 brian Exp $ * * TODO: */ @@ -359,6 +359,7 @@ char *host, *port; LogPrintf(LogWARN, "OpenConnection: connection failed.\n"); return(-1); } + LogPrintf(LogDEBUG, "OpenConnection: modem fd is %d.\n", sock); return(sock); } @@ -381,8 +382,9 @@ int mode; LogPrintf(LogPHASE, "Open Failed %s\n", ctermid(NULL)); return(modem); } - } else if (modem < 0) - return(modem); + } else + /* must be a tcp connection */ + return modem = dup(1); } else if (modem < 0) { if (strncmp(VarDevice, "/dev/", 5) == 0) { if ((res = uu_lock(VarBaseDevice)) != UU_LOCK_OK) { @@ -680,7 +682,6 @@ int fd; if (modemout) { nb = modemout->cnt; if (nb > 1600) nb = 1600; - if (fd == 0) fd = 1; /* XXX WTFO! This is bogus */ nw = write(fd, MBUF_CTOP(modemout), nb); LogPrintf(LogDEBUG, "ModemStartOutput: wrote: %d(%d)\n", nw, nb); LogDumpBuff(LogDEBUG, "ModemStartOutput: modem write", @@ -693,8 +694,11 @@ int fd; LogPrintf(LogDEBUG, "ModemStartOutput: mbfree\n"); } } else if (nw < 0) { - if (errno != EAGAIN) - LogPrintf(LogERROR, "modem write: %s", strerror(errno)); + if (errno != EAGAIN) { + LogPrintf(LogERROR, "modem write (%d): %s", modem, strerror(errno)); + reconnect(RECON_TRUE); + DownConnection(); + } } } } |