summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pppd/main.c
diff options
context:
space:
mode:
authorpst <pst@FreeBSD.org>1996-08-11 17:29:37 +0000
committerpst <pst@FreeBSD.org>1996-08-11 17:29:37 +0000
commitdb1a2c98a7763a50afdcfee230030aa8c955b9ae (patch)
tree4ab3443e6e4a75a13ebedb95dc52148f8bee9890 /usr.sbin/pppd/main.c
parent1a72bf5044a6ae9bebad1379cd9ea5ffa37fc4ad (diff)
downloadFreeBSD-src-db1a2c98a7763a50afdcfee230030aa8c955b9ae.zip
FreeBSD-src-db1a2c98a7763a50afdcfee230030aa8c955b9ae.tar.gz
Previously, if the dial script had any problems, pppd would simply
bomb out. Unfortunately, FreeBSD's sio driver and certain internal modems don't get along very well, which can cause the serial port to wedge until it is closed and reopened. Add new variable, connect-max-attempts, default = 1 (to mimic previous behavior). If > 1, will try up to "n" times to dial remote site before aborting.
Diffstat (limited to 'usr.sbin/pppd/main.c')
-rw-r--r--usr.sbin/pppd/main.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/usr.sbin/pppd/main.c b/usr.sbin/pppd/main.c
index 3321959..8c795a8 100644
--- a/usr.sbin/pppd/main.c
+++ b/usr.sbin/pppd/main.c
@@ -18,7 +18,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: main.c,v 1.27 1995/08/16 01:39:08 paulus Exp $";
+static char rcsid[] = "$Id: main.c,v 1.5 1995/10/31 21:21:26 peter Exp $";
#endif
#include <stdio.h>
@@ -160,6 +160,7 @@ main(argc, argv)
struct passwd *pw;
struct timeval timo;
sigset_t mask;
+ int connect_attempts = 0;
p = ttyname(0);
if (p)
@@ -349,13 +350,21 @@ main(argc, argv)
if (device_script(connector, fd, fd) < 0) {
syslog(LOG_ERR, "Connect script failed");
setdtr(fd, FALSE);
- die(1);
+ if (++connect_attempts >= max_con_attempts)
+ die(1);
+ else {
+ close(fd);
+ sleep(5);
+ continue;
+ }
}
syslog(LOG_INFO, "Serial connection established.");
sleep(1); /* give it time to set up its terminal */
}
+ connect_attempts = 0; /* we made it through ok */
+
/* set line speed, flow control, etc.; clear CLOCAL if modem option */
set_up_tty(fd, 0);
OpenPOWER on IntegriCloud