From ee9e29919a9c98b9c9b3805ebe9e975a9d143d73 Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Tue, 16 Mar 1999 22:53:49 +0000 Subject: [PATCH] make establish_ppp and open_ppp_loopback return the correct fd --- pppd/sys-NeXT.c | 8 +++++--- pppd/sys-aix4.c | 6 ++++-- pppd/sys-bsd.c | 9 ++++++--- pppd/sys-linux.c | 5 ++--- pppd/sys-osf.c | 12 ++++++++---- pppd/sys-sunos4.c | 11 +++++++---- pppd/sys-svr4.c | 9 ++++++--- pppd/sys-ultrix.c | 12 +++++++----- 8 files changed, 45 insertions(+), 27 deletions(-) diff --git a/pppd/sys-NeXT.c b/pppd/sys-NeXT.c index 8302136..373fb58 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.13 1999/03/16 02:57:05 paulus Exp $"; +static char rcsid[] = "$Id: sys-NeXT.c,v 1.14 1999/03/16 22:53:46 paulus Exp $"; #endif #include @@ -184,7 +184,7 @@ file in the ppp-2.2 distribution.\n"; /* * establish_ppp - Turn the serial port into a ppp interface. */ -void +int establish_ppp(fd) int fd; { @@ -224,6 +224,7 @@ establish_ppp(fd) warn("Couldn't set device to non-blocking mode: %m"); } + return fd; } @@ -1516,7 +1517,7 @@ sifnpmode(u, proto, mode) * packets in demand mode, and connect it to a ppp interface. * Here we use a pty. */ -void +int open_ppp_loopback() { @@ -1568,6 +1569,7 @@ open_ppp_loopback() } } + return loop_master; #endif } diff --git a/pppd/sys-aix4.c b/pppd/sys-aix4.c index 7de3ff6..9c92e3f 100644 --- a/pppd/sys-aix4.c +++ b/pppd/sys-aix4.c @@ -21,7 +21,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: sys-aix4.c,v 1.16 1999/03/16 02:57:05 paulus Exp $"; +static char rcsid[] = "$Id: sys-aix4.c,v 1.17 1999/03/16 22:53:46 paulus Exp $"; #endif /* @@ -183,7 +183,7 @@ ppp_available() /* * establish_ppp - Turn the serial port into a ppp interface. */ -void +int establish_ppp(fd) int fd; { @@ -242,6 +242,8 @@ establish_ppp(fd) || fcntl(fd, F_SETFL, initfdflags | O_NONBLOCK) == -1) { warn("Couldn't set device to non-blocking mode: %m"); } + + return fd; } /* diff --git a/pppd/sys-bsd.c b/pppd/sys-bsd.c index b830e01..afb644e 100644 --- a/pppd/sys-bsd.c +++ b/pppd/sys-bsd.c @@ -21,7 +21,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: sys-bsd.c,v 1.37 1999/03/16 02:57:06 paulus Exp $"; +static char rcsid[] = "$Id: sys-bsd.c,v 1.38 1999/03/16 22:53:47 paulus Exp $"; /* $NetBSD: sys-bsd.c,v 1.1.1.3 1997/09/26 18:53:04 christos Exp $ */ #endif @@ -202,7 +202,7 @@ file in the ppp-2.2 distribution.\n"; /* * establish_ppp - Turn the serial port into a ppp interface. */ -void +int establish_ppp(fd) int fd; { @@ -265,6 +265,8 @@ establish_ppp(fd) || fcntl(fd, F_SETFL, initfdflags | O_NONBLOCK) == -1) { warn("Couldn't set device to non-blocking mode: %m"); } + + return fd; } /* @@ -464,7 +466,7 @@ int fd, on; * packets in demand mode, and connect it to a ppp interface. * Here we use a pty. */ -void +int open_ppp_loopback() { int flags; @@ -512,6 +514,7 @@ open_ppp_loopback() } } + return loop_master; } diff --git a/pppd/sys-linux.c b/pppd/sys-linux.c index 7f0e581..0ed73fd 100644 --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c @@ -2108,8 +2108,7 @@ int cifaddr (int unit, u_int32_t our_adr, u_int32_t his_adr) /******************************************************************** * * open_loopback - open the device we use for getting packets - * in demand mode. Under Linux, we use our existing fd - * to the ppp driver. + * in demand mode. Under Linux, we use a pty master/slave pair. */ int open_ppp_loopback(void) @@ -2167,7 +2166,7 @@ open_ppp_loopback(void) */ set_kdebugflag (kdebugflag); - return ppp_fd; + return master_fd; } /******************************************************************** diff --git a/pppd/sys-osf.c b/pppd/sys-osf.c index f11a996..9e82ae4 100644 --- a/pppd/sys-osf.c +++ b/pppd/sys-osf.c @@ -26,7 +26,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: sys-osf.c,v 1.19 1999/03/16 02:57:06 paulus Exp $"; +static char rcsid[] = "$Id: sys-osf.c,v 1.20 1999/03/16 22:53:48 paulus Exp $"; #endif #include @@ -344,7 +344,7 @@ streamify(int fd) /* * establish_ppp - Turn the serial port into a ppp interface. */ -void +int establish_ppp(fd) int fd; { @@ -391,11 +391,14 @@ establish_ppp(fd) /* * Set device for non-blocking reads. + * XXX why do we need to do this? don't we use pppfd not fd? */ if ((initfdflags = fcntl(fd, F_GETFL)) == -1 || fcntl(fd, F_SETFL, initfdflags | O_NONBLOCK) == -1) { warn("Couldn't set device to non-blocking mode: %m"); } + + return pppfd; } /* @@ -704,12 +707,13 @@ int fd, on; /* * open_loopback - open the device we use for getting packets - * in demand mode. Under Solaris 2, we use our existing fd + * in demand mode. Under Digital Unix, we use our existing fd * to the ppp driver. */ -void +int open_ppp_loopback() { + return pppfd; } /* diff --git a/pppd/sys-sunos4.c b/pppd/sys-sunos4.c index b0d0eaa..4011742 100644 --- a/pppd/sys-sunos4.c +++ b/pppd/sys-sunos4.c @@ -26,7 +26,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: sys-sunos4.c,v 1.14 1999/03/16 02:57:07 paulus Exp $"; +static char rcsid[] = "$Id: sys-sunos4.c,v 1.15 1999/03/16 22:53:48 paulus Exp $"; #endif #include @@ -240,7 +240,7 @@ ppp_available() /* * establish_ppp - Turn the serial port into a ppp interface. */ -void +int establish_ppp(fd) int fd; { @@ -262,6 +262,8 @@ establish_ppp(fd) /* Link the serial port under the PPP multiplexor. */ if ((fdmuxid = ioctl(pppfd, I_LINK, fd)) < 0) fatal("Can't link tty to PPP mux: %m"); + + return pppfd; } /* @@ -558,12 +560,13 @@ int fd, on; /* * open_loopback - open the device we use for getting packets - * in demand mode. Under Solaris 2, we use our existing fd + * in demand mode. Under SunOS, we use our existing fd * to the ppp driver. */ -void +int open_ppp_loopback() { + return pppfd; } /* diff --git a/pppd/sys-svr4.c b/pppd/sys-svr4.c index efaaef0..e6d3d67 100644 --- a/pppd/sys-svr4.c +++ b/pppd/sys-svr4.c @@ -26,7 +26,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: sys-svr4.c,v 1.25 1999/03/16 02:57:07 paulus Exp $"; +static char rcsid[] = "$Id: sys-svr4.c,v 1.26 1999/03/16 22:53:48 paulus Exp $"; #endif #include @@ -260,7 +260,7 @@ ppp_available() /* * establish_ppp - Turn the serial port into a ppp interface. */ -void +int establish_ppp(fd) int fd; { @@ -290,6 +290,8 @@ establish_ppp(fd) /* Link the serial port under the PPP multiplexor. */ if ((fdmuxid = ioctl(pppfd, I_LINK, fd)) < 0) fatal("Can't link tty to PPP mux: %m"); + + return pppfd; } /* @@ -624,9 +626,10 @@ int fd, on; * in demand mode. Under Solaris 2, we use our existing fd * to the ppp driver. */ -void +int open_ppp_loopback() { + return pppfd; } /* diff --git a/pppd/sys-ultrix.c b/pppd/sys-ultrix.c index 53c8f7c..b9da26b 100644 --- a/pppd/sys-ultrix.c +++ b/pppd/sys-ultrix.c @@ -21,7 +21,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: sys-ultrix.c,v 1.26 1999/03/16 02:57:08 paulus Exp $"; +static char rcsid[] = "$Id: sys-ultrix.c,v 1.27 1999/03/16 22:53:49 paulus Exp $"; #endif /* @@ -205,7 +205,7 @@ file in the ppp-2.2 distribution.\n"; /* * establish_ppp - Turn the serial port into a ppp interface. */ -void +int establish_ppp(fd) int fd; { @@ -254,6 +254,8 @@ establish_ppp(fd) || fcntl(fd, F_SETFL, initfdflags | O_NONBLOCK) == -1) { warn("Couldn't set device to non-blocking mode: %m"); } + + return fd; } /* @@ -550,11 +552,11 @@ int fd, on; * packets in demand mode, and connect it to a ppp interface. * Here we use would use a pty, except that Ultrix ptys are brain-dead. */ -void +int open_ppp_loopback() { - error("open_ppp_loopback called!"); - die(1); + fatal("open_ppp_loopback called!"); + /* return loop_master; */ } -- 2.39.2