X-Git-Url: https://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=pppd%2Fsys-NeXT.c;h=3f97b4cf74ed6de0330801fe6a2da58192a999ff;hp=9def3fec50e87a84f08d805fbe82c7cb934b4590;hb=b6101aaab41daebf1df13747af0923f51d5c549b;hpb=c0c6e678b9469b9d867cff36dbd4d915f8ac46b5 diff --git a/pppd/sys-NeXT.c b/pppd/sys-NeXT.c index 9def3fe..3f97b4c 100644 --- a/pppd/sys-NeXT.c +++ b/pppd/sys-NeXT.c @@ -20,7 +20,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: sys-NeXT.c,v 1.2 1995/10/27 03:44:56 paulus Exp $"; +static char rcsid[] = "$Id: sys-NeXT.c,v 1.4 1996/01/01 23:03:23 paulus Exp $"; #endif #include @@ -164,7 +164,8 @@ ppp_available() * establish_ppp - Turn the serial port into a ppp interface. */ void -establish_ppp() +establish_ppp(fd) + int fd; { int pppdisc = PPPDISC; int x; @@ -214,7 +215,8 @@ establish_ppp() * This shouldn't call die() because it's called from die(). */ void -disestablish_ppp() +disestablish_ppp(fd) + int fd; { int x; char *s; @@ -332,6 +334,12 @@ struct speed { #ifdef B57600 { 57600, B57600 }, #endif +/* +#ifndef B115200 +#warning Defining B115200 +#define B115200 20 +#endif +*/ #ifdef B115200 { 115200, B115200 }, #endif @@ -399,6 +407,7 @@ set_up_tty(fd, local) tios.c_cflag |= CS8 | CREAD | HUPCL; if (local || !modem) tios.c_cflag |= CLOCAL; + tios.c_iflag = IGNBRK | IGNPAR; tios.c_oflag = 0; tios.c_lflag = 0; @@ -438,7 +447,8 @@ set_up_tty(fd, local) * restore_tty - restore the terminal to the saved settings. */ void -restore_tty() +restore_tty(fd) + int fd; { if (restore_term) { if (tcsetattr(fd, TCSAFLUSH, &inittermios) < 0) @@ -486,7 +496,7 @@ output(unit, p, len) if (debug) log_packet(p, len, "sent "); - if (write(fd, p, len) < 0) { + if (write(ttyfd, p, len) < 0) { if (errno == EWOULDBLOCK || errno == ENOBUFS || errno == ENXIO || errno == EIO) { syslog(LOG_WARNING, "write: warning: %m"); @@ -499,7 +509,7 @@ output(unit, p, len) /* - * wait_input - wait until there is data available on fd, + * wait_input - wait until there is data available on ttyfd, * for the length of time specified by *timo (indefinite * if timo is NULL). */ @@ -511,8 +521,8 @@ wait_input(timo) int n; FD_ZERO(&ready); - FD_SET(fd, &ready); - n = select(fd+1, &ready, NULL, &ready, timo); + FD_SET(ttyfd, &ready); + n = select(ttyfd+1, &ready, NULL, &ready, timo); if (n < 0 && errno != EINTR) { syslog(LOG_ERR, "select: %m"); die(1); @@ -529,12 +539,12 @@ read_packet(buf) { int len; - if ((len = read(fd, buf, PPP_MTU + PPP_HDRLEN)) < 0) { + if ((len = read(ttyfd, buf, PPP_MTU + PPP_HDRLEN)) < 0) { if (errno == EWOULDBLOCK || errno == EINTR) { - MAINDEBUG((LOG_DEBUG, "read(fd): %m")); + MAINDEBUG((LOG_DEBUG, "read: %m")); return -1; } - syslog(LOG_ERR, "read(fd): %m"); + syslog(LOG_ERR, "read: %m"); die(1); } return len; @@ -561,18 +571,18 @@ ppp_send_config(unit, mtu, asyncmap, pcomp, accomp) quit(); } - if (ioctl(fd, PPPIOCSASYNCMAP, (caddr_t) &asyncmap) < 0) { + if (ioctl(ttyfd, PPPIOCSASYNCMAP, (caddr_t) &asyncmap) < 0) { syslog(LOG_ERR, "ioctl(PPPIOCSASYNCMAP): %m"); quit(); } - if (ioctl(fd, PPPIOCGFLAGS, (caddr_t) &x) < 0) { + if (ioctl(ttyfd, PPPIOCGFLAGS, (caddr_t) &x) < 0) { syslog(LOG_ERR, "ioctl(PPPIOCGFLAGS): %m"); quit(); } x = pcomp? x | SC_COMP_PROT: x &~ SC_COMP_PROT; x = accomp? x | SC_COMP_AC: x &~ SC_COMP_AC; - if (ioctl(fd, PPPIOCSFLAGS, (caddr_t) &x) < 0) { + if (ioctl(ttyfd, PPPIOCSFLAGS, (caddr_t) &x) < 0) { syslog(LOG_ERR, "ioctl(PPPIOCSFLAGS): %m"); quit(); } @@ -587,7 +597,7 @@ ppp_set_xaccm(unit, accm) int unit; ext_accm accm; { - if (ioctl(fd, PPPIOCSXASYNCMAP, accm) < 0 && errno != ENOTTY) + if (ioctl(ttyfd, PPPIOCSXASYNCMAP, accm) < 0 && errno != ENOTTY) syslog(LOG_WARNING, "ioctl(PPPIOCSXASYNCMAP): %m"); } @@ -604,20 +614,20 @@ ppp_recv_config(unit, mru, asyncmap, pcomp, accomp) { int x; - if (ioctl(fd, PPPIOCSMRU, (caddr_t) &mru) < 0) { + if (ioctl(ttyfd, PPPIOCSMRU, (caddr_t) &mru) < 0) { syslog(LOG_ERR, "ioctl(PPPIOCSMRU): %m"); quit(); } - if (ioctl(fd, PPPIOCSRASYNCMAP, (caddr_t) &asyncmap) < 0) { + if (ioctl(ttyfd, PPPIOCSRASYNCMAP, (caddr_t) &asyncmap) < 0) { syslog(LOG_ERR, "ioctl(PPPIOCSRASYNCMAP): %m"); quit(); } - if (ioctl(fd, PPPIOCGFLAGS, (caddr_t) &x) < 0) { + if (ioctl(ttyfd, PPPIOCGFLAGS, (caddr_t) &x) < 0) { syslog(LOG_ERR, "ioctl(PPPIOCGFLAGS): %m"); quit(); } x = !accomp? x | SC_REJ_COMP_AC: x &~ SC_REJ_COMP_AC; - if (ioctl(fd, PPPIOCSFLAGS, (caddr_t) &x) < 0) { + if (ioctl(ttyfd, PPPIOCSFLAGS, (caddr_t) &x) < 0) { syslog(LOG_ERR, "ioctl(PPPIOCSFLAGS): %m"); quit(); } @@ -637,7 +647,7 @@ ccp_test(unit, opt_ptr, opt_len, for_transmit) data.ptr = opt_ptr; data.length = opt_len; data.transmit = for_transmit; - if (ioctl(fd, PPPIOCSCOMPRESS, (caddr_t) &data) >= 0) + if (ioctl(ttyfd, PPPIOCSCOMPRESS, (caddr_t) &data) >= 0) return 1; return (errno == ENOBUFS)? 0: -1; } @@ -651,13 +661,13 @@ ccp_flags_set(unit, isopen, isup) { int x; - if (ioctl(fd, PPPIOCGFLAGS, (caddr_t) &x) < 0) { + if (ioctl(ttyfd, PPPIOCGFLAGS, (caddr_t) &x) < 0) { syslog(LOG_ERR, "ioctl(PPPIOCGFLAGS): %m"); return; } x = isopen? x | SC_CCP_OPEN: x &~ SC_CCP_OPEN; x = isup? x | SC_CCP_UP: x &~ SC_CCP_UP; - if (ioctl(fd, PPPIOCSFLAGS, (caddr_t) &x) < 0) + if (ioctl(ttyfd, PPPIOCSFLAGS, (caddr_t) &x) < 0) syslog(LOG_ERR, "ioctl(PPPIOCSFLAGS): %m"); } @@ -672,7 +682,7 @@ ccp_fatal_error(unit) { int x; - if (ioctl(fd, PPPIOCGFLAGS, (caddr_t) &x) < 0) { + if (ioctl(ttyfd, PPPIOCGFLAGS, (caddr_t) &x) < 0) { syslog(LOG_ERR, "ioctl(PPPIOCGFLAGS): %m"); return 0; } @@ -688,17 +698,17 @@ sifvjcomp(u, vjcomp, cidcomp, maxcid) { u_int x; - if (ioctl(fd, PPPIOCGFLAGS, (caddr_t) &x) < 0) { + if (ioctl(ttyfd, PPPIOCGFLAGS, (caddr_t) &x) < 0) { syslog(LOG_ERR, "ioctl(PPIOCGFLAGS): %m"); return 0; } x = vjcomp ? x | SC_COMP_TCP: x &~ SC_COMP_TCP; x = cidcomp? x & ~SC_NO_TCP_CCID: x | SC_NO_TCP_CCID; - if (ioctl(fd, PPPIOCSFLAGS, (caddr_t) &x) < 0) { + if (ioctl(ttyfd, PPPIOCSFLAGS, (caddr_t) &x) < 0) { syslog(LOG_ERR, "ioctl(PPPIOCSFLAGS): %m"); return 0; } - if (ioctl(fd, PPPIOCSMAXCID, (caddr_t) &maxcid) < 0) { + if (ioctl(ttyfd, PPPIOCSMAXCID, (caddr_t) &maxcid) < 0) { syslog(LOG_ERR, "ioctl(PPPIOCSFLAGS): %m"); return 0; } @@ -733,18 +743,18 @@ sifup(u) if_is_up = 1; npi.protocol = PPP_IP; npi.mode = NPMODE_PASS; - if (ioctl(fd, PPPIOCSNPMODE, &npi) < 0) { + if (ioctl(ttyfd, PPPIOCSNPMODE, &npi) < 0) { if (errno != ENOTTY) { syslog(LOG_ERR, "ioctl(PPPIOCSNPMODE): %m"); return 0; } /* for backwards compatibility */ - if (ioctl(fd, PPPIOCGFLAGS, (caddr_t) &x) < 0) { + if (ioctl(ttyfd, PPPIOCGFLAGS, (caddr_t) &x) < 0) { syslog(LOG_ERR, "ioctl (PPPIOCGFLAGS): %m"); return 0; } x |= SC_ENABLE_IP; - if (ioctl(fd, PPPIOCSFLAGS, (caddr_t) &x) < 0) { + if (ioctl(ttyfd, PPPIOCSFLAGS, (caddr_t) &x) < 0) { syslog(LOG_ERR, "ioctl(PPPIOCSFLAGS): %m"); return 0; } @@ -767,18 +777,18 @@ sifdown(u) rv = 1; npi.protocol = PPP_IP; npi.mode = NPMODE_ERROR; - if (ioctl(fd, PPPIOCSNPMODE, (caddr_t) &npi) < 0) { + if (ioctl(ttyfd, PPPIOCSNPMODE, (caddr_t) &npi) < 0) { if (errno != ENOTTY) { syslog(LOG_ERR, "ioctl(PPPIOCSNPMODE): %m"); rv = 0; } else { /* backwards compatibility */ - if (ioctl(fd, PPPIOCGFLAGS, (caddr_t) &x) < 0) { + if (ioctl(ttyfd, PPPIOCGFLAGS, (caddr_t) &x) < 0) { syslog(LOG_ERR, "ioctl (PPPIOCGFLAGS): %m"); rv = 0; } else { x &= ~SC_ENABLE_IP; - if (ioctl(fd, PPPIOCSFLAGS, (caddr_t) &x) < 0) { + if (ioctl(ttyfd, PPPIOCSFLAGS, (caddr_t) &x) < 0) { syslog(LOG_ERR, "ioctl(PPPIOCSFLAGS): %m"); rv = 0; }