X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Fsys-svr4.c;h=5f0ffa573689c80a0ddff1aaa2299998cc67e0dd;hb=cb81f8465934497ad021639842ce95ab66ec44b8;hp=64ad5f94a4c0867c2fa224ab21772cc15b9ded91;hpb=7cb4808861c696131ee0e34165c5b1450eb0e8f6;p=ppp.git diff --git a/pppd/sys-svr4.c b/pppd/sys-svr4.c index 64ad5f9..5f0ffa5 100644 --- a/pppd/sys-svr4.c +++ b/pppd/sys-svr4.c @@ -25,9 +25,7 @@ * OR MODIFICATIONS. */ -#ifndef lint -static char rcsid[] = "$Id: sys-svr4.c,v 1.31 1999/06/24 00:18:41 paulus Exp $"; -#endif +#define RCSID "$Id: sys-svr4.c,v 1.34 1999/09/08 01:11:16 masputra Exp $" #include #include @@ -69,6 +67,8 @@ static char rcsid[] = "$Id: sys-svr4.c,v 1.31 1999/06/24 00:18:41 paulus Exp $"; #include "pppd.h" +static const char rcsid[] = RCSID; + static int pppfd; static int fdmuxid = -1; static int ipfd; @@ -111,6 +111,37 @@ static int dlpi_info_req __P((int)); static int dlpi_get_reply __P((int, union DL_primitives *, int, int)); static int strioctl __P((int, int, void *, int, int)); +#ifdef SOL2 +/* + * sifppa - Sets interface ppa + * + * without setting the ppa, ip module will return EINVAL upon setting the + * interface UP (SIOCSxIFFLAGS). This is because ip module in 2.8 expects + * two DLPI_INFO_REQ to be sent down to the driver (below ip) before + * IFF_UP can be set. Plumbing the device causes one DLPI_INFO_REQ to + * be sent down, and the second DLPI_INFO_REQ is sent upon receiving + * IF_UNITSEL (old) or SIOCSLIFNAME (new) ioctls. Such setting of the ppa + * is required because the ppp DLPI provider advertises itself as + * a DLPI style 2 type, which requires a point of attachment to be + * specified. The only way the user can specify a point of attachment + * is via SIOCSLIFNAME or IF_UNITSEL. + * + * Such changes in the behavior of ip module was made to meet new or + * evolving standards requirements. + * + */ +static int +sifppa(fd, ppa) + int fd; + int ppa; +{ + if (ioctl(fd, IF_UNITSEL, (char *)&ppa) < 0) { + return 0; + } + + return 1; +} +#endif /* SOL2 */ /* * sys_init - System-dependent initialization. @@ -163,6 +194,18 @@ sys_init() close(ifd); fatal("Can't push IP module: %m"); } + +#ifdef SOL2 + /* + * Assign ppa according to the unit number returned by ppp device + * after plumbing is completed above. + */ + if (sifppa(ifd, ifunit) < 0) { + close (ifd); + fatal("Can't set ppa for unit %d: %m", ifunit); + } +#endif /* SOL2 */ + #else if (dlpi_attach(ifd, ifunit) < 0 || dlpi_get_reply(ifd, &reply.prim, DL_OK_ACK, sizeof(reply)) < 0) { @@ -280,11 +323,14 @@ establish_ppp(fd) /* Push the async hdlc module and the compressor module. */ tty_npushed = 0; - if (ioctl(fd, I_PUSH, "ppp_ahdl") < 0) { - error("Couldn't push PPP Async HDLC module: %m"); - return -1; + + if(!sync_serial) { + if (ioctl(fd, I_PUSH, "ppp_ahdl") < 0) { + error("Couldn't push PPP Async HDLC module: %m"); + return -1; + } + ++tty_npushed; } - ++tty_npushed; if (kdebugflag & 4) { i = PPPDBG_LOG + PPPDBG_AHDLC; strioctl(pppfd, PPPIO_DEBUG, &i, sizeof(int), 0); @@ -515,7 +561,7 @@ set_up_tty(fd, local) struct termiox tiox; #endif - if (tcgetattr(fd, &tios) < 0) + if (!sync_serial && tcgetattr(fd, &tios) < 0) fatal("tcgetattr: %m"); #ifndef CRTSCTS @@ -580,7 +626,7 @@ set_up_tty(fd, local) fatal("Baud rate for %s is 0; need explicit baud rate", devnam); } - if (tcsetattr(fd, TCSAFLUSH, &tios) < 0) + if (!sync_serial && tcsetattr(fd, TCSAFLUSH, &tios) < 0) fatal("tcsetattr: %m"); #ifndef CRTSCTS