1) Add multi-phone dialing/redialing, several phones separated by ':'

2) Improve on-line help subsystem
3) Make 'term' mode works even carrier dropped (old code
close line forever here)
4) Make 'term' mode 8bit clean.
5) Improve manual page
6) #ifdef DEBUG diagnostic about missing optional files.
7) Don't put interactive dialing info to logfile
This commit is contained in:
ache 1996-03-08 09:03:09 +00:00
parent 4dce10c889
commit 59d1d8e6ee
8 changed files with 98 additions and 42 deletions

View File

@ -18,7 +18,7 @@
* Columbus, OH 43221
* (614)451-1883
*
* $Id: chat.c,v 1.4 1995/05/30 03:50:29 rgrimes Exp $
* $Id: chat.c,v 1.5 1995/09/02 17:20:50 amurai Exp $
*
* TODO:
* o Support more UUCP compatible control sequences.
@ -113,7 +113,7 @@ char **pvect;
* \r Carrige return character
* \s Space character
* \n Line feed character
* \T Telephone number (defined via `set phone'
* \T Telephone number(s) (defined via `set phone')
* \t Tab character
*/
char *
@ -123,6 +123,7 @@ char *result;
int sendmode;
{
int addcr = 0;
char *phone;
if (sendmode)
addcr = 1;
@ -152,8 +153,13 @@ int sendmode;
result += strlen(VarAuthKey);
break;
case 'T':
bcopy(VarPhone, result, strlen(VarPhone));
result += strlen(VarPhone);
if (VarNextPhone == NULL)
VarNextPhone = VarPhoneList;
phone = strsep(&VarNextPhone, ":");
bcopy(phone, result, strlen(phone));
result += strlen(phone);
if ((mode & (MODE_INTER|MODE_AUTO)) == MODE_INTER)
fprintf(stderr, "Phone: %s\n", phone);
break;
case 'U':
bcopy(VarAuthName, result, strlen(VarAuthName));

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: command.c,v 1.13 1996/01/11 17:48:41 phk Exp $
* $Id: command.c,v 1.14 1996/01/30 20:04:28 phk Exp $
*
*/
#include <sys/types.h>
@ -53,6 +53,7 @@ extern int SelectSystem();
extern int ShowRoute();
extern void TtyOldMode(), TtyCommandMode();
extern struct pppvars pppVars;
extern struct cmdtab const SetCommands[];
struct in_addr ifnetmask;
@ -75,6 +76,8 @@ struct cmdtab *plist;
if (argc > 0) {
for (cmd = plist; cmd->name; cmd++) {
if (strcmp(cmd->name, *argv) == 0 && (cmd->lauth & VarLocalAuth)) {
if (plist == SetCommands)
printf("set ");
printf("%s %s\n", cmd->name, cmd->syntax);
return(1);
}
@ -223,7 +226,7 @@ struct cmdtab const Commands[] = {
{ "close", NULL, CloseCommand, LOCAL_AUTH,
"Close connection", StrNull},
{ "delete", NULL, DeleteCommand, LOCAL_AUTH,
"delete route", "dest gateway"},
"delete route", "ALL | dest gateway [mask]"},
{ "deny", NULL, DenyCommand, LOCAL_AUTH,
"Deny option request", StrOption},
{ "dial", "call", DialCommand, LOCAL_AUTH,
@ -249,7 +252,7 @@ struct cmdtab const Commands[] = {
{ "term", NULL, TerminalCommand,LOCAL_AUTH,
"Enter to terminal mode", StrNull},
{ "quit", "bye", QuitCommand, LOCAL_AUTH | LOCAL_NO_AUTH,
"Quit PPP program", StrNull},
"Quit PPP program", "[all]"},
{ "help", "?", HelpCommand, LOCAL_AUTH | LOCAL_NO_AUTH,
"Display this message", "[command]", (void *)Commands },
{ NULL, "down", DownCommand, LOCAL_AUTH,
@ -838,7 +841,8 @@ int param;
VarAccmap = map;
break;
case VAR_PHONE:
strncpy(VarPhone, *argv, sizeof(VarPhone)-1);
strncpy(VarPhoneList, *argv, sizeof(VarPhoneList)-1);
VarNextPhone = VarPhoneList;
break;
}
}
@ -886,7 +890,7 @@ struct cmdtab const SetCommands[] = {
{ "escape", NULL, SetEscape, LOCAL_AUTH,
"Set escape characters", "hex-digit ..."},
{ "ifaddr", NULL, SetInterfaceAddr, LOCAL_AUTH,
"Set destination address", "src-addr dst-addr netmask"},
"Set destination address", "[src-addr [dst-addr [netmask [trg-addr]]]]"},
{ "ifilter", NULL, SetIfilter, LOCAL_AUTH,
"Set input filter", "..."},
{ "login", NULL, SetVariable, LOCAL_AUTH,
@ -900,7 +904,7 @@ struct cmdtab const SetCommands[] = {
{ "parity", NULL, SetModemParity, LOCAL_AUTH,
"Set modem parity", "[odd|even|none]"},
{ "phone", NULL, SetVariable, LOCAL_AUTH,
"Set telephone number", "phone-number", (void *)VAR_PHONE },
"Set telephone number(s)", "phone1[:phone2[...]]", (void *)VAR_PHONE },
{ "speed", NULL, SetModemSpeed, LOCAL_AUTH,
"Set modem speed", "speed"},
{ "timeout", NULL, SetIdleTimeout, LOCAL_AUTH,
@ -923,7 +927,7 @@ char **argv;
if (argc > 0)
val = FindExec(SetCommands, argc, argv);
else
printf("Use ``set ?'' to get a list.\n");
printf("Use `set ?' to get a list or `set ? <var>' for syntax help.\n");
return(val);
}

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: main.c,v 1.13 1996/01/11 17:48:52 phk Exp $
* $Id: main.c,v 1.14 1996/01/30 11:08:41 dfr Exp $
*
* TODO:
* o Add commands for traffic summary, version display, etc.
@ -67,7 +67,7 @@ static void TerminalStop();
static struct termios oldtio; /* Original tty mode */
static struct termios comtio; /* Command level tty mode */
static int TermMode;
int TermMode;
static int server;
struct sockaddr_in ifsin;
char pid_filename[128];
@ -446,7 +446,10 @@ ShowHelp()
{
fprintf(stderr, "The following commands are available:\r\n");
fprintf(stderr, " ~p\tEnter to Packet mode\r\n");
fprintf(stderr, " ~-\tDecrease log level\r\n");
fprintf(stderr, " ~+\tIncrease log level\r\n");
fprintf(stderr, " ~.\tTerminate program\r\n");
fprintf(stderr, " ~?\tThis help\r\n");
}
static void

View File

@ -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.11 1996/01/11 17:48:54 phk Exp $
* $Id: modem.c,v 1.12 1996/01/30 11:08:43 dfr Exp $
*
* TODO:
*/
@ -49,7 +49,8 @@ static struct pppTimer ModemTimer;
static char uucplock[10];
extern int uu_lock(), uu_unlock();
extern void PacketMode();
extern void PacketMode(), TtyTermMode(), TtyCommandMode();
extern int TermMode;
#define Online (mbits & TIOCM_CD)
@ -216,6 +217,15 @@ DownConnection()
CloseModem();
LcpDown();
connect_time = 0;
if (TermMode) {
modem = OpenModem(mode);
if (modem < 0) {
printf("failed to open modem.\n");
modem = 0;
TtyCommandMode(1);
}
TtyTermMode();
}
}
/*
@ -454,7 +464,7 @@ int mode;
rstio.c_cflag |= VarParity;
cfsetspeed(&rstio, IntToSpeed(VarSpeed));
}
rstio.c_iflag |= (IGNBRK | ISTRIP | IGNPAR | IXON | IXOFF);
rstio.c_iflag |= (IGNBRK | IGNPAR | IXON | IXOFF);
rstio.c_iflag &= ~(BRKINT|ICRNL|IXANY|IMAXBEL);
rstio.c_lflag = 0;
@ -727,18 +737,23 @@ DialModem()
strcpy(ScriptBuffer, VarDialScript);
if (DoChat(ScriptBuffer) > 0) {
fprintf(stderr, "dial OK!\n");
if ((mode & (MODE_INTER|MODE_AUTO)) == MODE_INTER)
fprintf(stderr, "dial OK!\n");
strcpy(ScriptBuffer, VarLoginScript);
if (DoChat(ScriptBuffer) > 0) {
fprintf(stderr, "login OK!\n");
if ((mode & (MODE_INTER|MODE_AUTO)) == MODE_INTER)
fprintf(stderr, "login OK!\n");
return(1);
} else {
fprintf(stderr, "login failed.\n");
if ((mode & (MODE_INTER|MODE_AUTO)) == MODE_INTER)
fprintf(stderr, "login failed.\n");
}
ModemTimeout(); /* Dummy call to check modem status */
}
else
fprintf(stderr, "dial failed.\n");
else {
if ((mode & (MODE_INTER|MODE_AUTO)) == MODE_INTER)
fprintf(stderr, "dial failed.\n");
}
HangupModem(0);
return(0);
}
@ -782,6 +797,6 @@ ShowModemStatus()
printf("outqlen: %d\n", ModemQlen());
printf("DialScript = %s\n", VarDialScript);
printf("LoginScript = %s\n", VarLoginScript);
printf("PhoneNumber = %s\n", VarPhone);
printf("PhoneNumber(s) = %s\n", VarPhoneList);
return(1);
}

View File

@ -1,5 +1,5 @@
.\" manual page [] for ppp 0.94 beta2 + alpha
.\" $Id: ppp.8,v 1.12 1995/10/08 14:57:31 amurai Exp $
.\" $Id: ppp.8,v 1.13 1996/01/30 13:50:10 mpp Exp $
.Dd 20 September 1995
.Os FreeBSD
.Dt PPP 8
@ -538,16 +538,21 @@ To control this IPCP behavior, this implementation has the
.Dq set ifaddr
command for defining the local and remote IP address:
.Dl ifaddr src_addr dst_addr
.Nm set ifaddr
.Op src_addr Op dst_addr Op netmask Op trg_addr
Where,
.Sq src_addr
is the IP address that the local side is willing to use and
.Sq dst_addr
is the IP address which the remote side should use.
.Sq netmask
is interface netmask.
.Sq trg_addr
is the IP address which used in address negotiation.
Ex:
.Dl ifaddr 192.244.177.38 192.244.177.2
.Dl set ifaddr 192.244.177.38 192.244.177.2 255.255.255.0
The above specification means:
.Bl -bullet -compact
@ -560,16 +565,19 @@ I strongly insist that peer use 192.244.177.2 as own side address and
don't permit it to use any IP address but 192.244.177.2. When peer
request another IP address, I always suggest that it use 192.244.177.2.
.It
My interface netmask will be 255.255.255.0.
.It
This is all fine when each side has a pre-determined IP address, however
it is often the case that one side is acting as a server which controls
all IP addresses and the other side should obey the direction from it.
.El
In order to allow more flexible behavior, `ifaddr' command allows the
In order to allow more flexible behavior, `ifaddr' variable allows the
user to specify IP address more loosely:
.Dl ifaddr 192.244.177.38/24 192.244.177.2/20
.Dl set ifaddr 192.244.177.38/24 192.244.177.2/20
A number followed by a slash (/) represent the number of bits significant in
the IP address. The above example signifies that:
@ -601,11 +609,14 @@ try to insist that 192.244.177.2 be used first.
.Bl -enum
.It
Describe provider's phone number in DialScript: Use the
Describe provider's phone number(s) in DialScript: Use the
.Dq set dial
or
.Dq set phone
commands.
.Dq Set phone
command allows you to set multiply phone numbers for dialing and redialing
separated by a colon (:).
.It
Describe login procedure in LoginScript: Use the
.Dq set login
@ -679,9 +690,10 @@ Please read example configuration files.
.It
Use
.Dq help ,
.Dq show ?
and
.Dq show ? ,
.Dq set ?
and
.Dq set ? <var>
commands.
.It

View File

@ -1,5 +1,5 @@
.\" manual page [] for ppp 0.94 beta2 + alpha
.\" $Id: ppp.8,v 1.12 1995/10/08 14:57:31 amurai Exp $
.\" $Id: ppp.8,v 1.13 1996/01/30 13:50:10 mpp Exp $
.Dd 20 September 1995
.Os FreeBSD
.Dt PPP 8
@ -538,16 +538,21 @@ To control this IPCP behavior, this implementation has the
.Dq set ifaddr
command for defining the local and remote IP address:
.Dl ifaddr src_addr dst_addr
.Nm set ifaddr
.Op src_addr Op dst_addr Op netmask Op trg_addr
Where,
.Sq src_addr
is the IP address that the local side is willing to use and
.Sq dst_addr
is the IP address which the remote side should use.
.Sq netmask
is interface netmask.
.Sq trg_addr
is the IP address which used in address negotiation.
Ex:
.Dl ifaddr 192.244.177.38 192.244.177.2
.Dl set ifaddr 192.244.177.38 192.244.177.2 255.255.255.0
The above specification means:
.Bl -bullet -compact
@ -560,16 +565,19 @@ I strongly insist that peer use 192.244.177.2 as own side address and
don't permit it to use any IP address but 192.244.177.2. When peer
request another IP address, I always suggest that it use 192.244.177.2.
.It
My interface netmask will be 255.255.255.0.
.It
This is all fine when each side has a pre-determined IP address, however
it is often the case that one side is acting as a server which controls
all IP addresses and the other side should obey the direction from it.
.El
In order to allow more flexible behavior, `ifaddr' command allows the
In order to allow more flexible behavior, `ifaddr' variable allows the
user to specify IP address more loosely:
.Dl ifaddr 192.244.177.38/24 192.244.177.2/20
.Dl set ifaddr 192.244.177.38/24 192.244.177.2/20
A number followed by a slash (/) represent the number of bits significant in
the IP address. The above example signifies that:
@ -601,11 +609,14 @@ try to insist that 192.244.177.2 be used first.
.Bl -enum
.It
Describe provider's phone number in DialScript: Use the
Describe provider's phone number(s) in DialScript: Use the
.Dq set dial
or
.Dq set phone
commands.
.Dq Set phone
command allows you to set multiply phone numbers for dialing and redialing
separated by a colon (:).
.It
Describe login procedure in LoginScript: Use the
.Dq set login
@ -679,9 +690,10 @@ Please read example configuration files.
.It
Use
.Dq help ,
.Dq show ?
and
.Dq show ? ,
.Dq set ?
and
.Dq set ? <var>
commands.
.It

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: systems.c,v 1.4 1995/04/29 13:38:14 ache Exp $
* $Id: systems.c,v 1.5 1995/05/30 03:50:58 rgrimes Exp $
*
* TODO:
*/
@ -124,7 +124,9 @@ char *file;
fp = fopen(line, "r");
}
if (fp == NULL) {
#ifdef DEBUG
fprintf(stderr, "can't open %s.\n", line);
#endif
SetPppId();
return(-1);
}

View File

@ -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.3 1995/03/11 15:18:55 amurai Exp $
* $Id: vars.h,v 1.4 1995/10/08 14:57:32 amurai Exp $
*
* TODO:
*/
@ -72,7 +72,8 @@ struct pppvars {
char login_script[200]; /* Login script */
char auth_key[50]; /* PAP/CHAP key */
char auth_name[50]; /* PAP/CHAP system name */
char phone_number[50]; /* Telephone Number */
char phone_numbers[200]; /* Telephone Numbers */
char *next_phone; /* Next phone from the list */
char shostname[MAXHOSTNAMELEN];/* Local short Host Name */
};
@ -90,7 +91,8 @@ struct pppvars {
#define VarRetryTimeout pppVars.retry_timeout
#define VarAuthKey pppVars.auth_key
#define VarAuthName pppVars.auth_name
#define VarPhone pppVars.phone_number
#define VarPhoneList pppVars.phone_numbers
#define VarNextPhone pppVars.next_phone
#define VarShortHost pppVars.shostname
#define VarRedialTimeout pppVars.redial_timeout
#define VarDialTries pppVars.dial_tries