aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorPaul Traina <pst@FreeBSD.org>1996-08-11 17:29:37 +0000
committerPaul Traina <pst@FreeBSD.org>1996-08-11 17:29:37 +0000
commit7e31b4b1be2cdfa531695d4233544164bfae5727 (patch)
tree4ab3443e6e4a75a13ebedb95dc52148f8bee9890 /usr.sbin
parent8a80fd427c3de9cbb1afeed918ae29d4d3184777 (diff)
Notes
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pppd/main.c13
-rw-r--r--usr.sbin/pppd/options.c11
-rw-r--r--usr.sbin/pppd/pppd.87
-rw-r--r--usr.sbin/pppd/pppd.h3
4 files changed, 29 insertions, 5 deletions
diff --git a/usr.sbin/pppd/main.c b/usr.sbin/pppd/main.c
index 332195997bfa..8c795a8be032 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);
diff --git a/usr.sbin/pppd/options.c b/usr.sbin/pppd/options.c
index 8ed6ff0a4f2c..fd0bc3926986 100644
--- a/usr.sbin/pppd/options.c
+++ b/usr.sbin/pppd/options.c
@@ -18,7 +18,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: options.c,v 1.8 1995/11/04 10:44:22 peter Exp $";
+static char rcsid[] = "$Id: options.c,v 1.9 1996/03/01 19:29:42 phk Exp $";
#endif
#include <stdio.h>
@@ -74,6 +74,7 @@ u_int32_t dns2 = 0; /* Secondary DNS server */
int lockflag = 0; /* Create lock file to lock the serial dev */
int nodetach = 0; /* Don't detach from controlling tty */
char *connector = NULL; /* Script to establish physical link */
+int max_con_attempts = 1; /* Maximum number of connect attempts */
char *disconnector = NULL; /* Script to disestablish physical link */
char user[MAXNAMELEN]; /* Username for PAP */
char passwd[MAXSECRETLEN]; /* Password for PAP */
@@ -125,6 +126,7 @@ static int nomru __P((void));
static int nopcomp __P((void));
static int setconnector __P((char **));
static int setdisconnector __P((char **));
+static int setmaxcon __P((char **));
static int setdomain __P((char **));
static int setnetmask __P((char **));
static int setdns1 __P((char **));
@@ -207,6 +209,7 @@ static struct cmd {
{"asyncmap", 1, setasyncmap}, /* set the desired async map */
{"escape", 1, setescape}, /* set chars to escape on transmission */
{"connect", 1, setconnector}, /* A program to set up a connection */
+ {"connect-max-attempts", 1, setmaxcon}, /* maximum # connection attempts */
{"disconnect", 1, setdisconnector}, /* program to disconnect serial dev. */
{"crtscts", 0, setcrtscts}, /* set h/w flow control */
{"-crtscts", 0, setnocrtscts}, /* clear h/w flow control */
@@ -1775,6 +1778,12 @@ setpapcrypt()
return 1;
}
+static int setmaxcon (argv)
+ char **argv;
+{
+ return int_option(*argv, &max_con_attempts);
+}
+
#ifdef _linux_
static int setidle (argv)
char **argv;
diff --git a/usr.sbin/pppd/pppd.8 b/usr.sbin/pppd/pppd.8
index ce06da1b4901..7f61ac7826c5 100644
--- a/usr.sbin/pppd/pppd.8
+++ b/usr.sbin/pppd/pppd.8
@@ -1,5 +1,5 @@
.\" manual page [] for pppd 2.0
-.\" $Id: pppd.8,v 1.5 1996/05/02 19:21:40 mpp Exp $
+.\" $Id: pppd.8,v 1.6 1996/07/03 23:23:03 mpp Exp $
.\" SH section heading
.\" SS subsection heading
.\" LP paragraph
@@ -71,6 +71,11 @@ Use the executable or shell command specified by \fI<p>\fR to set up the
serial line. This script would typically use the "chat" program to
dial the modem and start the remote ppp session.
.TP
+.B connect-max-attempts \fI<n>
+Attempt dial-out connection to remote system no more than specified number
+of times (default = 1). If the connection is not made, pppd will exit.
+Requires that \fBpersist\fR has been specified.
+.TP
.B crtscts
Use hardware flow control (i.e. RTS/CTS) to control the flow of data on
the serial port.
diff --git a/usr.sbin/pppd/pppd.h b/usr.sbin/pppd/pppd.h
index bedf6752b4d7..7fe53f4484e1 100644
--- a/usr.sbin/pppd/pppd.h
+++ b/usr.sbin/pppd/pppd.h
@@ -16,7 +16,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: pppd.h,v 1.4 1995/10/31 21:21:42 peter Exp $
+ * $Id: pppd.h,v 1.5 1996/03/01 19:29:43 phk Exp $
*/
/*
@@ -73,6 +73,7 @@ extern int lockflag; /* Create lock file to lock the serial dev */
extern int nodetach; /* Don't detach from controlling tty */
extern char *connector; /* Script to establish physical link */
extern char *disconnector; /* Script to disestablish physical link */
+extern int max_con_attempts;/* Maximum number of time to try dialing */
extern char user[]; /* Username for PAP */
extern char passwd[]; /* Password for PAP */
extern int auth_required; /* Peer is required to authenticate */