diff options
| author | Brian Somers <brian@FreeBSD.org> | 1997-07-14 01:41:35 +0000 |
|---|---|---|
| committer | Brian Somers <brian@FreeBSD.org> | 1997-07-14 01:41:35 +0000 |
| commit | c09be724d623752bf87b5ed4311c0ef8b759328d (patch) | |
| tree | 4cbb39121d043aae648b8ca8a1c8311614bb03c5 /usr.sbin/ppp | |
| parent | 18f72dfed8fd44544aaeb3fd372f5815a458b421 (diff) | |
Notes
Diffstat (limited to 'usr.sbin/ppp')
| -rw-r--r-- | usr.sbin/ppp/chat.c | 5 | ||||
| -rw-r--r-- | usr.sbin/ppp/command.c | 9 | ||||
| -rw-r--r-- | usr.sbin/ppp/modem.c | 20 | ||||
| -rw-r--r-- | usr.sbin/ppp/ppp.8 | 7 | ||||
| -rw-r--r-- | usr.sbin/ppp/ppp.8.m4 | 7 | ||||
| -rw-r--r-- | usr.sbin/ppp/vars.h | 4 |
6 files changed, 43 insertions, 9 deletions
diff --git a/usr.sbin/ppp/chat.c b/usr.sbin/ppp/chat.c index e1e14e7f00d8b..ff5922f109934 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.27 1997/06/23 23:10:05 brian Exp $ + * $Id: chat.c,v 1.28 1997/07/01 21:31:21 brian Exp $ * * TODO: * o Support more UUCP compatible control sequences. @@ -569,6 +569,9 @@ DoChat(char *script) char **argv; int argc, n, state; + if (!script || !*script) + return MATCH; + /* While we're chatting, we want an INT to fail us */ if (setjmp(ChatEnv)) { signal(SIGINT, oint); diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c index 21589474f5fad..23125bae82bf7 100644 --- a/usr.sbin/ppp/command.c +++ b/usr.sbin/ppp/command.c @@ -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.65 1997/06/30 03:03:29 brian Exp $ + * $Id: command.c,v 1.66 1997/07/12 19:22:34 brian Exp $ * */ #include <sys/types.h> @@ -1149,6 +1149,7 @@ char **argv; #define VAR_DEVICE 4 #define VAR_ACCMAP 5 #define VAR_PHONE 6 +#define VAR_HANGUP 7 static int SetVariable(list, argc, argv, param) @@ -1199,6 +1200,10 @@ int param; strcpy(VarPhoneCopy, VarPhoneList); VarNextPhone = VarPhoneCopy; break; + case VAR_HANGUP: + strncpy(VarHangupScript, arg, sizeof(VarHangupScript)-1); + VarHangupScript[sizeof(VarHangupScript)-1] = '\0'; + break; } return 0; } @@ -1259,6 +1264,8 @@ struct cmdtab const SetCommands[] = { "Set dialing script", "set dial chat-script", (void *)VAR_DIAL}, { "escape", NULL, SetEscape, LOCAL_AUTH, "Set escape characters", "set escape hex-digit ..."}, + { "hangup", NULL, SetVariable, LOCAL_AUTH, + "Set hangup script", "set hangup chat-script", (void *)VAR_HANGUP}, { "ifaddr", NULL, SetInterfaceAddr, LOCAL_AUTH, "Set destination address", "set ifaddr [src-addr [dst-addr [netmask [trg-addr]]]]"}, { "ifilter", NULL, SetIfilter, LOCAL_AUTH, diff --git a/usr.sbin/ppp/modem.c b/usr.sbin/ppp/modem.c index 46254830af8c3..93459035656fb 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.43 1997/06/11 03:57:50 brian Exp $ + * $Id: modem.c,v 1.44 1997/06/23 23:10:13 brian Exp $ * * TODO: */ @@ -206,10 +206,14 @@ static time_t uptime; void DownConnection() { + char ScriptBuffer[200]; + LogPrintf(LogPHASE, "Disconnected!\n"); if (uptime) LogPrintf(LogPHASE, "Connect time: %d secs\n", time(NULL) - uptime); uptime = 0; + strcpy(ScriptBuffer, VarHangupScript); /* arrays are the same size */ + DoChat(ScriptBuffer); if (!TermMode) { CloseModem(); LcpDown(); @@ -572,13 +576,19 @@ int flag; */ if (modem >= 0) { - tcflush(modem, TCIOFLUSH); - UnrawModem(modem); - close(modem); + char ScriptBuffer[200]; + + strcpy(ScriptBuffer, VarHangupScript); /* arrays are the same size */ + DoChat(ScriptBuffer); + tcflush(modem, TCIOFLUSH); + UnrawModem(modem); + close(modem); } modem = -1; /* Mark as modem has closed */ (void) uu_unlock(VarBaseDevice); } else if (modem >= 0) { + char ScriptBuffer[200]; + mbits |= TIOCM_DTR; #ifndef notyet ioctl(modem, TIOCMSET, &mbits); @@ -587,6 +597,8 @@ int flag; cfsetspeed(&ts, IntToSpeed(VarSpeed)); tcsetattr(modem, TCSADRAIN, &ts); #endif + strcpy(ScriptBuffer, VarHangupScript); /* arrays are the same size */ + DoChat(ScriptBuffer); } } diff --git a/usr.sbin/ppp/ppp.8 b/usr.sbin/ppp/ppp.8 index 96fd1c3401576..d831ade6b4a89 100644 --- a/usr.sbin/ppp/ppp.8 +++ b/usr.sbin/ppp/ppp.8 @@ -1,4 +1,4 @@ -.\" $Id: ppp.8,v 1.43 1997/06/30 03:03:35 brian Exp $ +.\" $Id: ppp.8,v 1.44 1997/07/01 21:31:28 brian Exp $ .Dd 20 September 1995 .Os FreeBSD .Dt PPP 8 @@ -1559,6 +1559,11 @@ below) and the string \\\\P will be replaced with the password (see .Dq set key above). +.It set hangup chat-script +This specifies the chat script that will be used to reset the modem +before it is closed. It should not normally be necessary, but can +be used for devices that fail to reset themselves properly on close. + .It set escape value... This option is similar to the .Dq set accmap diff --git a/usr.sbin/ppp/ppp.8.m4 b/usr.sbin/ppp/ppp.8.m4 index 96fd1c3401576..d831ade6b4a89 100644 --- a/usr.sbin/ppp/ppp.8.m4 +++ b/usr.sbin/ppp/ppp.8.m4 @@ -1,4 +1,4 @@ -.\" $Id: ppp.8,v 1.43 1997/06/30 03:03:35 brian Exp $ +.\" $Id: ppp.8,v 1.44 1997/07/01 21:31:28 brian Exp $ .Dd 20 September 1995 .Os FreeBSD .Dt PPP 8 @@ -1559,6 +1559,11 @@ below) and the string \\\\P will be replaced with the password (see .Dq set key above). +.It set hangup chat-script +This specifies the chat script that will be used to reset the modem +before it is closed. It should not normally be necessary, but can +be used for devices that fail to reset themselves properly on close. + .It set escape value... This option is similar to the .Dq set accmap diff --git a/usr.sbin/ppp/vars.h b/usr.sbin/ppp/vars.h index 64f9b8178c2b8..c80bf7f9d7723 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.18 1997/06/09 03:27:42 brian Exp $ + * $Id: vars.h,v 1.19 1997/06/11 03:57:51 brian Exp $ * * TODO: */ @@ -85,6 +85,7 @@ struct pppvars { char phone_copy[200]; /* copy for strsep() */ char *next_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 */ }; @@ -99,6 +100,7 @@ struct pppvars { #define VarOpenMode pppVars.open_mode #define VarLocalAuth pppVars.lauth #define VarDialScript pppVars.dial_script +#define VarHangupScript pppVars.hangup_script #define VarLoginScript pppVars.login_script #define VarIdleTimeout pppVars.idle_timeout #define VarLqrTimeout pppVars.lqr_timeout |
