summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/modem.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1997-05-19 02:00:16 +0000
committerbrian <brian@FreeBSD.org>1997-05-19 02:00:16 +0000
commitee01b280507bf1f39a39f9beb574b6653321fd1c (patch)
treee4d9b90f3eb2066eb4729a5a72f4efff2a30eec9 /usr.sbin/ppp/modem.c
parent4f2495eff057ea8a9f8c638ee404521f89177a51 (diff)
downloadFreeBSD-src-ee01b280507bf1f39a39f9beb574b6653321fd1c.zip
FreeBSD-src-ee01b280507bf1f39a39f9beb574b6653321fd1c.tar.gz
Mega update to sort out bad implementations
of reconnect & -background. o Fix reconnect anomolies. o Make reconnect apply to failed LQR hangups (& mention in man page). o Make reconnect effective in -background mode. o Listen on socket in -background mode. o Try all phone numbers in -background mode. o Insist on system arg in -background mode. o Make a control-connection close command exit in -background mode. o Output status message to stdout on exit of parent in -background mode. o Don't notify parent of success too soon. o Describe termination EX_* code. o Miscelaneous diagnostic corrections. o Remove redundant connect_time from modem.c. o Don't repeatedly DownConnection().
Diffstat (limited to 'usr.sbin/ppp/modem.c')
-rw-r--r--usr.sbin/ppp/modem.c29
1 files changed, 9 insertions, 20 deletions
diff --git a/usr.sbin/ppp/modem.c b/usr.sbin/ppp/modem.c
index 6271efe..f2c4dd0 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.36 1997/05/10 03:39:54 brian Exp $
+ * $Id: modem.c,v 1.37 1997/05/14 01:14:32 brian Exp $
*
* TODO:
*/
@@ -44,7 +44,6 @@
extern int DoChat();
static int mbits; /* Current DCD status */
-static int connect_time; /* connection time */
static int connect_count;
static struct pppTimer ModemTimer;
@@ -217,8 +216,6 @@ DownConnection()
CloseModem();
LcpDown();
}
- lostCarrier++;
- connect_time = 0;
}
/*
@@ -228,28 +225,21 @@ DownConnection()
void
ModemTimeout()
{
- static int waiting;
int ombits = mbits;
int change;
StopTimer(&ModemTimer);
- if (Online)
- connect_time++;
StartTimer(&ModemTimer);
if (dev_is_modem) {
- if (modem < 0) {
- if (!waiting)
+ if (modem >= 0) {
+ if (ioctl(modem, TIOCMGET, &mbits) < 0) {
+ LogPrintf(LOG_PHASE_BIT, "ioctl error (%s)!\n", strerror(errno));
DownConnection();
- waiting = 1;
- return;
- }
- waiting = 0;
- if (ioctl(modem, TIOCMGET, &mbits) < 0) {
- LogPrintf(LOG_PHASE_BIT, "ioctl error (%s)!\n", strerror(errno));
- DownConnection();
- return;
- }
+ return;
+ }
+ } else
+ mbits = 0;
change = ombits ^ mbits;
if (change & TIOCM_CD) {
if (Online) {
@@ -263,6 +253,7 @@ ModemTimeout()
if (mode & MODE_DEDICATED)
PacketMode();
} else {
+ reconnectRequired = 1;
DownConnection();
}
}
@@ -272,7 +263,6 @@ ModemTimeout()
LogPrintf(LOG_PHASE_BIT, "Connected!\n");
mbits = TIOCM_CD;
connect_count++;
- connect_time = 0;
} else if (uptime == 0) {
time(&uptime);
}
@@ -282,7 +272,6 @@ ModemTimeout()
void
StartModemTimer()
{
- connect_time = 0;
StopTimer(&ModemTimer);
ModemTimer.state = TIMER_STOPPED;
ModemTimer.load = SECTICKS;
OpenPOWER on IntegriCloud