diff options
author | jkh <jkh@FreeBSD.org> | 1996-12-22 17:09:17 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1996-12-22 17:09:17 +0000 |
commit | 6ca14a89c608ae04e77c840dbd24a9587eb1e5c7 (patch) | |
tree | 9701c23213e90328798f20678270ed4b30b0c7bf /usr.sbin | |
parent | 3e3bc5da824a677449b5f5b0430bba51e41d4d40 (diff) | |
download | FreeBSD-src-6ca14a89c608ae04e77c840dbd24a9587eb1e5c7.zip FreeBSD-src-6ca14a89c608ae04e77c840dbd24a9587eb1e5c7.tar.gz |
Make CRTSTS selection a runtime option. Closes PR#1392
Submitted by: Mike McGaughey <mmcg@heraclitus.cs.monash.edu.au>
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ppp/command.c | 21 | ||||
-rw-r--r-- | usr.sbin/ppp/defs.h | 3 | ||||
-rw-r--r-- | usr.sbin/ppp/modem.c | 34 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp.8 | 18 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp.8.m4 | 18 | ||||
-rw-r--r-- | usr.sbin/ppp/vars.c | 6 | ||||
-rw-r--r-- | usr.sbin/ppp/vars.h | 4 |
7 files changed, 76 insertions, 28 deletions
diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c index 870ef44..bf40cb3 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.24 1996/10/13 15:05:14 sos Exp $ + * $Id: command.c,v 1.25 1996/12/03 21:38:39 nate Exp $ * */ #include <sys/types.h> @@ -949,6 +949,23 @@ int param; return(1); } +static int SetCtsRts(list, argc, argv) +struct cmdtab *list; +int argc; +char **argv; +{ + if (argc > 0) { + if (strcmp(*argv, "on") == 0) + VarCtsRts = TRUE; + else if (strcmp(*argv, "off") == 0) + VarCtsRts = FALSE; + else + printf("usage: set ctsrts [on|off].\n"); + } + return(1); +} + + static int SetOpenMode(list, argc, argv) struct cmdtab *list; int argc; @@ -979,6 +996,8 @@ struct cmdtab const SetCommands[] = { "Set authentication key", "key", (void *)VAR_AUTHKEY}, { "authname", NULL, SetVariable, LOCAL_AUTH, "Set authentication name", "name", (void *)VAR_AUTHNAME}, + { "ctsrts", NULL, SetCtsRts, LOCAL_AUTH, + "Use CTS/RTS modem signalling", "[on|off]"}, { "debug", NULL, SetDebugLevel, LOCAL_AUTH, "Set debug level", StrValue}, { "device", "line", SetVariable, LOCAL_AUTH, diff --git a/usr.sbin/ppp/defs.h b/usr.sbin/ppp/defs.h index 898ec19..3b690ff 100644 --- a/usr.sbin/ppp/defs.h +++ b/usr.sbin/ppp/defs.h @@ -15,7 +15,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: defs.h,v 1.5 1996/12/03 21:38:42 nate Exp $ + * $Id: defs.h,v 1.6 1996/12/12 14:39:39 jkh Exp $ * * TODO: */ @@ -45,6 +45,7 @@ #define MODEM_SPEED B38400 /* tty speed */ #define SERVER_PORT 3000 /* Base server port no. */ +#define MODEM_CTSRTS TRUE /* Default (true): use CTS/RTS signals */ #define REDIAL_PERIOD 30 /* Default Hold time to redial */ #define CONFFILE "ppp.conf" diff --git a/usr.sbin/ppp/modem.c b/usr.sbin/ppp/modem.c index 3caa566..b0e0f71 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.23 1996/03/29 15:24:04 ache Exp $ + * $Id: modem.c,v 1.24 1996/05/11 20:48:36 phk Exp $ * * TODO: */ @@ -39,7 +39,6 @@ #define O_NONBLOCK O_NDELAY #endif #endif -#define USE_CTSRTS extern int DoChat(); @@ -448,12 +447,12 @@ int mode; rstio.c_iflag, rstio.c_oflag, rstio.c_cflag); #endif cfmakeraw(&rstio); -#ifdef USE_CTSRTS - rstio.c_cflag |= CLOCAL | CCTS_OFLOW|CRTS_IFLOW; -#else - rstio.c_cflag |= CLOCAL; - rstio.c_iflag |= IXOFF; -#endif + if (VarCtsRts) + rstio.c_cflag |= CLOCAL | CCTS_OFLOW|CRTS_IFLOW; + else { + rstio.c_cflag |= CLOCAL; + rstio.c_iflag |= IXOFF; + } rstio.c_iflag |= IXON; if (!(mode & MODE_DEDICATED)) rstio.c_cflag |= HUPCL; @@ -516,11 +515,11 @@ int modem; } tcgetattr(modem, &rstio); cfmakeraw(&rstio); -#ifdef USE_CTSRTS - rstio.c_cflag |= CLOCAL | CCTS_OFLOW|CRTS_IFLOW; -#else - rstio.c_cflag |= CLOCAL; -#endif + if (VarCtsRts) + rstio.c_cflag |= CLOCAL | CCTS_OFLOW|CRTS_IFLOW; + else + rstio.c_cflag |= CLOCAL; + if (!(mode & MODE_DEDICATED)) rstio.c_cflag |= HUPCL; tcsetattr(modem, TCSADRAIN, &rstio); @@ -772,11 +771,14 @@ ShowModemStatus() } if (VarParity & PARENB) { if (VarParity & PARODD) - printf("odd parity\n"); + printf("odd parity, "); else - printf("even parity\n"); + printf("even parity, "); } else - printf("none parity\n"); + printf("no parity, "); + + printf("CTS/RTS %s.\n", (VarCtsRts? "on" : "off")); + #ifdef DEBUG printf("fd = %d, modem control = %o\n", modem, mbits); #endif diff --git a/usr.sbin/ppp/ppp.8 b/usr.sbin/ppp/ppp.8 index 7a4227b..929d383 100644 --- a/usr.sbin/ppp/ppp.8 +++ b/usr.sbin/ppp/ppp.8 @@ -1,5 +1,5 @@ .\" manual page [] for ppp 0.94 beta2 + alpha -.\" $Id: ppp.8,v 1.20 1996/12/03 21:38:52 nate Exp $ +.\" $Id: ppp.8,v 1.21 1996/12/12 14:39:47 jkh Exp $ .Dd 20 September 1995 .Os FreeBSD .Dt PPP 8 @@ -172,8 +172,18 @@ ppp on tama> pass <password> ppp ON tama> -* You can specify the device name and speed for your modem using the -following commands: * +* You can now specify the device name, speed and parity +for your modem, and whether +CTS/RTS signalling should be used (CTS/RTS is used by default). +If your hardware does not provide CTS/RTS lines (as +may happen when you are connected directly to certain ppp-capable +terminal servers), +.Nm +will never send any output through the port; it +waits for a signal which never comes. +Thus, if you have a direct line and can't seem to make +a connection, try turning ctsrts off: * + ppp ON tama> set line /dev/cuaa0 @@ -181,6 +191,8 @@ ppp ON tama> set speed 38400 ppp ON tama> set parity even +ppp ON tama> set ctsrts on + ppp ON tama> show modem * Modem related parameters are shown in here * diff --git a/usr.sbin/ppp/ppp.8.m4 b/usr.sbin/ppp/ppp.8.m4 index 7a4227b..929d383 100644 --- a/usr.sbin/ppp/ppp.8.m4 +++ b/usr.sbin/ppp/ppp.8.m4 @@ -1,5 +1,5 @@ .\" manual page [] for ppp 0.94 beta2 + alpha -.\" $Id: ppp.8,v 1.20 1996/12/03 21:38:52 nate Exp $ +.\" $Id: ppp.8,v 1.21 1996/12/12 14:39:47 jkh Exp $ .Dd 20 September 1995 .Os FreeBSD .Dt PPP 8 @@ -172,8 +172,18 @@ ppp on tama> pass <password> ppp ON tama> -* You can specify the device name and speed for your modem using the -following commands: * +* You can now specify the device name, speed and parity +for your modem, and whether +CTS/RTS signalling should be used (CTS/RTS is used by default). +If your hardware does not provide CTS/RTS lines (as +may happen when you are connected directly to certain ppp-capable +terminal servers), +.Nm +will never send any output through the port; it +waits for a signal which never comes. +Thus, if you have a direct line and can't seem to make +a connection, try turning ctsrts off: * + ppp ON tama> set line /dev/cuaa0 @@ -181,6 +191,8 @@ ppp ON tama> set speed 38400 ppp ON tama> set parity even +ppp ON tama> set ctsrts on + ppp ON tama> show modem * Modem related parameters are shown in here * diff --git a/usr.sbin/ppp/vars.c b/usr.sbin/ppp/vars.c index f19683f..ec8500e 100644 --- a/usr.sbin/ppp/vars.c +++ b/usr.sbin/ppp/vars.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: vars.c,v 1.8 1996/10/06 13:32:36 jkh Exp $ + * $Id: vars.c,v 1.9 1996/10/06 19:39:08 jkh Exp $ * */ #include "fsm.h" @@ -29,7 +29,7 @@ #include "defs.h" char VarVersion[] = "Version 0.94"; -char VarLocalVersion[] = "$Date: 1996/10/06 13:32:36 $"; +char VarLocalVersion[] = "$Date: 1996/10/06 19:39:08 $"; /* * Order of conf option is important. See vars.h. @@ -49,7 +49,7 @@ struct confdesc pppConfs[] = { }; struct pppvars pppVars = { - DEF_MRU, 0, MODEM_SPEED, CS8, 180, 30, 3, + DEF_MRU, 0, MODEM_SPEED, CS8, MODEM_CTSRTS, 180, 30, 3, REDIAL_PERIOD, 1, MODEM_DEV, OPEN_PASSIVE, LOCAL_NO_AUTH, }; diff --git a/usr.sbin/ppp/vars.h b/usr.sbin/ppp/vars.h index ef1dc98..e9354dc 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.6 1996/03/08 13:22:23 ache Exp $ + * $Id: vars.h,v 1.7 1996/10/06 13:32:37 jkh Exp $ * * TODO: */ @@ -58,6 +58,7 @@ struct pppvars { int var_accmap; /* Initial ACCMAP value */ int modem_speed; /* Current modem speed */ int modem_parity; /* Parity setting */ + int modem_ctsrts; /* Use CTS/RTS on modem port? (boolean) */ int idle_timeout; /* Idle timeout value */ int lqr_timeout; /* LQR timeout value */ int retry_timeout; /* Retry timeout value */ @@ -85,6 +86,7 @@ struct pppvars { #define VarDevice pppVars.modem_dev #define VarSpeed pppVars.modem_speed #define VarParity pppVars.modem_parity +#define VarCtsRts pppVars.modem_ctsrts #define VarOpenMode pppVars.open_mode #define VarLocalAuth pppVars.lauth #define VarDialScript pppVars.dial_script |