diff options
author | brian <brian@cvs.openbsd.org> | 1999-07-15 02:10:34 +0000 |
---|---|---|
committer | brian <brian@cvs.openbsd.org> | 1999-07-15 02:10:34 +0000 |
commit | 307d47ac94351d3f94b416d21552f01131765fc3 (patch) | |
tree | 6827c6f5a7156747210e5291bbb0f7a0b66a1ca2 | |
parent | cfbe55d5f1715d74b1107c714a5fbe33014a0390 (diff) |
Back out the mis-commit of my development ISDN modifications.
-rw-r--r-- | usr.sbin/ppp/ppp/Makefile | 4 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/README.changes | 2 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/bundle.c | 6 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/chap.c | 2 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/datalink.c | 33 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/datalink.h | 16 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/deflate.c | 4 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/exec.c | 29 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/hdlc.c | 28 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/ip.c | 6 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/link.c | 4 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/pap.c | 4 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/physical.c | 25 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/physical.h | 19 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/ppp.8 | 51 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/tcp.c | 4 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/tty.c | 159 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/udp.c | 4 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/vjcomp.c | 4 |
19 files changed, 158 insertions, 246 deletions
diff --git a/usr.sbin/ppp/ppp/Makefile b/usr.sbin/ppp/ppp/Makefile index 5e685546eed..7e125d03d58 100644 --- a/usr.sbin/ppp/ppp/Makefile +++ b/usr.sbin/ppp/ppp/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.10 1999/07/15 02:04:06 brian Exp $ +# $Id: Makefile,v 1.11 1999/07/15 02:10:31 brian Exp $ PROG= ppp SRCS= alias.c alias_cmd.c alias_cuseeme.c alias_db.c alias_ftp.c \ @@ -9,7 +9,7 @@ SRCS= alias.c alias_cmd.c alias_cuseeme.c alias_db.c alias_ftp.c \ main.c mbuf.c mp.c pap.c physical.c pred.c probe.c prompt.c proto.c \ radius.c radlib.c route.c server.c sig.c slcompress.c systems.c \ sync.c tcp.c throughput.c timer.c tty.c tun.c udp.c vjcomp.c -CFLAGS+=-Wall -DHAVE_DES -DNO_FW_PUNCH -DNOI4B +CFLAGS+=-Wall -DHAVE_DES -DNO_FW_PUNCH LDADD+= -ldes -lutil -lz DPADD+= ${LIBDES} ${LIBUTIL} ${LIBZ} BINMODE=4554 diff --git a/usr.sbin/ppp/ppp/README.changes b/usr.sbin/ppp/ppp/README.changes index 9d32c72f4ad..d70c0531cb3 100644 --- a/usr.sbin/ppp/ppp/README.changes +++ b/usr.sbin/ppp/ppp/README.changes @@ -85,5 +85,3 @@ o The ``set device'' command now expects each device to be specified as an on commas and spaces. o The ``show modem'' command is depricated and has been changed to ``show physical''. -o Ppp now waits the full ``set cd'' time before running the login script, - and drops the connection at that point if CD is required and not present. diff --git a/usr.sbin/ppp/ppp/bundle.c b/usr.sbin/ppp/ppp/bundle.c index 1b526f768eb..4ce3fdc5a59 100644 --- a/usr.sbin/ppp/ppp/bundle.c +++ b/usr.sbin/ppp/ppp/bundle.c @@ -23,14 +23,14 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: bundle.c,v 1.21 1999/07/15 02:04:06 brian Exp $ + * $Id: bundle.c,v 1.22 1999/07/15 02:10:31 brian Exp $ */ #include <sys/param.h> #include <sys/socket.h> #include <netinet/in.h> #include <net/if.h> -#include <net/if_tun.h> /* For TUNSIFMODE & TUNSLMODE */ +#include <net/if_tun.h> #include <arpa/inet.h> #include <net/route.h> #include <netinet/in_systm.h> @@ -43,7 +43,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -/* #include <sys/ioctl.h> (auto-remove) */ +#include <sys/ioctl.h> #include <sys/uio.h> #include <sys/wait.h> #include <termios.h> diff --git a/usr.sbin/ppp/ppp/chap.c b/usr.sbin/ppp/ppp/chap.c index 3178fac8cf9..0dd85e49bb9 100644 --- a/usr.sbin/ppp/ppp/chap.c +++ b/usr.sbin/ppp/ppp/chap.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: chap.c,v 1.15 1999/07/15 02:04:06 brian Exp $ + * $Id: chap.c,v 1.16 1999/07/15 02:10:31 brian Exp $ * * TODO: */ diff --git a/usr.sbin/ppp/ppp/datalink.c b/usr.sbin/ppp/ppp/datalink.c index e77f91c6760..b8651a902c9 100644 --- a/usr.sbin/ppp/ppp/datalink.c +++ b/usr.sbin/ppp/ppp/datalink.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: datalink.c,v 1.22 1999/07/15 02:04:06 brian Exp $ + * $Id: datalink.c,v 1.23 1999/07/15 02:10:32 brian Exp $ */ #include <sys/param.h> @@ -175,7 +175,7 @@ datalink_HangupDone(struct datalink *dl) } } -const char * +static const char * datalink_ChoosePhoneNumber(struct datalink *dl) { char *phone; @@ -269,8 +269,7 @@ datalink_UpdateSet(struct descriptor *d, fd_set *r, fd_set *w, fd_set *e, if (dl->script.run) { datalink_NewState(dl, DATALINK_DIAL); chat_Init(&dl->chat, dl->physical, dl->cfg.script.dial, 1, - *dl->cfg.script.dial ? - datalink_ChoosePhoneNumber(dl) : ""); + datalink_ChoosePhoneNumber(dl)); if (!(dl->physical->type & (PHYS_DDIAL|PHYS_DEDICATED)) && dl->cfg.dial.max) log_Printf(LogCHAT, "%s: Dial attempt %u of %d\n", @@ -308,25 +307,6 @@ datalink_UpdateSet(struct descriptor *d, fd_set *r, fd_set *w, fd_set *e, } break; - case DATALINK_CARRIER: - /* Wait for carrier on the device */ - switch (physical_AwaitCarrier(dl->physical)) { - case CARRIER_PENDING: - log_Printf(LogDEBUG, "Waiting for carrier\n"); - return 0; /* A device timer is running to wake us up again */ - - case CARRIER_OK: - datalink_NewState(dl, DATALINK_LOGIN); - chat_Init(&dl->chat, dl->physical, dl->cfg.script.login, 0, NULL); - return datalink_UpdateSet(d, r, w, e, n); - - case CARRIER_LOST: - datalink_NewState(dl, DATALINK_HANGUP); - physical_Offline(dl->physical); /* Is this required ? */ - chat_Init(&dl->chat, dl->physical, dl->cfg.script.hangup, 1, NULL); - return datalink_UpdateSet(d, r, w, e, n); - } - case DATALINK_HANGUP: case DATALINK_DIAL: case DATALINK_LOGIN: @@ -340,7 +320,8 @@ datalink_UpdateSet(struct descriptor *d, fd_set *r, fd_set *w, fd_set *e, datalink_HangupDone(dl); break; case DATALINK_DIAL: - datalink_NewState(dl, DATALINK_CARRIER); + datalink_NewState(dl, DATALINK_LOGIN); + chat_Init(&dl->chat, dl->physical, dl->cfg.script.login, 0, NULL); return datalink_UpdateSet(d, r, w, e, n); case DATALINK_LOGIN: dl->phone.alt = NULL; @@ -360,8 +341,7 @@ datalink_UpdateSet(struct descriptor *d, fd_set *r, fd_set *w, fd_set *e, case DATALINK_LOGIN: datalink_NewState(dl, DATALINK_HANGUP); physical_Offline(dl->physical); /* Is this required ? */ - chat_Init(&dl->chat, dl->physical, dl->cfg.script.hangup, - 1, NULL); + chat_Init(&dl->chat, dl->physical, dl->cfg.script.hangup, 1, NULL); return datalink_UpdateSet(d, r, w, e, n); } break; @@ -1181,7 +1161,6 @@ static const char *states[] = { "opening", "hangup", "dial", - "carrier", "login", "ready", "lcp", diff --git a/usr.sbin/ppp/ppp/datalink.h b/usr.sbin/ppp/ppp/datalink.h index c838ea85570..8c65bca1654 100644 --- a/usr.sbin/ppp/ppp/datalink.h +++ b/usr.sbin/ppp/ppp/datalink.h @@ -23,20 +23,19 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: datalink.h,v 1.4 1999/07/15 02:04:06 brian Exp $ + * $Id: datalink.h,v 1.5 1999/07/15 02:10:32 brian Exp $ */ #define DATALINK_CLOSED (0) #define DATALINK_OPENING (1) #define DATALINK_HANGUP (2) #define DATALINK_DIAL (3) -#define DATALINK_CARRIER (4) -#define DATALINK_LOGIN (5) -#define DATALINK_READY (6) -#define DATALINK_LCP (7) -#define DATALINK_AUTH (8) -#define DATALINK_CBCP (9) -#define DATALINK_OPEN (10) +#define DATALINK_LOGIN (4) +#define DATALINK_READY (5) +#define DATALINK_LCP (6) +#define DATALINK_AUTH (7) +#define DATALINK_CBCP (8) +#define DATALINK_OPEN (9) #define DATALINK_MAXNAME (20) /* Maximum datalink::name length */ @@ -150,4 +149,3 @@ extern int datalink_RemoveFromSet(struct datalink *, fd_set *, fd_set *, fd_set *); extern int datalink_SetMode(struct datalink *, int); extern int datalink_GetDialTimeout(struct datalink *); -extern const char *datalink_ChoosePhoneNumber(struct datalink *); diff --git a/usr.sbin/ppp/ppp/deflate.c b/usr.sbin/ppp/ppp/deflate.c index 314f67f5519..199848bd978 100644 --- a/usr.sbin/ppp/ppp/deflate.c +++ b/usr.sbin/ppp/ppp/deflate.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: deflate.c,v 1.6 1999/07/15 02:04:06 brian Exp $ + * $Id: deflate.c,v 1.7 1999/07/15 02:10:32 brian Exp $ */ #include <sys/types.h> @@ -37,6 +37,8 @@ #include "mbuf.h" #include "log.h" #include "timer.h" +#include "lqr.h" +#include "hdlc.h" #include "fsm.h" #include "lcp.h" #include "ccp.h" diff --git a/usr.sbin/ppp/ppp/exec.c b/usr.sbin/ppp/ppp/exec.c index 4e302102820..958c3803458 100644 --- a/usr.sbin/ppp/ppp/exec.c +++ b/usr.sbin/ppp/ppp/exec.c @@ -23,16 +23,16 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: exec.c,v 1.7 1999/07/15 02:04:06 brian Exp $ + * $Id: exec.c,v 1.8 1999/07/15 02:10:32 brian Exp $ */ #include <sys/param.h> #include <sys/socket.h> -/* #include <netinet/in.h> (auto-remove) */ -/* #include <arpa/inet.h> (auto-remove) */ -/* #include <netdb.h> (auto-remove) */ -/* #include <netinet/in_systm.h> (auto-remove) */ -/* #include <netinet/ip.h> (auto-remove) */ +#include <netinet/in.h> +#include <arpa/inet.h> +#include <netdb.h> +#include <netinet/in_systm.h> +#include <netinet/ip.h> #include <sys/un.h> #include <errno.h> @@ -49,7 +49,7 @@ #include "defs.h" #include "mbuf.h" #include "log.h" -/* #include "sync.h" (auto-remove) */ +#include "sync.h" #include "timer.h" #include "lqr.h" #include "hdlc.h" @@ -59,20 +59,20 @@ #include "ccp.h" #include "link.h" #include "async.h" -/* #include "slcompress.h" (auto-remove) */ -/* #include "iplist.h" (auto-remove) */ -/* #include "ipcp.h" (auto-remove) */ -/* #include "filter.h" (auto-remove) */ +#include "slcompress.h" +#include "iplist.h" +#include "ipcp.h" +#include "filter.h" #include "descriptor.h" #include "physical.h" #include "mp.h" #ifndef NORADIUS -/* #include "radius.h" (auto-remove) */ +#include "radius.h" #endif #include "chat.h" #include "command.h" -/* #include "bundle.h" (auto-remove) */ -/* #include "prompt.h" (auto-remove) */ +#include "bundle.h" +#include "prompt.h" #include "auth.h" #include "chap.h" #include "cbcp.h" @@ -91,7 +91,6 @@ static struct device execdevice = { NULL, NULL, NULL, - NULL, NULL }; diff --git a/usr.sbin/ppp/ppp/hdlc.c b/usr.sbin/ppp/ppp/hdlc.c index 6eb3fd52469..8e7685107f4 100644 --- a/usr.sbin/ppp/ppp/hdlc.c +++ b/usr.sbin/ppp/ppp/hdlc.c @@ -17,14 +17,14 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: hdlc.c,v 1.8 1999/07/15 02:04:06 brian Exp $ + * $Id: hdlc.c,v 1.9 1999/07/15 02:10:32 brian Exp $ * * TODO: */ #include <sys/param.h> -/* #include <netinet/in.h> (auto-remove) */ -/* #include <netinet/in_systm.h> (auto-remove) */ -/* #include <netinet/ip.h> (auto-remove) */ +#include <netinet/in.h> +#include <netinet/in_systm.h> +#include <netinet/ip.h> #include <sys/un.h> #include <stdio.h> @@ -40,15 +40,15 @@ #include "fsm.h" #include "lqr.h" #include "hdlc.h" -/* #include "proto.h" (auto-remove) */ -/* #include "iplist.h" (auto-remove) */ +#include "proto.h" +#include "iplist.h" #include "throughput.h" -/* #include "slcompress.h" (auto-remove) */ -/* #include "ipcp.h" (auto-remove) */ -/* #include "ip.h" (auto-remove) */ -/* #include "vjcomp.h" (auto-remove) */ +#include "slcompress.h" +#include "ipcp.h" +#include "ip.h" +#include "vjcomp.h" #include "auth.h" -/* #include "pap.h" (auto-remove) */ +#include "pap.h" #include "lcp.h" #include "async.h" #include "ccp.h" @@ -61,11 +61,11 @@ #include "mp.h" #include "cbcp.h" #include "datalink.h" -/* #include "filter.h" (auto-remove) */ +#include "filter.h" #ifndef NORADIUS -/* #include "radius.h" (auto-remove) */ +#include "radius.h" #endif -/* #include "bundle.h" (auto-remove) */ +#include "bundle.h" static u_int16_t const fcstab[256] = { /* 00 */ 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, diff --git a/usr.sbin/ppp/ppp/ip.c b/usr.sbin/ppp/ppp/ip.c index 114f3ea6c3b..64508090e1d 100644 --- a/usr.sbin/ppp/ppp/ip.c +++ b/usr.sbin/ppp/ppp/ip.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: ip.c,v 1.14 1999/07/15 02:04:06 brian Exp $ + * $Id: ip.c,v 1.15 1999/07/15 02:10:32 brian Exp $ * * TODO: * o Return ICMP message for filterd packet @@ -38,7 +38,7 @@ #include <errno.h> #include <stdio.h> -/* #include <stdlib.h> (auto-remove) */ +#include <stdlib.h> #include <string.h> #include <termios.h> #include <unistd.h> @@ -66,7 +66,7 @@ #include "radius.h" #endif #include "bundle.h" -/* #include "vjcomp.h" (auto-remove) */ +#include "vjcomp.h" #include "tun.h" #include "ip.h" diff --git a/usr.sbin/ppp/ppp/link.c b/usr.sbin/ppp/ppp/link.c index 7f95190024d..f1071c8ce4c 100644 --- a/usr.sbin/ppp/ppp/link.c +++ b/usr.sbin/ppp/ppp/link.c @@ -23,13 +23,13 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: link.c,v 1.8 1999/07/15 02:04:06 brian Exp $ + * $Id: link.c,v 1.9 1999/07/15 02:10:32 brian Exp $ * */ #include <sys/types.h> #include <netinet/in_systm.h> -/* #include <netdb.h> (auto-remove) */ +#include <netdb.h> #include <sys/un.h> #include <netinet/in.h> #include <netinet/ip.h> diff --git a/usr.sbin/ppp/ppp/pap.c b/usr.sbin/ppp/ppp/pap.c index 31e694b7bfe..64ec86308a1 100644 --- a/usr.sbin/ppp/ppp/pap.c +++ b/usr.sbin/ppp/ppp/pap.c @@ -18,7 +18,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: pap.c,v 1.10 1999/07/15 02:04:06 brian Exp $ + * $Id: pap.c,v 1.11 1999/07/15 02:10:32 brian Exp $ * * TODO: */ @@ -29,7 +29,7 @@ #include <sys/un.h> #include <stdlib.h> -/* #include <string.h> (auto-remove) */ +#include <string.h> #include <termios.h> #include "layer.h" diff --git a/usr.sbin/ppp/ppp/physical.c b/usr.sbin/ppp/ppp/physical.c index da463860033..44346e9d90c 100644 --- a/usr.sbin/ppp/ppp/physical.c +++ b/usr.sbin/ppp/ppp/physical.c @@ -16,15 +16,15 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: physical.c,v 1.15 1999/07/15 02:04:06 brian Exp $ + * $Id: physical.c,v 1.16 1999/07/15 02:10:32 brian Exp $ * */ #include <sys/param.h> -/* #include <sys/socket.h> (auto-remove) */ +#include <sys/socket.h> #include <netinet/in.h> -/* #include <arpa/inet.h> (auto-remove) */ -/* #include <netdb.h> (auto-remove) */ +#include <arpa/inet.h> +#include <netdb.h> #include <netinet/in_systm.h> #include <netinet/ip.h> #include <sys/un.h> @@ -37,7 +37,7 @@ #include <string.h> #include <sys/tty.h> /* TIOCOUTQ */ #include <sys/uio.h> -/* #include <sys/wait.h> (auto-remove) */ +#include <sys/wait.h> #include <time.h> #include <unistd.h> #include <utmp.h> @@ -91,9 +91,6 @@ #include "udp.h" #include "exec.h" #include "tty.h" -#ifndef NOI4B -#include "i4b.h" -#endif static int physical_DescriptorWrite(struct descriptor *, struct bundle *, @@ -113,9 +110,6 @@ struct { int *niov, int maxiov); int (*DeviceSize)(void); } devices[] = { -#ifndef NOI4B - { i4b_Create, i4b_iov2device, i4b_DeviceSize }, -#endif { tty_Create, tty_iov2device, tty_DeviceSize }, { tcp_Create, tcp_iov2device, tcp_DeviceSize }, { udp_Create, udp_iov2device, udp_DeviceSize }, @@ -999,12 +993,3 @@ physical_StopDeviceTimer(struct physical *p) if (p->handler && p->handler->stoptimer) (*p->handler->stoptimer)(p); } - -int -physical_AwaitCarrier(struct physical *p) -{ - if (p->handler && p->handler->awaitcarrier) - return (*p->handler->awaitcarrier)(p); - - return CARRIER_OK; -} diff --git a/usr.sbin/ppp/ppp/physical.h b/usr.sbin/ppp/ppp/physical.h index 422da2d13d5..0accbd6af58 100644 --- a/usr.sbin/ppp/ppp/physical.h +++ b/usr.sbin/ppp/ppp/physical.h @@ -16,7 +16,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: physical.h,v 1.12 1999/07/15 02:04:06 brian Exp $ + * $Id: physical.h,v 1.13 1999/07/15 02:10:32 brian Exp $ * */ @@ -28,23 +28,15 @@ struct bundle; struct ccp; struct cmdargs; -/* Device types */ -#define I4B_DEVICE 1 -#define TTY_DEVICE 2 -#define TCP_DEVICE 3 -#define UDP_DEVICE 4 -#define EXEC_DEVICE 5 - -/* Returns from awaitcarrier() */ -#define CARRIER_PENDING 1 -#define CARRIER_OK 2 -#define CARRIER_LOST 3 +#define TTY_DEVICE 1 +#define TCP_DEVICE 2 +#define UDP_DEVICE 3 +#define EXEC_DEVICE 4 struct device { int type; const char *name; - int (*awaitcarrier)(struct physical *); int (*raw)(struct physical *); void (*offline)(struct physical *); void (*cooked)(struct physical *); @@ -145,4 +137,3 @@ extern void physical_DeleteQueue(struct physical *); extern void physical_SetupStack(struct physical *, const char *, int); extern void physical_StopDeviceTimer(struct physical *); extern int physical_MaxDeviceSize(void); -extern int physical_AwaitCarrier(struct physical *); diff --git a/usr.sbin/ppp/ppp/ppp.8 b/usr.sbin/ppp/ppp/ppp.8 index 252e7d48620..6357efa6e82 100644 --- a/usr.sbin/ppp/ppp/ppp.8 +++ b/usr.sbin/ppp/ppp/ppp.8 @@ -1,4 +1,4 @@ -.\" $Id: ppp.8,v 1.56 1999/07/15 02:04:07 brian Exp $ +.\" $Id: ppp.8,v 1.57 1999/07/15 02:10:32 brian Exp $ .Dd 20 September 1995 .nr XX \w'\fC00' .Dt PPP 8 @@ -157,13 +157,6 @@ will open a TCP or UDP connection for transporting data rather than using a conventional serial device. UDP connections force .Nm into synchronous mode. -.It Supports PPP over ISDN -If -.Nm -is given a raw B-channel i4b device to open as a link, it's able to talk -to the -.Xr isdnd 8 -daemon to establish an ISDN connection. .It "Supports IETF draft Predictor-1 (rfc 1978) and DEFLATE (rfc 1979) compression." .Nm supports not only VJ-compression but also Predictor-1 and DEFLATE compression. @@ -3517,24 +3510,16 @@ checks for the existence of carrier one second after the login script is complete. If it's not set, .Nm assumes that this is because the device doesn't support carrier (which -is true for most -.Dq laplink -NULL-modem cables), logs the fact and stops checking +is true for most NULL-modem cables), logs the fact and stops checking for carrier. However, some modems take some time to assert the carrier signal, resulting in .Nm ppp Ns No s inability to detect when the link is dropped. -.Ar seconds +.Ar Seconds specifies the number of seconds that .Nm -should wait after the dial script has finished before deciding if -carrier is available or not. -.Pp -.Nm -will not proceed to the login script until either carrier is detected -or until -.Ar seconds -has elapsed. +should wait after the login script has finished before first checking for +carrier. .Pp If .Ar seconds @@ -3543,21 +3528,12 @@ is followed immediately by an exclaimation mark .Nm will .Em require -carrier. If carrier is not detected after -.Ar seconds -seconds, the link will be disconnected. -.Pp -For ISDN devices, -.Nm -will always insist on carrier. Carrier is raised by the i4brbchX device -driver only after the call has connected. It is therefore wise to set -a reasonable value such as -.Ar 6 -seconds. +carrier. If carrier is not detected at the first check, the link will +be considered disconnected. .Pp Carrier .Em require Ns No ment -is ignored for all other device types. +is ignored when the link is not a tty device. .It set choked Op Ar timeout This sets the number of seconds that .Nm @@ -3623,14 +3599,8 @@ This sets the device(s) to which .Nm will talk to the given .Dq value . -.Pp -All ISDN and serial device names are expected to begin with +All serial device names are expected to begin with .Pa /dev/ . -ISDN devices are usually called -.Pa i4brbchX -and serial devices are usually called -.Pa cuaaX . -.Pp If .Dq value does not begin with @@ -3638,7 +3608,7 @@ does not begin with it must either begin with an exclamation mark .Pq Dq \&! or be of the format -.Dq host:port Ns Op Ns /proto . +.Dq host:port . .Pp If it begins with an exclamation mark, the rest of the device name is treated as a program name, and that program is executed when the device @@ -4646,7 +4616,6 @@ This socket is used to pass links between different instances of .Xr getty 8 , .Xr inetd 8 , .Xr init 8 , -.Xr isdn 8 , .Xr named 8 , .Xr ping 8 , .Xr pppctl 8 , diff --git a/usr.sbin/ppp/ppp/tcp.c b/usr.sbin/ppp/ppp/tcp.c index 5be9f41dbab..09e7525be98 100644 --- a/usr.sbin/ppp/ppp/tcp.c +++ b/usr.sbin/ppp/ppp/tcp.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: tcp.c,v 1.5 1999/07/15 02:04:07 brian Exp $ + * $Id: tcp.c,v 1.6 1999/07/15 02:10:32 brian Exp $ */ #include <sys/types.h> @@ -44,6 +44,7 @@ #include "defs.h" #include "mbuf.h" #include "log.h" +#include "sync.h" #include "timer.h" #include "lqr.h" #include "hdlc.h" @@ -108,7 +109,6 @@ static struct device tcpdevice = { NULL, NULL, NULL, - NULL, NULL }; diff --git a/usr.sbin/ppp/ppp/tty.c b/usr.sbin/ppp/ppp/tty.c index 881b384648c..0a0182d375b 100644 --- a/usr.sbin/ppp/ppp/tty.c +++ b/usr.sbin/ppp/ppp/tty.c @@ -23,32 +23,32 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: tty.c,v 1.10 1999/07/15 02:04:07 brian Exp $ + * $Id: tty.c,v 1.11 1999/07/15 02:10:32 brian Exp $ */ #include <sys/param.h> -/* #include <sys/socket.h> (auto-remove) */ -/* #include <netinet/in.h> (auto-remove) */ -/* #include <arpa/inet.h> (auto-remove) */ -/* #include <netdb.h> (auto-remove) */ -/* #include <netinet/in_systm.h> (auto-remove) */ -/* #include <netinet/ip.h> (auto-remove) */ +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> +#include <netdb.h> +#include <netinet/in_systm.h> +#include <netinet/ip.h> #include <sys/un.h> #if defined(__OpenBSD__) || defined(__NetBSD__) #include <sys/ioctl.h> -/* #include <util.h> (auto-remove) */ +#include <util.h> #else -/* #include <libutil.h> (auto-remove) */ +#include <libutil.h> #endif #include <errno.h> #include <fcntl.h> -/* #include <paths.h> (auto-remove) */ -/* #include <stdio.h> (auto-remove) */ +#include <paths.h> +#include <stdio.h> #include <stdlib.h> #include <string.h> #include <sysexits.h> -/* #include <sys/wait.h> (auto-remove) */ +#include <sys/wait.h> #include <sys/uio.h> #include <termios.h> #include <unistd.h> @@ -57,8 +57,8 @@ #include "defs.h" #include "mbuf.h" #include "log.h" -/* #include "id.h" (auto-remove) */ -/* #include "sync.h" (auto-remove) */ +#include "id.h" +#include "sync.h" #include "timer.h" #include "lqr.h" #include "hdlc.h" @@ -68,20 +68,20 @@ #include "ccp.h" #include "link.h" #include "async.h" -/* #include "slcompress.h" (auto-remove) */ -/* #include "iplist.h" (auto-remove) */ -/* #include "ipcp.h" (auto-remove) */ -/* #include "filter.h" (auto-remove) */ +#include "slcompress.h" +#include "iplist.h" +#include "ipcp.h" +#include "filter.h" #include "descriptor.h" #include "physical.h" #include "mp.h" #ifndef NORADIUS -/* #include "radius.h" (auto-remove) */ +#include "radius.h" #endif #include "chat.h" -/* #include "command.h" (auto-remove) */ -/* #include "bundle.h" (auto-remove) */ -/* #include "prompt.h" (auto-remove) */ +#include "command.h" +#include "bundle.h" +#include "prompt.h" #include "auth.h" #include "chap.h" #include "cbcp.h" @@ -95,7 +95,6 @@ struct ttydevice { struct device dev; /* What struct physical knows about */ struct pppTimer Timer; /* CD checks */ int mbits; /* Current DCD status */ - int carrier_seconds; /* seconds before CD is *required* */ struct termios ios; /* To be able to reset from raw mode */ }; @@ -125,35 +124,29 @@ tty_Timeout(void *data) if (p->fd >= 0) { if (ioctl(p->fd, TIOCMGET, &dev->mbits) < 0) { - /* we must be a pty ? */ - log_Printf(LogDEBUG, "%s: ioctl error (%s)!\n", p->link.name, + log_Printf(LogPHASE, "%s: ioctl error (%s)!\n", p->link.name, strerror(errno)); + datalink_Down(p->dl, CLOSE_NORMAL); timer_Stop(&dev->Timer); return; } - } else { -log_Printf(LogPHASE, "timeout ?\n"); + } else dev->mbits = 0; -} if (ombits == -1) { /* First time looking for carrier */ if (Online(dev)) - log_Printf(LogPHASE, "%s: %s: CD detected\n", p->link.name, p->name.full); - else if (++dev->carrier_seconds >= p->cfg.cd.delay) { - if (p->cfg.cd.required) - log_Printf(LogPHASE, "%s: %s: Required CD not detected\n", - p->link.name, p->name.full); - else { - log_Printf(LogPHASE, "%s: %s doesn't support CD\n", - p->link.name, p->name.full); - dev->mbits = TIOCM_CD; /* Dodgy null-modem cable ? */ - } + log_Printf(LogDEBUG, "%s: %s: CD detected\n", p->link.name, p->name.full); + else if (p->cfg.cd.required) { + log_Printf(LogPHASE, "%s: %s: Required CD not detected\n", + p->link.name, p->name.full); + datalink_Down(p->dl, CLOSE_NORMAL); + } else { + log_Printf(LogPHASE, "%s: %s doesn't support CD\n", + p->link.name, p->name.full); timer_Stop(&dev->Timer); - /* tty_AwaitCarrier() will notice */ - } else - /* Keep waiting */ - dev->mbits = -1; + dev->mbits = TIOCM_CD; + } } else { change = ombits ^ dev->mbits; if (change & TIOCM_CD) { @@ -177,66 +170,52 @@ tty_StartTimer(struct physical *p) struct ttydevice *dev = device2tty(p->handler); timer_Stop(&dev->Timer); - dev->Timer.load = SECTICKS; + dev->Timer.load = SECTICKS * p->cfg.cd.delay; dev->Timer.func = tty_Timeout; dev->Timer.name = "tty CD"; dev->Timer.arg = p; log_Printf(LogDEBUG, "%s: Using tty_Timeout [%p]\n", p->link.name, tty_Timeout); + dev->mbits = -1; /* So we know it's the first time */ timer_Start(&dev->Timer); } static int -tty_AwaitCarrier(struct physical *p) -{ - struct ttydevice *dev = device2tty(p->handler); - - if (physical_IsSync(p)) - return CARRIER_OK; - - if (dev->mbits == -1) { - if (dev->Timer.state == TIMER_STOPPED) { - dev->carrier_seconds = 0; - tty_StartTimer(p); - } - return CARRIER_PENDING; /* Not yet ! */ - } - - return Online(dev) || !p->cfg.cd.required ? CARRIER_OK : CARRIER_LOST; -} - -static int tty_Raw(struct physical *p) { struct ttydevice *dev = device2tty(p->handler); struct termios ios; int oldflag; - log_Printf(LogDEBUG, "%s: Entering tty_Raw\n", p->link.name); + if (physical_IsSync(p)) + return 1; + + log_Printf(LogDEBUG, "%s: Entering physical_Raw\n", p->link.name); if (p->type != PHYS_DIRECT && p->fd >= 0 && !Online(dev)) log_Printf(LogDEBUG, "%s: Raw: descriptor = %d, mbits = %x\n", p->link.name, p->fd, dev->mbits); - if (!physical_IsSync(p)) { - tcgetattr(p->fd, &ios); - cfmakeraw(&ios); - if (p->cfg.rts_cts) - ios.c_cflag |= CLOCAL | CCTS_OFLOW | CRTS_IFLOW; - else - ios.c_cflag |= CLOCAL; + tcgetattr(p->fd, &ios); + cfmakeraw(&ios); + if (p->cfg.rts_cts) + ios.c_cflag |= CLOCAL | CCTS_OFLOW | CRTS_IFLOW; + else + ios.c_cflag |= CLOCAL; - if (p->type != PHYS_DEDICATED) - ios.c_cflag |= HUPCL; + if (p->type != PHYS_DEDICATED) + ios.c_cflag |= HUPCL; - tcsetattr(p->fd, TCSANOW, &ios); - } + tcsetattr(p->fd, TCSANOW, &ios); oldflag = fcntl(p->fd, F_GETFL, 0); if (oldflag < 0) return 0; fcntl(p->fd, F_SETFL, oldflag | O_NONBLOCK); + if (ioctl(p->fd, TIOCMGET, &dev->mbits) == 0) + tty_StartTimer(p); + return 1; } @@ -247,7 +226,7 @@ tty_Offline(struct physical *p) if (p->fd >= 0) { timer_Stop(&dev->Timer); - dev->mbits &= ~TIOCM_DTR; /* XXX: Hmm, what's this supposed to do ? */ + dev->mbits &= ~TIOCM_DTR; if (Online(dev)) { struct termios tio; @@ -270,12 +249,12 @@ tty_Cooked(struct physical *p) tty_Offline(p); /* In case of emergency close()s */ tcflush(p->fd, TCIOFLUSH); - - if (!physical_IsSync(p)) + if (!physical_IsSync(p)) { tcsetattr(p->fd, TCSAFLUSH, &dev->ios); - - if ((oldflag = fcntl(p->fd, F_GETFL, 0)) != -1) - fcntl(p->fd, F_SETFL, oldflag & ~O_NONBLOCK); + oldflag = fcntl(p->fd, F_GETFL, 0); + if (oldflag == 0) + fcntl(p->fd, F_SETFL, oldflag & ~O_NONBLOCK); + } } static void @@ -317,7 +296,6 @@ tty_OpenInfo(struct physical *p) else strcpy(buf, "no"); strcat(buf, " carrier"); - return buf; } @@ -345,7 +323,6 @@ tty_device2iov(struct device *d, struct iovec *iov, int *niov, static struct device basettydevice = { TTY_DEVICE, "tty", - tty_AwaitCarrier, tty_Raw, tty_Offline, tty_Cooked, @@ -416,7 +393,6 @@ tty_Create(struct physical *p) memcpy(&dev->dev, &basettydevice, sizeof dev->dev); memset(&dev->Timer, '\0', sizeof dev->Timer); - dev->mbits = -1; tcgetattr(p->fd, &ios); dev->ios = ios; @@ -448,6 +424,22 @@ tty_Create(struct physical *p) "cflag = %lx\n", p->link.name, (u_long)ios.c_iflag, (u_long)ios.c_oflag, (u_long)ios.c_cflag); + if (ioctl(p->fd, TIOCMGET, &dev->mbits) == -1) { + if (p->type != PHYS_DIRECT) { + /* Complete failure - parent doesn't continue trying to ``create'' */ + + log_Printf(LogWARN, "%s: Open: Cannot get physical status: %s\n", + p->link.name, strerror(errno)); + tty_Cooked(p); + close(p->fd); + p->fd = -1; + return NULL; + } else + dev->mbits = TIOCM_CD; + } + log_Printf(LogDEBUG, "%s: Open: physical control = %o\n", + p->link.name, dev->mbits); + oldflag = fcntl(p->fd, F_GETFL, 0); if (oldflag < 0) { /* Complete failure - parent doesn't continue trying to ``create'' */ @@ -457,7 +449,6 @@ tty_Create(struct physical *p) tty_Cooked(p); close(p->fd); p->fd = -1; - free(dev); return NULL; } else fcntl(p->fd, F_SETFL, oldflag & ~O_NONBLOCK); diff --git a/usr.sbin/ppp/ppp/udp.c b/usr.sbin/ppp/ppp/udp.c index 73965230b2c..cea2118b561 100644 --- a/usr.sbin/ppp/ppp/udp.c +++ b/usr.sbin/ppp/ppp/udp.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: udp.c,v 1.4 1999/07/15 02:04:07 brian Exp $ + * $Id: udp.c,v 1.5 1999/07/15 02:10:32 brian Exp $ */ #include <sys/types.h> @@ -45,6 +45,7 @@ #include "defs.h" #include "mbuf.h" #include "log.h" +#include "sync.h" #include "timer.h" #include "lqr.h" #include "hdlc.h" @@ -136,7 +137,6 @@ static const struct device baseudpdevice = { NULL, NULL, NULL, - NULL, udp_Free, udp_Recvfrom, udp_Sendto, diff --git a/usr.sbin/ppp/ppp/vjcomp.c b/usr.sbin/ppp/ppp/vjcomp.c index b64c2fc38e3..17453cfe600 100644 --- a/usr.sbin/ppp/ppp/vjcomp.c +++ b/usr.sbin/ppp/ppp/vjcomp.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: vjcomp.c,v 1.9 1999/07/15 02:04:07 brian Exp $ + * $Id: vjcomp.c,v 1.10 1999/07/15 02:10:33 brian Exp $ * * TODO: */ @@ -28,7 +28,7 @@ #include <sys/un.h> #include <stdio.h> -/* #include <string.h> (auto-remove) */ +#include <string.h> #include <termios.h> #include "layer.h" |