diff options
author | brian <brian@FreeBSD.org> | 1997-08-17 20:38:45 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1997-08-17 20:38:45 +0000 |
commit | 6f340c20e5d94d59afcee4b5d8fbc86d25acd2dd (patch) | |
tree | 62de69ed379cc36f733baf0513da2822d43d6bc4 /usr.sbin/ppp | |
parent | 7708b374b9944a9913eb0e8d0fa451751bdaa232 (diff) | |
download | FreeBSD-src-6f340c20e5d94d59afcee4b5d8fbc86d25acd2dd.zip FreeBSD-src-6f340c20e5d94d59afcee4b5d8fbc86d25acd2dd.tar.gz |
Allow specification of fallback phone numbers to
be used only if the dial script fails.
PR: 4262
Diffstat (limited to 'usr.sbin/ppp')
-rw-r--r-- | usr.sbin/ppp/chat.c | 13 | ||||
-rw-r--r-- | usr.sbin/ppp/modem.c | 3 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp.8 | 35 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp.8.m4 | 35 | ||||
-rw-r--r-- | usr.sbin/ppp/vars.h | 4 |
5 files changed, 65 insertions, 25 deletions
diff --git a/usr.sbin/ppp/chat.c b/usr.sbin/ppp/chat.c index ff5922f..5810441 100644 --- a/usr.sbin/ppp/chat.c +++ b/usr.sbin/ppp/chat.c @@ -18,7 +18,7 @@ * Columbus, OH 43221 * (614)451-1883 * - * $Id: chat.c,v 1.28 1997/07/01 21:31:21 brian Exp $ + * $Id: chat.c,v 1.29 1997/07/14 01:41:24 brian Exp $ * * TODO: * o Support more UUCP compatible control sequences. @@ -164,11 +164,14 @@ ExpandString(char *str, char *result, int reslen, int sendmode) result += strlen(result); break; case 'T': - if (VarNextPhone == NULL) { - strcpy(VarPhoneCopy, VarPhoneList); - VarNextPhone = VarPhoneCopy; + if (VarAltPhone == NULL) { + if (VarNextPhone == NULL) { + strcpy(VarPhoneCopy, VarPhoneList); + VarNextPhone = VarPhoneCopy; + } + VarAltPhone = strsep(&VarNextPhone, ":"); } - phone = strsep(&VarNextPhone, ":"); + phone = strsep(&VarAltPhone, "|"); strncpy(result, phone, reslen); reslen -= strlen(result); result += strlen(result); diff --git a/usr.sbin/ppp/modem.c b/usr.sbin/ppp/modem.c index bee6ef3..0a08c8c 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.45 1997/07/14 01:41:29 brian Exp $ + * $Id: modem.c,v 1.46 1997/07/24 02:42:34 brian Exp $ * * TODO: */ @@ -726,6 +726,7 @@ DialModem() strncpy(ScriptBuffer, VarDialScript,sizeof(ScriptBuffer)-1); ScriptBuffer[sizeof(ScriptBuffer)-1] = '\0'; if ((excode = DoChat(ScriptBuffer)) > 0) { + VarAltPhone = NULL; if (VarTerm) fprintf(VarTerm, "dial OK!\n"); strncpy(ScriptBuffer, VarLoginScript,sizeof(ScriptBuffer)-1); diff --git a/usr.sbin/ppp/ppp.8 b/usr.sbin/ppp/ppp.8 index 7920b38..2a92d73 100644 --- a/usr.sbin/ppp/ppp.8 +++ b/usr.sbin/ppp/ppp.8 @@ -1,4 +1,4 @@ -.\" $Id: ppp.8,v 1.45 1997/07/14 01:41:31 brian Exp $ +.\" $Id: ppp.8,v 1.46 1997/08/10 22:03:20 brian Exp $ .Dd 20 September 1995 .Os FreeBSD .Dt PPP 8 @@ -1013,15 +1013,29 @@ The following steps should be taken when connecting to your ISP: Describe your provider's phone number(s) in the dial script using the .Dq set phone command. This command allows you to set multiple phone numbers for -dialing and redialing separated by a colon (:). For example: +dialing and redialing separated by either a pipe (|) or a colon (:) .Bd -literal -offset indent -set phone "1234567:2345678" +set phone "111[|222]...[:333[|444]...]... +.Ed +Numbers after the first in a pipe-seperated list are only used if the +previous number was used in a failed login script. Numbers seperated +by a colon are used sequentially, irrespective of what happened as a +result of using the previous number. For example: +.Bd -literal -offset indent +set phone "1234567|2345678:3456789|4567890" .Ed .Pp -Here, the first number is attempted. If the connection fails, the second -number is attempted after the next number redial period. If the second number -also fails, the first is tried again after the redial period has expired. -The selected phone number is substituted for the \\T string in the +Here, the 1234567 number is attempted. If the login script fails, the +2345678 number is used next time, but *only* if the login script fails. +On the dial after this, the 3456789 number is used. The 4567890 number +is only used if the login script using the 3456789 fails. If the login +script of the 2345678 number fails, the next number is still the 3456789 +number. As many pipes and colons can be used as are necessary. +The next number redial timeout is used between all numbers. When the +end of the list is reached, the normal redial period is used before +starting at the beginning again. + +The selected phone number is substituted for the \\\\T string in the .Dq set dial command (see below). @@ -1612,10 +1626,13 @@ peer to initiate LCP negotiation, you may use the value .It set parity odd|even|none|mark This allows the line parity to be set. The default value is none. -.It set phone telno[:telno]... +.It set phone telno[|telno]...[:telno[|telno]...]... This allows the specification of the phone number to be used in place of the \\\\T string in the dial and login chat scripts. -Multiple phone numbers may be given seperated by a colon (:). +Multiple phone numbers may be given seperated by a colon (:) or +a pipe (|). Numbers after the pipe are only dialed if the login script +for the previous number failed. Numbers seperated by a colon are tried +sequentially, irrespective of the reason the line was dropped. If multiple numbers are given, .Nm will dial them in rotation until a connection is made, retrying diff --git a/usr.sbin/ppp/ppp.8.m4 b/usr.sbin/ppp/ppp.8.m4 index 7920b38..2a92d73 100644 --- a/usr.sbin/ppp/ppp.8.m4 +++ b/usr.sbin/ppp/ppp.8.m4 @@ -1,4 +1,4 @@ -.\" $Id: ppp.8,v 1.45 1997/07/14 01:41:31 brian Exp $ +.\" $Id: ppp.8,v 1.46 1997/08/10 22:03:20 brian Exp $ .Dd 20 September 1995 .Os FreeBSD .Dt PPP 8 @@ -1013,15 +1013,29 @@ The following steps should be taken when connecting to your ISP: Describe your provider's phone number(s) in the dial script using the .Dq set phone command. This command allows you to set multiple phone numbers for -dialing and redialing separated by a colon (:). For example: +dialing and redialing separated by either a pipe (|) or a colon (:) .Bd -literal -offset indent -set phone "1234567:2345678" +set phone "111[|222]...[:333[|444]...]... +.Ed +Numbers after the first in a pipe-seperated list are only used if the +previous number was used in a failed login script. Numbers seperated +by a colon are used sequentially, irrespective of what happened as a +result of using the previous number. For example: +.Bd -literal -offset indent +set phone "1234567|2345678:3456789|4567890" .Ed .Pp -Here, the first number is attempted. If the connection fails, the second -number is attempted after the next number redial period. If the second number -also fails, the first is tried again after the redial period has expired. -The selected phone number is substituted for the \\T string in the +Here, the 1234567 number is attempted. If the login script fails, the +2345678 number is used next time, but *only* if the login script fails. +On the dial after this, the 3456789 number is used. The 4567890 number +is only used if the login script using the 3456789 fails. If the login +script of the 2345678 number fails, the next number is still the 3456789 +number. As many pipes and colons can be used as are necessary. +The next number redial timeout is used between all numbers. When the +end of the list is reached, the normal redial period is used before +starting at the beginning again. + +The selected phone number is substituted for the \\\\T string in the .Dq set dial command (see below). @@ -1612,10 +1626,13 @@ peer to initiate LCP negotiation, you may use the value .It set parity odd|even|none|mark This allows the line parity to be set. The default value is none. -.It set phone telno[:telno]... +.It set phone telno[|telno]...[:telno[|telno]...]... This allows the specification of the phone number to be used in place of the \\\\T string in the dial and login chat scripts. -Multiple phone numbers may be given seperated by a colon (:). +Multiple phone numbers may be given seperated by a colon (:) or +a pipe (|). Numbers after the pipe are only dialed if the login script +for the previous number failed. Numbers seperated by a colon are tried +sequentially, irrespective of the reason the line was dropped. If multiple numbers are given, .Nm will dial them in rotation until a connection is made, retrying diff --git a/usr.sbin/ppp/vars.h b/usr.sbin/ppp/vars.h index c80bf7f..486f1fa 100644 --- a/usr.sbin/ppp/vars.h +++ b/usr.sbin/ppp/vars.h @@ -15,7 +15,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: vars.h,v 1.19 1997/06/11 03:57:51 brian Exp $ + * $Id: vars.h,v 1.20 1997/07/14 01:41:35 brian Exp $ * * TODO: */ @@ -84,6 +84,7 @@ struct pppvars { char phone_numbers[200]; /* Telephone Numbers */ char phone_copy[200]; /* copy for strsep() */ char *next_phone; /* Next phone from the list */ + char *alt_phone; /* Next phone from the list */ char shostname[MAXHOSTNAMELEN];/* Local short Host Name */ char hangup_script[200]; /* Hangup script before modem is closed */ struct aliasHandlers handler; /* Alias function pointers */ @@ -110,6 +111,7 @@ struct pppvars { #define VarPhoneList pppVars.phone_numbers #define VarPhoneCopy pppVars.phone_copy #define VarNextPhone pppVars.next_phone +#define VarAltPhone pppVars.alt_phone #define VarShortHost pppVars.shostname #define VarReconnectTimer pppVars.reconnect_timer #define VarReconnectTries pppVars.reconnect_tries |