--- ppp-2.2.0f.orig/linux/kinstall.sh +++ ppp-2.2.0f/linux/kinstall.sh @@ -107,8 +107,9 @@ fi # Make the strings the same length to avoid comparison problems - f1rev=`echo "0000000000"$f1rev | rev | head -c 10 | rev` - f2rev=`echo "0000000000"$f2rev | rev | head -c 10 | rev` + # Changed to use tail because debian doesnt have rev - Alvar + f1rev=`echo "0000000000"$f1rev | tail -c 10 ` + f2rev=`echo "0000000000"$f2rev | tail -c 10 ` # Test the order of the two revisions if [ $f1rev -ge $f2rev ]; then --- ppp-2.2.0f.orig/pppd/Makefile.linux +++ ppp-2.2.0f/pppd/Makefile.linux @@ -1,6 +1,6 @@ # # pppd makefile for Linux -# $Id: Makefile.linux,v 1.1.1.3 1996/05/01 18:43:05 alvar Exp $ +# $Id: Makefile.linux,v 1.5 1996/05/26 13:33:17 alvar Exp $ # PPPDSRCS = main.c magic.c fsm.c lcp.c ipcp.c upap.c chap.c md5.c ccp.c \ @@ -22,6 +22,7 @@ # CC = gcc # DEBUG_FLAGS = -DDEBUGALL +USE_MS_DNS = 1 COMPILE_FLAGS = -D_linux_=1 -DHAVE_PATHS_H COPTS = -O2 # -g VER = 2.2.0 @@ -41,7 +42,7 @@ ifdef HAS_SHADOW CFLAGS += -DHAS_SHADOW -LIBS += -lshadow +#LIBS += -lshadow endif install: pppd --- ppp-2.2.0f.orig/pppd/auth.c +++ ppp-2.2.0f/pppd/auth.c @@ -33,7 +33,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: auth.c,v 1.1.1.3 1996/05/01 18:42:58 alvar Exp $"; +static char rcsid[] = "$Id: auth.c,v 1.2 1996/05/26 13:33:18 alvar Exp $"; #endif #include @@ -51,6 +51,9 @@ #ifdef HAS_SHADOW #include +#endif + +#ifdef HAS_PWAUTH #include #ifndef PW_PPP #define PW_PPP PW_LOGIN @@ -483,6 +486,9 @@ if (sp->sp_expire > 0 && sp->sp_expire < clock) return 3; + if (sp->sp_lstchg == 0) + return 1; + if (sp->sp_inact > 0 && sp->sp_lstchg > 0 && sp->sp_max > 0 && sp->sp_inact + sp->sp_lstchg + sp->sp_max < clock) return 2; @@ -540,21 +546,14 @@ } #ifdef HAS_SHADOW - if ((spwd = getspnam(user)) == NULL) { - pw->pw_passwd = ""; - } else { + spwd = getspnam(user); + if (spwd) { pw->pw_passwd = spwd->sp_pwdp; } + endspent(); #endif - /* - * XXX If no passwd, let them login without one. - */ - if (pw->pw_passwd == '\0') { - return (UPAP_AUTHACK); - } - -#ifdef HAS_SHADOW +#ifdef HAS_PWAUTH if (pw->pw_passwd) { if (pw->pw_passwd[0] == '@') { if (pw_auth (pw->pw_passwd+1, pw->pw_name, PW_PPP, NULL)) { @@ -566,14 +565,26 @@ return (UPAP_AUTHNAK); } } - /* check the age of the password entry */ - if (spwd && (isexpired (pw, spwd) != 0)) { - return (UPAP_AUTHNAK); - } } #else epasswd = crypt(passwd, pw->pw_passwd); if (strcmp(epasswd, pw->pw_passwd)) { + return (UPAP_AUTHNAK); + } +#endif + +#ifndef ALLOW_NO_PASSWD + /* + * If no passwd, don't let them in. + */ + if (pw->pw_passwd[0] == '\0') { + return (UPAP_AUTHACK); + } +#endif + +#ifdef HAS_SHADOW + /* check the age of the password entry */ + if (spwd && (isexpired (pw, spwd) != 0)) { return (UPAP_AUTHNAK); } #endif --- ppp-2.2.0f.orig/pppd/ipcp.c +++ ppp-2.2.0f/pppd/ipcp.c @@ -137,6 +137,8 @@ #ifdef USE_MS_DNS wo->dnsaddr[0] = wo->dnsaddr[1] = 0; + wo->winsaddr[0] = + wo->winsaddr[1] = 0; #endif wo->neg_vj = 1; @@ -888,6 +890,24 @@ } break; + case CI_MS_WINS1: + IPCPDEBUG((LOG_INFO, "ipcp: received WINS Request ")); + + /* If we do not have a WINS address then we cannot send it */ + if (wo->winsaddr[0] == 0 || + cilen != CILEN_ADDR) { /* Check CI length */ + orc = CONFREJ; /* Reject CI */ + break; + } + GETLONG(tl,p); + if (htonl(tl) != wo->winsaddr[0]) { + DECPTR(sizeof (long),p); + tl = ntohl(wo->winsaddr[0]); + PUTLONG(tl, p); + orc = CONFNAK; + } + break; + case CI_MS_DNS2: IPCPDEBUG((LOG_INFO, "ipcp: received DNS Request ")); @@ -901,6 +921,24 @@ if (htonl(tl) != wo->dnsaddr[1]) { /* and this is the 2nd one */ DECPTR(sizeof (long),p); tl = ntohl(wo->dnsaddr[1]); + PUTLONG(tl, p); + orc = CONFNAK; + } + break; + + case CI_MS_WINS2: + IPCPDEBUG((LOG_INFO, "ipcp: received WINS Request ")); + + /* If we do not have a WINS address then we cannot send it */ + if (wo->winsaddr[0] == 0 || /* Yes, this is the first one! */ + cilen != CILEN_ADDR) { /* Check CI length */ + orc = CONFREJ; /* Reject CI */ + break; + } + GETLONG(tl,p); + if (htonl(tl) != wo->winsaddr[1]) { /* and this is the 2nd one */ + DECPTR(sizeof (long),p); + tl = ntohl(wo->winsaddr[1]); PUTLONG(tl, p); orc = CONFNAK; } --- ppp-2.2.0f.orig/pppd/ipcp.h +++ ppp-2.2.0f/pppd/ipcp.h @@ -27,7 +27,9 @@ #define CI_ADDR 3 #define CI_MS_DNS1 129 /* Primary DNS value */ +#define CI_MS_WINS1 130 /* Primary WINS value */ #define CI_MS_DNS2 131 /* Secondary DNS value */ +#define CI_MS_WINS2 132 /* Secondary WINS value */ #define MAX_STATES 16 /* from slcompress.h */ @@ -55,6 +57,7 @@ u_int32_t ouraddr, hisaddr; /* Addresses in NETWORK BYTE ORDER */ #ifdef USE_MS_DNS u_int32_t dnsaddr[2]; /* Primary and secondary DNS entries */ + u_int32_t winsaddr[2]; /* Primary and secondary WINS entries */ #endif } ipcp_options; --- ppp-2.2.0f.orig/pppd/lcp.c +++ ppp-2.2.0f/pppd/lcp.c @@ -792,19 +792,22 @@ */ if ((go->neg_chap || go->neg_upap) && len >= CILEN_SHORT - && p[0] == CI_AUTHTYPE && p[1] >= CILEN_SHORT) { + && p[0] == CI_AUTHTYPE && p[1] >= CILEN_SHORT && p[1] <= len) { cilen = p[1]; + len -= cilen; + no.neg_chap = go->neg_chap; + no.neg_upap = go->neg_upap; INCPTR(2, p); GETSHORT(cishort, p); if (cishort == PPP_PAP && cilen == CILEN_SHORT) { /* - * If they are asking for PAP, then they don't want to do CHAP. + * If we were asking for CHAP, they obviously don't want to do it. * If we weren't asking for CHAP, then we were asking for PAP, * in which case this Nak is bad. */ if (!go->neg_chap) goto bad; - go->neg_chap = 0; + try.neg_chap = 0; } else if (cishort == PPP_CHAP && cilen == CILEN_CHAP) { GETCHAR(cichar, p); @@ -822,7 +825,7 @@ /* * Stop asking for PAP if we were asking for it. */ - go->neg_upap = 0; + try.neg_upap = 0; } } else { @@ -831,25 +834,14 @@ * Stop asking for what we were asking for. */ if (go->neg_chap) - go->neg_chap = 0; + try.neg_chap = 0; else - go->neg_upap = 0; + try.neg_upap = 0; p += cilen - CILEN_SHORT; } } /* - * Peer shouldn't send Nak for protocol compression or - * address/control compression requests; they should send - * a Reject instead. If they send a Nak, treat it as a Reject. - */ - if (!go->neg_chap ){ - NAKCISHORT(CI_AUTHTYPE, neg_upap, - try.neg_upap = 0; - ); - } - - /* * If they can't cope with our link quality protocol, we'll have * to stop asking for LQR. We haven't got any other protocol. * If they Nak the reporting period, take their value XXX ? @@ -869,6 +861,11 @@ looped_back = 1; ); + /* + * Peer shouldn't send Nak for protocol compression or + * address/control compression requests; they should send + * a Reject instead. If they send a Nak, treat it as a Reject. + */ NAKCIVOID(CI_PCOMPRESSION, neg_pcompression, try.neg_pcompression = 0; ); @@ -895,7 +892,7 @@ while (len > CILEN_VOID) { GETCHAR(citype, p); GETCHAR(cilen, p); - if ((len -= cilen) < 0) + if (cilen < CILEN_VOID || (len -= cilen) < 0) goto bad; next = p + cilen - 2; @@ -903,6 +900,9 @@ case CI_MRU: if (go->neg_mru || no.neg_mru || cilen != CILEN_SHORT) goto bad; + GETSHORT(cishort, p); + if (cishort < DEFMRU) + try.mru = cishort; break; case CI_ASYNCMAP: if (go->neg_asyncmap || no.neg_asyncmap || cilen != CILEN_LONG) @@ -1141,6 +1141,7 @@ orc = CONFREJ; /* Reject bad CI */ cilen = l; /* Reject till end of packet */ l = 0; /* Don't loop again */ + citype = 0; goto endswitch; } GETCHAR(citype, p); /* Parse CI type */ --- ppp-2.2.0f.orig/pppd/main.c +++ ppp-2.2.0f/pppd/main.c @@ -361,7 +361,7 @@ if (device_script(connector, fd, fd) < 0) { syslog(LOG_ERR, "Connect script failed"); setdtr(fd, FALSE); - die(1); + if (persist) goto script_failure; else die(1); } syslog(LOG_INFO, "Serial connection established."); @@ -436,12 +436,12 @@ syslog(LOG_INFO, "Serial link disconnected."); } } - +script_failure: close_fd(); if (unlink(pidfilename) < 0 && errno != ENOENT) syslog(LOG_WARNING, "unable to delete pid file: %m"); pidfilename[0] = 0; - + if (persist) sleep(10); /* Needs to be done otherwise serial port does not have time to recuperate */ } while (persist); die(0); --- ppp-2.2.0f.orig/pppd/options.c +++ ppp-2.2.0f/pppd/options.c @@ -201,6 +201,7 @@ #ifdef USE_MS_DNS static int setdnsaddr __P((char **)); +static int setwinsaddr __P((char **)); #endif static int number_option __P((char *, u_int32_t *, int)); @@ -318,6 +319,7 @@ #ifdef USE_MS_DNS {"dns-addr", 1, setdnsaddr}, /* DNS address(es) for the peer's use */ + {"wins-addr", 1, setwinsaddr}, /* WINS address(es) for the peer's use */ #endif {NULL, 0, NULL} @@ -2036,4 +2038,32 @@ return (1); } + +/* + * setwinsaddr - set the wins address(es) + */ + +static int +setwinsaddr(argv) + char **argv; +{ + u_long wins; + + wins = inet_addr(*argv); + if (wins == -1) { + fprintf(stderr, "Invalid WINS Address %s\n", *argv); + return 0; + } + + if (ipcp_wantoptions[0].winsaddr[0] == 0) { + ipcp_wantoptions[0].winsaddr[0] = wins; + ipcp_allowoptions[0].winsaddr[0] = wins; + } else { + ipcp_wantoptions[0].winsaddr[1] = wins; + ipcp_allowoptions[0].winsaddr[1] = wins; + } + + return (1); + } + #endif /* USE_MS_DNS */ --- ppp-2.2.0f.orig/pppd/pppd.h +++ ppp-2.2.0f/pppd/pppd.h @@ -192,15 +192,7 @@ #define DEBUGCHAP 1 #endif -#ifndef LOG_PPP /* we use LOG_LOCAL2 for syslog by default */ -#if defined(DEBUGMAIN) || defined(DEBUGFSM) || defined(DEBUG) \ - || defined(DEBUGLCP) || defined(DEBUGIPCP) || defined(DEBUGUPAP) \ - || defined(DEBUGCHAP) || defined(DEBUGIPXCP) #define LOG_PPP LOG_LOCAL2 -#else -#define LOG_PPP LOG_DAEMON -#endif -#endif /* LOG_PPP */ #ifdef DEBUGMAIN #define MAINDEBUG(x) if (debug) syslog x --- ppp-2.2.0f.orig/pppd/sys-linux.c +++ ppp-2.2.0f/pppd/sys-linux.c @@ -390,6 +390,12 @@ #ifdef B115200 { 115200, B115200 }, #endif +#ifdef B230400 + { 230400, B230400 }, +#endif +#ifdef B460800 + { 460800, B460800 }, +#endif { 0, 0 } }; --- ppp-2.2.0f.orig/pppd/sys-linux.c.orig +++ ppp-2.2.0f/pppd/sys-linux.c.orig @@ -0,0 +1,2063 @@ +/* + * sys-linux.c - System-dependent procedures for setting up + * PPP interfaces on Linux systems + * + * Copyright (c) 1989 Carnegie Mellon University. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by Carnegie Mellon University. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +/* + * TODO: + */ + +#include + +/* + * This is to bypass problems with earlier kernels. + */ + +#include +#undef _I386_STRING_H_ +#define _I386_STRING_H_ +#undef _LINUX_STRING_H_ +#define _LINUX_STRING_H_ + +/* + * Continue with the rest of the include sequences. + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* This is in netdevice.h. However, this compile will fail miserably if + you attempt to include netdevice.h because it has so many references + to __memcpy functions which it should not attempt to do. So, since I + really don't use it, but it must be defined, define it now. */ + +#ifndef MAX_ADDR_LEN +#define MAX_ADDR_LEN 7 +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "pppd.h" +#include "fsm.h" +#include "ipcp.h" + +static int initdisc = -1; /* Initial TTY discipline */ +static int prev_kdebugflag = 0; +static int has_default_route = 0; +static int has_proxy_arp = 0; +static int driver_version = 0; +static int driver_modification = 0; +static int driver_patch = 0; +static int restore_term = 0; /* 1 => we've munged the terminal */ +static struct termios inittermios; /* Initial TTY termios */ + +int sockfd; /* socket for doing interface ioctls */ + +static char *lock_file; + +#define MAX_IFS 5000 + +#define FLAGS_GOOD (IFF_UP | IFF_BROADCAST) +#define FLAGS_MASK (IFF_UP | IFF_BROADCAST | \ + IFF_POINTOPOINT | IFF_LOOPBACK | IFF_NOARP) + +/* + * SET_SA_FAMILY - set the sa_family field of a struct sockaddr, + * if it exists. + */ + +#define SET_SA_FAMILY(addr, family) \ + memset ((char *) &(addr), '\0', sizeof(addr)); \ + addr.sa_family = (family); + +/* + * Determine if the PPP connection should still be present. + */ + +extern int hungup; +#define still_ppp() (hungup == 0) + +/* + * Functions to read and set the flags value in the device driver + */ + +static int get_flags (void) + { + int flags; + + if (ioctl(fd, PPPIOCGFLAGS, (caddr_t) &flags) < 0) + { + syslog(LOG_ERR, "ioctl(PPPIOCGFLAGS): %m"); + quit(); + } + + MAINDEBUG ((LOG_DEBUG, "get flags = %x\n", flags)); + return flags; + } + +static void set_flags (int flags) + { + MAINDEBUG ((LOG_DEBUG, "set flags = %x\n", flags)); + + if (ioctl(fd, PPPIOCSFLAGS, (caddr_t) &flags) < 0) + { + syslog(LOG_ERR, "ioctl(PPPIOCSFLAGS, %x): %m", flags); + quit(); + } + } + +/* + * sys_init - System-dependent initialization. + */ + +void sys_init(void) + { + openlog("pppd", LOG_PID | LOG_NDELAY, LOG_PPP); + setlogmask(LOG_UPTO(LOG_INFO)); + if (debug) + { + setlogmask(LOG_UPTO(LOG_DEBUG)); + } + + /* Get an internet socket for doing socket ioctls. */ + sockfd = socket(AF_INET, SOCK_DGRAM, 0); + if (sockfd < 0) + { + syslog(LOG_ERR, "Couldn't create IP socket: %m"); + die(1); + } + } + +/* + * note_debug_level - note a change in the debug level. + */ + +void note_debug_level (void) + { + if (debug) + { + MAINDEBUG ((LOG_INFO, "Debug turned ON, Level %d", debug)); + setlogmask(LOG_UPTO(LOG_DEBUG)); + } + else + { + setlogmask(LOG_UPTO(LOG_WARNING)); + } + } + +/* + * set_kdebugflag - Define the debugging level for the kernel + */ + +int set_kdebugflag (int requested_level) + { + if (ioctl(fd, PPPIOCGDEBUG, &prev_kdebugflag) < 0) + { + syslog(LOG_ERR, "ioctl(PPPIOCGDEBUG): %m"); + return (0); + } + + if (prev_kdebugflag != requested_level) + { + if (ioctl(fd, PPPIOCSDEBUG, &requested_level) < 0) + { + syslog (LOG_ERR, "ioctl(PPPIOCSDEBUG): %m"); + return (0); + } + MAINDEBUG ((LOG_INFO, "set kernel debugging level to %d", + requested_level)); + } + return (1); + } + +/* + * establish_ppp - Turn the serial port into a ppp interface. + */ + +void establish_ppp (void) + { + int pppdisc = N_PPP; + int sig = SIGIO; + + if (ioctl(fd, TIOCEXCL, 0) < 0) + { + syslog (LOG_WARNING, "ioctl(TIOCEXCL): %m"); + } + + if (ioctl(fd, TIOCGETD, &initdisc) < 0) + { + syslog(LOG_ERR, "ioctl(TIOCGETD): %m"); + die (1); + } + + if (ioctl(fd, TIOCSETD, &pppdisc) < 0) + { + syslog(LOG_ERR, "ioctl(TIOCSETD): %m"); + die (1); + } + + if (ioctl(fd, PPPIOCGUNIT, &ifunit) < 0) + { + syslog(LOG_ERR, "ioctl(PPPIOCGUNIT): %m"); + die (1); + } + + set_kdebugflag (kdebugflag); + + set_flags (get_flags() & ~(SC_RCV_B7_0 | SC_RCV_B7_1 | + SC_RCV_EVNP | SC_RCV_ODDP)); + + MAINDEBUG ((LOG_NOTICE, "Using version %d.%d.%d of PPP driver", + driver_version, driver_modification, driver_patch)); + } + +/* + * disestablish_ppp - Restore the serial port to normal operation. + * This shouldn't call die() because it's called from die(). + */ + +void disestablish_ppp(void) + { + int x; + char *s; +/* + * Fetch the flags for the device and generate appropriate error + * messages. + */ + if (still_ppp() && initdisc >= 0) + { + if (ioctl(fd, PPPIOCGFLAGS, (caddr_t) &x) == 0) + { + s = NULL; + switch (~x & (SC_RCV_B7_0|SC_RCV_B7_1|SC_RCV_EVNP|SC_RCV_ODDP)) + { + case SC_RCV_B7_0 | SC_RCV_B7_1 | SC_RCV_EVNP | SC_RCV_ODDP: + s = "nothing was received"; + break; + + case SC_RCV_B7_0: + case SC_RCV_B7_0 | SC_RCV_EVNP: + case SC_RCV_B7_0 | SC_RCV_ODDP: + case SC_RCV_B7_0 | SC_RCV_ODDP | SC_RCV_EVNP: + s = "all had bit 7 set to 1"; + break; + + case SC_RCV_B7_1: + case SC_RCV_B7_1 | SC_RCV_EVNP: + case SC_RCV_B7_1 | SC_RCV_ODDP: + case SC_RCV_B7_1 | SC_RCV_ODDP | SC_RCV_EVNP: + s = "all had bit 7 set to 0"; + break; + + case SC_RCV_EVNP: + s = "all had odd parity"; + break; + + case SC_RCV_ODDP: + s = "all had even parity"; + break; + } + + if (s != NULL) + { + syslog(LOG_WARNING, "Receive serial link is not" + " 8-bit clean:"); + syslog(LOG_WARNING, "Problem: %s", s); + } + } + + set_kdebugflag (prev_kdebugflag); + + if (ioctl(fd, TIOCSETD, &initdisc) < 0) + { + syslog(LOG_WARNING, "ioctl(TIOCSETD): %m"); + } + + if (ioctl(fd, TIOCNXCL, 0) < 0) + { + syslog (LOG_WARNING, "ioctl(TIOCNXCL): %m"); + } + } + initdisc = -1; + } + +/* + * List of valid speeds. + */ + +struct speed { + int speed_int, speed_val; +} speeds[] = { +#ifdef B50 + { 50, B50 }, +#endif +#ifdef B75 + { 75, B75 }, +#endif +#ifdef B110 + { 110, B110 }, +#endif +#ifdef B134 + { 134, B134 }, +#endif +#ifdef B150 + { 150, B150 }, +#endif +#ifdef B200 + { 200, B200 }, +#endif +#ifdef B300 + { 300, B300 }, +#endif +#ifdef B600 + { 600, B600 }, +#endif +#ifdef B1200 + { 1200, B1200 }, +#endif +#ifdef B1800 + { 1800, B1800 }, +#endif +#ifdef B2000 + { 2000, B2000 }, +#endif +#ifdef B2400 + { 2400, B2400 }, +#endif +#ifdef B3600 + { 3600, B3600 }, +#endif +#ifdef B4800 + { 4800, B4800 }, +#endif +#ifdef B7200 + { 7200, B7200 }, +#endif +#ifdef B9600 + { 9600, B9600 }, +#endif +#ifdef B19200 + { 19200, B19200 }, +#endif +#ifdef B38400 + { 38400, B38400 }, +#endif +#ifdef EXTA + { 19200, EXTA }, +#endif +#ifdef EXTB + { 38400, EXTB }, +#endif +#ifdef B57600 + { 57600, B57600 }, +#endif +#ifdef B115200 + { 115200, B115200 }, +#endif + { 0, 0 } +}; + +/* + * Translate from bits/second to a speed_t. + */ + +int translate_speed (int bps) + { + struct speed *speedp; + + if (bps != 0) + { + for (speedp = speeds; speedp->speed_int; speedp++) + { + if (bps == speedp->speed_int) + { + return speedp->speed_val; + } + } + syslog(LOG_WARNING, "speed %d not supported", bps); + } + return 0; + } + +/* + * Translate from a speed_t to bits/second. + */ + +int baud_rate_of (int speed) + { + struct speed *speedp; + + if (speed != 0) + { + for (speedp = speeds; speedp->speed_int; speedp++) + { + if (speed == speedp->speed_val) + { + return speedp->speed_int; + } + } + } + return 0; + } + +/* + * set_up_tty: Set up the serial port on `fd' for 8 bits, no parity, + * at the requested speed, etc. If `local' is true, set CLOCAL + * regardless of whether the modem option was specified. + */ + +void set_up_tty (int fd, int local) + { + int speed, x; + struct termios tios; + + if (tcgetattr(fd, &tios) < 0) + { + syslog(LOG_ERR, "tcgetattr: %m"); + die(1); + } + + if (!restore_term) + { + inittermios = tios; + } + + tios.c_cflag &= ~(CSIZE | CSTOPB | PARENB | CLOCAL); + tios.c_cflag |= CS8 | CREAD | HUPCL; + + tios.c_iflag = IGNBRK | IGNPAR; + tios.c_oflag = 0; + tios.c_lflag = 0; + tios.c_cc[VMIN] = 1; + tios.c_cc[VTIME] = 0; + + if (local || !modem) + { + tios.c_cflag ^= (CLOCAL | HUPCL); + } + + switch (crtscts) + { + case 1: + tios.c_cflag |= CRTSCTS; + break; + + case 2: + tios.c_iflag |= IXOFF; + tios.c_cc[VSTOP] = 0x13; /* DC3 = XOFF = ^S */ + tios.c_cc[VSTART] = 0x11; /* DC1 = XON = ^Q */ + break; + + case -1: + tios.c_cflag &= ~CRTSCTS; + break; + + default: + break; + } + + speed = translate_speed(inspeed); + if (speed) + { + cfsetospeed (&tios, speed); + cfsetispeed (&tios, speed); + } +/* + * We can't proceed if the serial port speed is B0, + * since that implies that the serial port is disabled. + */ + else + { + speed = cfgetospeed(&tios); + if (speed == B0) + { + syslog(LOG_ERR, "Baud rate for %s is 0; need explicit baud rate", + devnam); + die (1); + } + } + + if (tcsetattr(fd, TCSAFLUSH, &tios) < 0) + { + syslog(LOG_ERR, "tcsetattr: %m"); + die(1); + } + + baud_rate = baud_rate_of(speed); + restore_term = TRUE; + } + +/* + * setdtr - control the DTR line on the serial port. + * This is called from die(), so it shouldn't call die(). + */ + +void setdtr (int fd, int on) + { + int modembits = TIOCM_DTR; + + if (on) + { + (void) ioctl (fd, TIOCMBIS, &modembits); + (void) ioctl (fd, TCFLSH, (caddr_t) TCIFLUSH); /* flush input */ + } + else + { + (void) ioctl (fd, TIOCMBIC, &modembits); + } + } + +/* + * restore_tty - restore the terminal to the saved settings. + */ + +void restore_tty (void) + { + if (restore_term) + { + restore_term = 0; +/* + * Turn off echoing, because otherwise we can get into + * a loop with the tty and the modem echoing to each other. + * We presume we are the sole user of this tty device, so + * when we close it, it will revert to its defaults anyway. + */ + if (!default_device) + { + inittermios.c_lflag &= ~(ECHO | ECHONL); + } + + if (tcsetattr(fd, TCSAFLUSH, &inittermios) < 0) + { + if (errno != EIO) + { + syslog(LOG_WARNING, "tcsetattr: %m"); + } + } + } + } + +/* + * output - Output PPP packet. + */ + +void output (int unit, unsigned char *p, int len) + { + if (unit != 0) + { + MAINDEBUG((LOG_WARNING, "output: unit != 0!")); + } + + if (debug) + { + log_packet(p, len, "sent "); + } + + if (write(fd, p, len) < 0) + { + syslog(LOG_ERR, "write: %m"); + die(1); + } + } + +/* + * wait_input - wait until there is data available on fd, + * for the length of time specified by *timo (indefinite + * if timo is NULL). + */ + +void wait_input (struct timeval *timo) + { + fd_set ready; + int n; + + FD_ZERO(&ready); + FD_SET(fd, &ready); + + n = select(fd+1, &ready, NULL, &ready, timo); + if (n < 0 && errno != EINTR) + { + syslog(LOG_ERR, "select: %m"); + die(1); + } + } + +/* + * read_packet - get a PPP packet from the serial device. + */ + +int read_packet (unsigned char *buf) + { + int len; + + len = read(fd, buf, PPP_MTU + PPP_HDRLEN); + if (len < 0) + { + if (errno == EWOULDBLOCK) + { + return -1; + } + syslog(LOG_ERR, "read(fd): %m"); + die(1); + } + return len; + } + +/* + * ppp_send_config - configure the transmit characteristics of + * the ppp interface. + */ + +void ppp_send_config (int unit,int mtu,u_int32_t asyncmap,int pcomp,int accomp) + { + u_int x; + struct ifreq ifr; + + MAINDEBUG ((LOG_DEBUG, "send_config: mtu = %d\n", mtu)); +/* + * Ensure that the link is still up. + */ + if (still_ppp()) + { +/* + * Set the MTU and other parameters for the ppp device + */ + memset (&ifr, '\0', sizeof (ifr)); + strncpy(ifr.ifr_name, ifname, sizeof (ifr.ifr_name)); + ifr.ifr_mtu = mtu; + + if (ioctl(sockfd, SIOCSIFMTU, (caddr_t) &ifr) < 0) + { + syslog(LOG_ERR, "ioctl(SIOCSIFMTU): %m"); + quit(); + } + + MAINDEBUG ((LOG_DEBUG, "send_config: asyncmap = %lx\n", asyncmap)); + if (ioctl(fd, PPPIOCSASYNCMAP, (caddr_t) &asyncmap) < 0) + { + syslog(LOG_ERR, "ioctl(PPPIOCSASYNCMAP): %m"); + quit(); + } + + x = get_flags(); + x = pcomp ? x | SC_COMP_PROT : x & ~SC_COMP_PROT; + x = accomp ? x | SC_COMP_AC : x & ~SC_COMP_AC; + set_flags(x); + } + } + +/* + * ppp_set_xaccm - set the extended transmit ACCM for the interface. + */ + +void ppp_set_xaccm (int unit, ext_accm accm) + { + MAINDEBUG ((LOG_DEBUG, "set_xaccm: %08lx %08lx %08lx %08lx\n", + accm[0], accm[1], accm[2], accm[3])); + + if (ioctl(fd, PPPIOCSXASYNCMAP, accm) < 0 && errno != ENOTTY) + { + syslog(LOG_WARNING, "ioctl(set extended ACCM): %m"); + } + } + +/* + * ppp_recv_config - configure the receive-side characteristics of + * the ppp interface. + */ + +void ppp_recv_config (int unit,int mru,u_int32_t asyncmap,int pcomp,int accomp) + { + u_int x; + + MAINDEBUG ((LOG_DEBUG, "recv_config: mru = %d\n", mru)); +/* + * If we were called because the link has gone down then there is nothing + * which may be done. Just return without incident. + */ + if (!still_ppp()) + { + return; + } +/* + * Set the receiver parameters + */ + if (ioctl(fd, PPPIOCSMRU, (caddr_t) &mru) < 0) + { + syslog(LOG_ERR, "ioctl(PPPIOCSMRU): %m"); + } + + MAINDEBUG ((LOG_DEBUG, "recv_config: asyncmap = %lx\n", asyncmap)); + if (ioctl(fd, PPPIOCSRASYNCMAP, (caddr_t) &asyncmap) < 0) + { + syslog(LOG_ERR, "ioctl(PPPIOCSRASYNCMAP): %m"); + quit(); + } + + x = get_flags(); + x = accomp ? x & ~SC_REJ_COMP_AC : x | SC_REJ_COMP_AC; + set_flags (x); + } + +/* + * ccp_test - ask kernel whether a given compression method + * is acceptable for use. + */ + +int ccp_test (int unit, u_char *opt_ptr, int opt_len, int for_transmit) + { + struct ppp_option_data data; + + memset (&data, '\0', sizeof (data)); + data.ptr = opt_ptr; + data.length = opt_len; + data.transmit = for_transmit; + + if (ioctl(fd, PPPIOCSCOMPRESS, (caddr_t) &data) >= 0) + { + return 1; + } + + return (errno == ENOBUFS)? 0: -1; + } + +/* + * ccp_flags_set - inform kernel about the current state of CCP. + */ + +void ccp_flags_set (int unit, int isopen, int isup) + { + if (still_ppp()) + { + int x = get_flags(); + x = isopen? x | SC_CCP_OPEN : x &~ SC_CCP_OPEN; + x = isup? x | SC_CCP_UP : x &~ SC_CCP_UP; + set_flags (x); + } + } + +/* + * ccp_fatal_error - returns 1 if decompression was disabled as a + * result of an error detected after decompression of a packet, + * 0 otherwise. This is necessary because of patent nonsense. + */ + +int ccp_fatal_error (int unit) + { + int x = get_flags(); + + return x & SC_DC_FERROR; + } + +/* + * sifvjcomp - config tcp header compression + */ + +int sifvjcomp (int u, int vjcomp, int cidcomp, int maxcid) + { + u_int x = get_flags(); + + if (vjcomp) + { + if (ioctl (fd, PPPIOCSMAXCID, (caddr_t) &maxcid) < 0) + { + syslog (LOG_ERR, "ioctl(PPPIOCSFLAGS): %m"); + vjcomp = 0; + } + } + + x = vjcomp ? x | SC_COMP_TCP : x & ~SC_COMP_TCP; + x = cidcomp ? x & ~SC_NO_TCP_CCID : x | SC_NO_TCP_CCID; + set_flags (x); + + return 1; + } + +/* + * sifup - Config the interface up and enable IP packets to pass. + */ + +int sifup (int u) + { + struct ifreq ifr; + + memset (&ifr, '\0', sizeof (ifr)); + strncpy(ifr.ifr_name, ifname, sizeof (ifr.ifr_name)); + if (ioctl(sockfd, SIOCGIFFLAGS, (caddr_t) &ifr) < 0) + { + syslog(LOG_ERR, "ioctl (SIOCGIFFLAGS): %m"); + return 0; + } + + ifr.ifr_flags |= (IFF_UP | IFF_POINTOPOINT); + if (ioctl(sockfd, SIOCSIFFLAGS, (caddr_t) &ifr) < 0) + { + syslog(LOG_ERR, "ioctl(SIOCSIFFLAGS): %m"); + return 0; + } + return 1; + } + +/* + * sifdown - Config the interface down and disable IP. + */ + +int sifdown (int u) + { + struct ifreq ifr; + + memset (&ifr, '\0', sizeof (ifr)); + strncpy(ifr.ifr_name, ifname, sizeof (ifr.ifr_name)); + if (ioctl(sockfd, SIOCGIFFLAGS, (caddr_t) &ifr) < 0) + { + syslog(LOG_ERR, "ioctl (SIOCGIFFLAGS): %m"); + return 0; + } + + ifr.ifr_flags &= ~IFF_UP; + ifr.ifr_flags |= IFF_POINTOPOINT; + if (ioctl(sockfd, SIOCSIFFLAGS, (caddr_t) &ifr) < 0) + { + syslog(LOG_ERR, "ioctl(SIOCSIFFLAGS): %m"); + return 0; + } + return 1; + } + +/* + * sifaddr - Config the interface IP addresses and netmask. + */ + +int sifaddr (int unit, int our_adr, int his_adr, int net_mask) + { + struct ifreq ifr; + struct rtentry rt; + + memset (&ifr, '\0', sizeof (ifr)); + memset (&rt, '\0', sizeof (rt)); + + SET_SA_FAMILY (ifr.ifr_addr, AF_INET); + SET_SA_FAMILY (ifr.ifr_dstaddr, AF_INET); + SET_SA_FAMILY (ifr.ifr_netmask, AF_INET); + + strncpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name)); +/* + * Set our IP address + */ + ((struct sockaddr_in *) &ifr.ifr_addr)->sin_addr.s_addr = our_adr; + if (ioctl(sockfd, SIOCSIFADDR, (caddr_t) &ifr) < 0) + { + if (errno != EEXIST) + { + syslog (LOG_ERR, "ioctl(SIOCAIFADDR): %m"); + } + else + { + syslog (LOG_WARNING, "ioctl(SIOCAIFADDR): Address already exists"); + } + return (0); + } +/* + * Set the gateway address + */ + ((struct sockaddr_in *) &ifr.ifr_dstaddr)->sin_addr.s_addr = his_adr; + if (ioctl(sockfd, SIOCSIFDSTADDR, (caddr_t) &ifr) < 0) + { + syslog (LOG_ERR, "ioctl(SIOCSIFDSTADDR): %m"); + return (0); + } +/* + * Set the netmask + */ + if (net_mask != 0) + { + ((struct sockaddr_in *) &ifr.ifr_netmask)->sin_addr.s_addr = net_mask; + if (ioctl(sockfd, SIOCSIFNETMASK, (caddr_t) &ifr) < 0) + { + syslog (LOG_ERR, "ioctl(SIOCSIFNETMASK): %m"); + return (0); + } + } +/* + * Add the device route + */ + SET_SA_FAMILY (rt.rt_dst, AF_INET); + SET_SA_FAMILY (rt.rt_gateway, AF_INET); + rt.rt_dev = ifname; /* MJC */ + + ((struct sockaddr_in *) &rt.rt_gateway)->sin_addr.s_addr = 0L; + ((struct sockaddr_in *) &rt.rt_dst)->sin_addr.s_addr = his_adr; + rt.rt_flags = RTF_UP | RTF_HOST; + + if (ioctl(sockfd, SIOCADDRT, &rt) < 0) + { + syslog (LOG_ERR, "ioctl(SIOCADDRT) device route: %m"); + return (0); + } + return 1; + } + +/* + * cifaddr - Clear the interface IP addresses, and delete routes + * through the interface if possible. + */ + +int cifaddr (int unit, int our_adr, int his_adr) + { + struct rtentry rt; +/* + * Delete the route through the device + */ + memset (&rt, '\0', sizeof (rt)); + + SET_SA_FAMILY (rt.rt_dst, AF_INET); + SET_SA_FAMILY (rt.rt_gateway, AF_INET); + rt.rt_dev = ifname; /* MJC */ + + ((struct sockaddr_in *) &rt.rt_gateway)->sin_addr.s_addr = 0; + ((struct sockaddr_in *) &rt.rt_dst)->sin_addr.s_addr = his_adr; + rt.rt_flags = RTF_UP | RTF_HOST; + + if (ioctl(sockfd, SIOCDELRT, &rt) < 0 && errno != ESRCH) + { + if (still_ppp()) + { + syslog (LOG_ERR, "ioctl(SIOCDELRT) device route: %m"); + return (0); + } + } + return 1; + } + +/* + * path_to_proc - determine the path to the proc file system data + */ + +FILE *route_fd = (FILE *) 0; +static char route_buffer [512]; + +static char *path_to_proc (void); +static int open_route_table (void); +static void close_route_table (void); +static int read_route_table (struct rtentry *rt); +static int defaultroute_exists (void); + +/* + * path_to_proc - find the path to the route tables in the proc file system + */ + +static char *path_to_proc (void) + { + struct mntent *mntent; + FILE *fp; + + fp = fopen (MOUNTED, "r"); + if (fp != 0) + { + mntent = getmntent (fp); + while (mntent != (struct mntent *) 0) + { + if (strcmp (mntent->mnt_type, MNTTYPE_IGNORE) != 0) + { + if (strcmp (mntent->mnt_type, "proc") == 0) + { + strncpy (route_buffer, mntent->mnt_dir, + sizeof (route_buffer)-10); + route_buffer [sizeof (route_buffer)-10] = '\0'; + fclose (fp); + return (route_buffer); + } + } + mntent = getmntent (fp); + } + fclose (fp); + } + + syslog (LOG_ERR, "proc file system not mounted"); + return 0; + } + +/* + * close_route_table - close the interface to the route table + */ + +static void close_route_table (void) + { + if (route_fd != (FILE *) 0) + { + fclose (route_fd); + route_fd = (FILE *) 0; + } + } + +/* + * open_route_table - open the interface to the route table + */ + +static int open_route_table (void) + { + char *path; + + close_route_table(); + + path = path_to_proc(); + if (path == NULL) + { + return 0; + } + + strcat (path, "/net/route"); + route_fd = fopen (path, "r"); + if (route_fd == (FILE *) 0) + { + syslog (LOG_ERR, "can not open %s: %m", path); + return 0; + } + return 1; + } + +/* + * read_route_table - read the next entry from the route table + */ + +static int read_route_table (struct rtentry *rt) + { + static char delims[] = " \t\n"; + char *dev_ptr, *ptr, *dst_ptr, *gw_ptr, *flag_ptr; + + memset (rt, '\0', sizeof (struct rtentry)); + + for (;;) + { + if (fgets (route_buffer, sizeof (route_buffer), route_fd) == + (char *) 0) + { + return 0; + } + + dev_ptr = strtok (route_buffer, delims); /* interface name */ + dst_ptr = strtok (NULL, delims); /* destination address */ + gw_ptr = strtok (NULL, delims); /* gateway */ + flag_ptr = strtok (NULL, delims); /* flags */ + + if (flag_ptr == (char *) 0) /* assume that we failed, somewhere. */ + { + return 0; + } + + /* Discard that stupid header line which should never + * have been there in the first place !! */ + if (isxdigit (*dst_ptr) && isxdigit (*gw_ptr) && isxdigit (*flag_ptr)) + { + break; + } + } + + ((struct sockaddr_in *) &rt->rt_dst)->sin_addr.s_addr = + strtoul (dst_ptr, NULL, 16); + + ((struct sockaddr_in *) &rt->rt_gateway)->sin_addr.s_addr = + strtoul (gw_ptr, NULL, 16); + + rt->rt_flags = (short) strtoul (flag_ptr, NULL, 16); + rt->rt_dev = dev_ptr; + + return 1; + } + +/* + * defaultroute_exists - determine if there is a default route + */ + +static int defaultroute_exists (void) + { + struct rtentry rt; + int result = 0; + + if (!open_route_table()) + { + return 0; + } + + while (read_route_table(&rt) != 0) + { + if ((rt.rt_flags & RTF_UP) == 0) + { + continue; + } + + if (((struct sockaddr_in *) &rt.rt_dst)->sin_addr.s_addr == 0L) + { + syslog (LOG_ERR, + "ppp not replacing existing default route to %s[%s]", + rt.rt_dev, + inet_ntoa (((struct sockaddr_in *) &rt.rt_gateway)-> + sin_addr.s_addr)); + result = 1; + break; + } + } + + close_route_table(); + return result; + } + +/* + * sifdefaultroute - assign a default route through the address given. + */ + +int sifdefaultroute (int unit, int gateway) + { + struct rtentry rt; + + if (has_default_route == 0) + { + if (defaultroute_exists()) + { + return 0; + } + + memset (&rt, '\0', sizeof (rt)); + SET_SA_FAMILY (rt.rt_dst, AF_INET); + SET_SA_FAMILY (rt.rt_gateway, AF_INET); + ((struct sockaddr_in *) &rt.rt_gateway)->sin_addr.s_addr = gateway; + + rt.rt_flags = RTF_UP | RTF_GATEWAY; + if (ioctl(sockfd, SIOCADDRT, &rt) < 0) + { + syslog (LOG_ERR, "default route ioctl(SIOCADDRT): %m"); + return 0; + } + } + has_default_route = 1; + return 1; + } + +/* + * cifdefaultroute - delete a default route through the address given. + */ + +int cifdefaultroute (int unit, int gateway) + { + struct rtentry rt; + + if (has_default_route) + { + memset (&rt, '\0', sizeof (rt)); + SET_SA_FAMILY (rt.rt_dst, AF_INET); + SET_SA_FAMILY (rt.rt_gateway, AF_INET); + ((struct sockaddr_in *) &rt.rt_gateway)->sin_addr.s_addr = gateway; + + rt.rt_flags = RTF_UP | RTF_GATEWAY; + if (ioctl(sockfd, SIOCDELRT, &rt) < 0 && errno != ESRCH) + { + if (still_ppp()) + { + syslog (LOG_ERR, "default route ioctl(SIOCDELRT): %m"); + return 0; + } + } + } + has_default_route = 0; + return 1; + } + +/* + * sifproxyarp - Make a proxy ARP entry for the peer. + */ + +int sifproxyarp (int unit, u_int32_t his_adr) + { + struct arpreq arpreq; +/* + * Sometime in the 1.3 series kernels, the arp request added a device name. + */ +#include +#if LINUX_VERSION_CODE < 66381 + char arpreq_arp_dev[32]; +#else +#define arpreq_arp_dev arpreq.arp_dev +#endif + + if (has_proxy_arp == 0) + { + memset (&arpreq, '\0', sizeof(arpreq)); +/* + * Get the hardware address of an interface on the same subnet + * as our local address. + */ + if (!get_ether_addr(his_adr, &arpreq.arp_ha, arpreq_arp_dev)) + { + syslog(LOG_ERR, "Cannot determine ethernet address for proxy ARP"); + return 0; + } + + SET_SA_FAMILY(arpreq.arp_pa, AF_INET); + ((struct sockaddr_in *) &arpreq.arp_pa)->sin_addr.s_addr = his_adr; + arpreq.arp_flags = ATF_PERM | ATF_PUBL; + + if (ioctl(sockfd, SIOCSARP, (caddr_t)&arpreq) < 0) + { + syslog(LOG_ERR, "ioctl(SIOCSARP): %m"); + return 0; + } + } + + has_proxy_arp = 1; + return 1; + } + +/* + * cifproxyarp - Delete the proxy ARP entry for the peer. + */ + +int cifproxyarp (int unit, u_int32_t his_adr) + { + struct arpreq arpreq; + + if (has_proxy_arp == 1) + { + memset (&arpreq, '\0', sizeof(arpreq)); + SET_SA_FAMILY(arpreq.arp_pa, AF_INET); + arpreq.arp_flags = ATF_PERM | ATF_PUBL; + + ((struct sockaddr_in *) &arpreq.arp_pa)->sin_addr.s_addr = his_adr; + if (ioctl(sockfd, SIOCDARP, (caddr_t)&arpreq) < 0) + { + syslog(LOG_WARNING, "ioctl(SIOCDARP): %m"); + return 0; + } + } + has_proxy_arp = 0; + return 1; + } + +/* + * get_ether_addr - get the hardware address of an interface on the + * the same subnet as ipaddr. + */ + +static int local_get_ether_addr (u_int32_t ipaddr, struct sockaddr *hwaddr, + char *name, struct ifreq *ifs, int ifs_len) + { + struct ifreq *ifr, *ifend, *ifp; + int i; + u_int32_t ina, mask; + struct sockaddr_dl *dla; + struct ifreq ifreq; + struct ifconf ifc; +/* + * Request the total list of all devices configured on your system. + */ + ifc.ifc_len = ifs_len; + ifc.ifc_req = ifs; + if (ioctl(sockfd, SIOCGIFCONF, &ifc) < 0) + { + syslog(LOG_ERR, "ioctl(SIOCGIFCONF): %m"); + return 0; + } + + MAINDEBUG ((LOG_DEBUG, "proxy arp: scanning %d interfaces for IP %s", + ifc.ifc_len / sizeof(struct ifreq), ip_ntoa(ipaddr))); +/* + * Scan through looking for an interface with an Internet + * address on the same subnet as `ipaddr'. + */ + ifend = ifs + (ifc.ifc_len / sizeof(struct ifreq)); + for (ifr = ifc.ifc_req; ifr < ifend; ifr++) + { + if (ifr->ifr_addr.sa_family == AF_INET) + { + ina = ((struct sockaddr_in *) &ifr->ifr_addr)->sin_addr.s_addr; + strncpy(ifreq.ifr_name, ifr->ifr_name, sizeof(ifreq.ifr_name)); + MAINDEBUG ((LOG_DEBUG, "proxy arp: examining interface %s", + ifreq.ifr_name)); +/* + * Check that the interface is up, and not point-to-point + * nor loopback. + */ + if (ioctl(sockfd, SIOCGIFFLAGS, &ifreq) < 0) + { + continue; + } + + if (((ifreq.ifr_flags ^ FLAGS_GOOD) & FLAGS_MASK) != 0) + { + continue; + } +/* + * Get its netmask and check that it's on the right subnet. + */ + if (ioctl(sockfd, SIOCGIFNETMASK, &ifreq) < 0) + { + continue; + } + + mask = ((struct sockaddr_in *) &ifreq.ifr_addr)->sin_addr.s_addr; + MAINDEBUG ((LOG_DEBUG, "proxy arp: interface addr %s mask %lx", + ip_ntoa(ina), ntohl(mask))); + + if (((ipaddr ^ ina) & mask) != 0) + { + continue; + } + break; + } + } + + if (ifr >= ifend) + { + return 0; + } + + memcpy (name, ifreq.ifr_name, sizeof(ifreq.ifr_name)); + syslog(LOG_INFO, "found interface %s for proxy arp", name); +/* + * Now get the hardware address. + */ + memset (&ifreq.ifr_hwaddr, 0, sizeof (struct sockaddr)); + if (ioctl (sockfd, SIOCGIFHWADDR, &ifreq) < 0) + { + syslog(LOG_ERR, "SIOCGIFHWADDR(%s): %m", ifreq.ifr_name); + return 0; + } + + memcpy (hwaddr, + &ifreq.ifr_hwaddr, + sizeof (struct sockaddr)); + + MAINDEBUG ((LOG_DEBUG, + "proxy arp: found hwaddr %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", + (int) ((unsigned char *) &hwaddr->sa_data)[0], + (int) ((unsigned char *) &hwaddr->sa_data)[1], + (int) ((unsigned char *) &hwaddr->sa_data)[2], + (int) ((unsigned char *) &hwaddr->sa_data)[3], + (int) ((unsigned char *) &hwaddr->sa_data)[4], + (int) ((unsigned char *) &hwaddr->sa_data)[5], + (int) ((unsigned char *) &hwaddr->sa_data)[6], + (int) ((unsigned char *) &hwaddr->sa_data)[7])); + return 1; + } + +int get_ether_addr (u_int32_t ipaddr, struct sockaddr *hwaddr, char *name) + { + int ifs_len; + int answer; + void *base_addr; +/* + * Allocate memory to hold the request. + */ + ifs_len = MAX_IFS * sizeof (struct ifreq); + base_addr = (void *) malloc (ifs_len); + if (base_addr == (void *) 0) + { + syslog(LOG_ERR, "malloc(%d) failed to return memory", ifs_len); + return 0; + } +/* + * Find the hardware address associated with the controller + */ + answer = local_get_ether_addr (ipaddr, hwaddr, name, + (struct ifreq *) base_addr, ifs_len); + + free (base_addr); + return answer; + } + +/* + * Return user specified netmask, modified by any mask we might determine + * for address `addr' (in network byte order). + * Here we scan through the system's list of interfaces, looking for + * any non-point-to-point interfaces which might appear to be on the same + * network as `addr'. If we find any, we OR in their netmask to the + * user-specified netmask. + */ + +static u_int32_t local_GetMask (u_int32_t addr, struct ifreq *ifs, int ifs_len) + { + u_int32_t mask, nmask, ina; + struct ifreq *ifr, *ifend, ifreq; + struct ifconf ifc; + + addr = ntohl(addr); + + if (IN_CLASSA(addr)) /* determine network mask for address class */ + { + nmask = IN_CLASSA_NET; + } + else + { + if (IN_CLASSB(addr)) + { + nmask = IN_CLASSB_NET; + } + else + { + nmask = IN_CLASSC_NET; + } + } + + /* class D nets are disallowed by bad_ip_adrs */ + mask = netmask | htonl(nmask); + + if (ifs == (void *) 0) + { + return mask; + } +/* + * Scan through the system's network interfaces. + */ + ifc.ifc_len = ifs_len; + ifc.ifc_req = ifs; + if (ioctl(sockfd, SIOCGIFCONF, &ifc) < 0) + { + syslog(LOG_WARNING, "ioctl(SIOCGIFCONF): %m"); + return mask; + } + + ifend = (struct ifreq *) (ifc.ifc_buf + ifc.ifc_len); + for (ifr = ifc.ifc_req; ifr < ifend; ifr++) + { +/* + * Check the interface's internet address. + */ + if (ifr->ifr_addr.sa_family != AF_INET) + { + continue; + } + ina = ((struct sockaddr_in *) &ifr->ifr_addr)->sin_addr.s_addr; + if (((ntohl(ina) ^ addr) & nmask) != 0) + { + continue; + } +/* + * Check that the interface is up, and not point-to-point nor loopback. + */ + strncpy(ifreq.ifr_name, ifr->ifr_name, sizeof(ifreq.ifr_name)); + if (ioctl(sockfd, SIOCGIFFLAGS, &ifreq) < 0) + { + continue; + } + + if (((ifreq.ifr_flags ^ FLAGS_GOOD) & FLAGS_MASK) != 0) + { + continue; + } +/* + * Get its netmask and OR it into our mask. + */ + if (ioctl(sockfd, SIOCGIFNETMASK, &ifreq) < 0) + { + continue; + } + mask |= ((struct sockaddr_in *)&ifreq.ifr_addr)->sin_addr.s_addr; + break; + } + return mask; + } + +u_int32_t GetMask (u_int32_t addr) + { + int ifs_len; + u_int32_t answer; + void *base_addr; +/* + * Allocate memory to hold the request. + */ + ifs_len = MAX_IFS * sizeof (struct ifreq); + base_addr = (void *) malloc (ifs_len); + if (base_addr == (void *) 0) + { + syslog(LOG_ERR, "malloc(%d) failed to return memory", ifs_len); + } +/* + * Find the netmask used on the same network. + */ + answer = local_GetMask (addr, (struct ifreq *) base_addr, ifs_len); + if (base_addr != (void *) 0) + { + free (base_addr); + } + return answer; + } + +/* + * Internal routine to decode the version.modification.patch level + */ + +static void decode_version (char *buf, int *version, + int *modification, int *patch) + { + *version = (int) strtoul (buf, &buf, 10); + *modification = 0; + *patch = 0; + + if (*buf == '.') + { + ++buf; + *modification = (int) strtoul (buf, &buf, 10); + if (*buf == '.') + { + ++buf; + *patch = (int) strtoul (buf, &buf, 10); + } + } + + if (*buf != '\0') + { + *version = + *modification = + *patch = 0; + } + } + +/* + * Procedure to determine if the PPP line dicipline is registered. + */ + +int +ppp_registered(void) + { + int local_fd; + int ppp_disc = N_PPP; + int init_disc = -1; + int initfdflags; + + local_fd = open(devnam, O_NONBLOCK | O_RDWR, 0); + if (local_fd < 0) + { + syslog(LOG_ERR, "Failed to open %s: %m", devnam); + return 0; + } + + initfdflags = fcntl(local_fd, F_GETFL); + if (initfdflags == -1) + { + syslog(LOG_ERR, "Couldn't get device fd flags: %m"); + close (local_fd); + return 0; + } + + initfdflags &= ~O_NONBLOCK; + fcntl(local_fd, F_SETFL, initfdflags); +/* + * Read the initial line dicipline and try to put the device into the + * PPP dicipline. + */ + if (ioctl(local_fd, TIOCGETD, &init_disc) < 0) + { + syslog(LOG_ERR, "ioctl(TIOCGETD): %m"); + close (local_fd); + return 0; + } + + if (ioctl(local_fd, TIOCSETD, &ppp_disc) < 0) + { + syslog(LOG_ERR, "ioctl(TIOCSETD): %m"); + close (local_fd); + return 0; + } + + if (ioctl(local_fd, TIOCSETD, &init_disc) < 0) + { + syslog(LOG_ERR, "ioctl(TIOCSETD): %m"); + close (local_fd); + return 0; + } + + close (local_fd); + return 1; + } + +/* + * ppp_available - check whether the system has any ppp interfaces + * (in fact we check whether we can do an ioctl on ppp0). + */ + +int ppp_available(void) + { + int s, ok; + struct ifreq ifr; + char abBuffer [1024]; + int size; + int my_version, my_modification, my_patch; +/* + * Open a socket for doing the ioctl operations. + */ + s = socket(AF_INET, SOCK_DGRAM, 0); + if (s < 0) + { + return 0; + } + + strncpy (ifr.ifr_name, "ppp0", sizeof (ifr.ifr_name)); + ok = ioctl(s, SIOCGIFFLAGS, (caddr_t) &ifr) >= 0; +/* + * If the device did not exist then attempt to create one by putting the + * current tty into the PPP discipline. If this works then obtain the + * flags for the device again. + */ + if (!ok) + { + if (ppp_registered()) + { + strncpy (ifr.ifr_name, "ppp0", sizeof (ifr.ifr_name)); + ok = ioctl(s, SIOCGIFFLAGS, (caddr_t) &ifr) >= 0; + } + } +/* + * Ensure that the hardware address is for PPP and not something else + */ + if (ok) + { + ok = ioctl (s, SIOCGIFHWADDR, (caddr_t) &ifr) >= 0; + } + + if (ok && ((ifr.ifr_hwaddr.sa_family & ~0xFF) != ARPHRD_PPP)) + { + ok = 0; + } + + if (!ok) + { + return 0; + } +/* + * This is the PPP device. Validate the version of the driver at this + * point to ensure that this program will work with the driver. + */ + ifr.ifr_data = abBuffer; + size = ioctl (s, SIOCGPPPVER, (caddr_t) &ifr); + ok = size >= 0; + + if (ok) + { + decode_version (abBuffer, + &driver_version, + &driver_modification, + &driver_patch); + } + + if (!ok) + { + driver_version = + driver_modification = + driver_patch = 0; + } +/* + * Validate the version of the driver against the version that we used. + */ + decode_version (PPP_VERSION, + &my_version, + &my_modification, + &my_patch); + + /* The version numbers must match */ + if (driver_version != my_version) + { + ok = 0; + } + + /* The modification levels must be legal */ + if (driver_modification < my_modification) + { + ok = 0; + } + + if (!ok) + { + extern char *no_ppp_msg; + + no_ppp_msg = route_buffer; + + sprintf(no_ppp_msg, + "Sorry - PPP driver version %d.%d.%d is out of date\n", + driver_version, driver_modification, driver_patch); + ok = 0; + } + + close(s); + return ok; + } + +/* + * Update the wtmp file with the appropriate user name and tty device. + */ + +int logwtmp (char *line, char *name, char *host) + { + int mode; + int wtmp; + struct utmp ut, *utp; + pid_t mypid = getpid(); +/* + * Control the 'mesg' function based upon the state of the logon + * operation. If the user is being 'logged on' then disable the + * mesg function. When the user 'logs off' then re-enable it. + */ + mode = (*name != '\0') ? 0600 : 0622; + if (chmod (devnam, mode) < 0) + { + syslog (LOG_ERR, "chmod(\"%s\", 0%o): %m", devnam, mode); + } +/* + * Update the signon database for users. + * Christoph Lameter: Copied from poeigl-1.36 Jan 3, 1996 + */ + utmpname(_PATH_UTMP); + setutent(); + while ((utp = getutent()) && (utp->ut_pid != mypid)) + /* nothing */; + + /* Is this call really necessary? There is another one after the 'put' */ + endutent(); + + if (utp) + { + memcpy(&ut, utp, sizeof(ut)); + } + else + { + /* some gettys/telnetds don't initialize utmp... */ + memset(&ut, 0, sizeof(ut)); + } + + if (ut.ut_id[0] == 0) + { + strncpy(ut.ut_id, line + 3, sizeof(ut.ut_id)); + } + + strncpy(ut.ut_user, name, sizeof(ut.ut_user)); + strncpy(ut.ut_line, line, sizeof(ut.ut_line)); + + time(&ut.ut_time); + + ut.ut_type = USER_PROCESS; + ut.ut_pid = mypid; + + /* Insert the host name if one is supplied */ + if (*host) + { + strncpy (ut.ut_host, host, sizeof(ut.ut_host)); + } + + /* Insert the IP address of the remote system if IP is enabled */ + if (ipcp_hisoptions[0].neg_addr) + { + memcpy (&ut.ut_addr, (char *) &ipcp_hisoptions[0].hisaddr, + sizeof(ut.ut_addr)); + } + + /* CL: Makes sure that the logout works */ + if (*host == 0 && *name==0) + { + ut.ut_host[0]=0; + } + + pututline(&ut); + endutent(); +/* + * Update the wtmp file. + */ + wtmp = open(_PATH_WTMP, O_APPEND|O_WRONLY); + if (wtmp >= 0) + { + flock(wtmp, LOCK_EX); + + /* we really should check for error on the write for a full disk! */ + write (wtmp, (char *)&ut, sizeof(ut)); + close (wtmp); + + flock(wtmp, LOCK_UN); + } + } + + +/* + * Code for locking/unlocking the serial device. + * This code is derived from chat.c. + */ + +#ifndef LOCK_PREFIX +#define LOCK_PREFIX "/var/lock/LCK.." +#endif + +/* + * lock - create a lock file for the named device + */ + +int lock (char *dev) + { + char hdb_lock_buffer[12]; + int fd, n; + int pid; + char *p; + + p = strrchr(dev, '/'); + if (p != NULL) + { + dev = ++p; + } + + lock_file = malloc(strlen(LOCK_PREFIX) + strlen(dev) + 1); + if (lock_file == NULL) + { + novm("lock file name"); + } + + strcpy (lock_file, LOCK_PREFIX); + strcat (lock_file, dev); +/* + * Attempt to create the lock file at this point. + */ + while (1) + { + fd = open(lock_file, O_EXCL | O_CREAT | O_RDWR, 0644); + if (fd >= 0) + { + pid = getpid(); +#ifndef PID_BINARY + sprintf (hdb_lock_buffer, "%010d\n", pid); + write (fd, hdb_lock_buffer, 11); +#else + write(fd, &pid, sizeof (pid)); +#endif + close(fd); + return 0; + } +/* + * If the file exists then check to see if the pid is stale + */ + if (errno == EEXIST) + { + fd = open(lock_file, O_RDONLY, 0); + if (fd < 0) + { + if (errno == ENOENT) /* This is just a timing problem. */ + { + continue; + } + break; + } + + /* Read the lock file to find out who has the device locked */ + n = read (fd, hdb_lock_buffer, 11); + close (fd); + if (n < 0) + { + syslog(LOG_ERR, "Can't read pid from lock file %s", lock_file); + break; + } + + /* See the process still exists. */ + if (n > 0) + { +#ifndef PID_BINARY + hdb_lock_buffer[n] = '\0'; + sscanf (hdb_lock_buffer, " %d", &pid); +#else + pid = ((int *) hdb_lock_buffer)[0]; +#endif + if (pid == 0 || (kill(pid, 0) == -1 && errno == ESRCH)) + { + n = 0; + } + } + + /* If the process does not exist then try to remove the lock */ + if (n == 0 && unlink (lock_file) == 0) + { + syslog (LOG_NOTICE, "Removed stale lock on %s (pid %d)", + dev, pid); + continue; + } + + syslog (LOG_NOTICE, "Device %s is locked by pid %d", dev, pid); + break; + } + + syslog(LOG_ERR, "Can't create lock file %s: %m", lock_file); + break; + } + + free(lock_file); + lock_file = NULL; + return -1; +} + +/* + * unlock - remove our lockfile + */ + +void unlock(void) + { + if (lock_file) + { + unlink(lock_file); + free(lock_file); + lock_file = NULL; + } + } + + +/************************ IPX SUPPORT *********************************/ +#include + +/* + * sipxfaddr - Config the interface IPX networknumber + */ + +int sipxfaddr (int unit, u_int32_t network, unsigned char * node ) + { + int skfd; + int result = 1; + struct sockaddr_ipx ipx_addr; + struct ifreq ifr; + struct sockaddr_ipx *sipx = (struct sockaddr_ipx *) &ifr.ifr_addr; + + skfd = socket (AF_IPX, SOCK_DGRAM, 0); + if (skfd < 0) + { + syslog (LOG_DEBUG, "socket(AF_IPX): %m"); + result = 0; + } + else + { + memset (&ifr, '\0', sizeof (ifr)); + strcpy (ifr.ifr_name, ifname); + + memcpy (sipx->sipx_node, node, IPX_NODE_LEN); + sipx->sipx_family = AF_IPX; + sipx->sipx_port = 0; + sipx->sipx_network = htonl (network); + sipx->sipx_type = IPX_FRAME_ETHERII; + sipx->sipx_action = IPX_CRTITF; +/* + * Set the IPX device + */ + if (ioctl(skfd, SIOCSIFADDR, (caddr_t) &ifr) < 0) + { + result = 0; + if (errno != EEXIST) + { + syslog (LOG_DEBUG, "ioctl(SIOCAIFADDR, CRTITF): %m"); + } + else + { + syslog (LOG_WARNING, + "ioctl(SIOCAIFADDR, CRTITF): Address already exists"); + } + } + close (skfd); + } + return result; + } + +/* + * cipxfaddr - Clear the information for the IPX network. The IPX routes + * are removed and the device is no longer able to pass IPX + * frames. + */ + +int cipxfaddr (int unit) + { + int skfd; + int result = 1; + struct sockaddr_ipx ipx_addr; + struct ifreq ifr; + struct sockaddr_ipx *sipx = (struct sockaddr_ipx *) &ifr.ifr_addr; + + skfd = socket (AF_IPX, SOCK_DGRAM, 0); + if (skfd < 0) + { + syslog (LOG_DEBUG, "socket(AF_IPX): %m"); + result = 0; + } + else + { + memset (&ifr, '\0', sizeof (ifr)); + strcpy (ifr.ifr_name, ifname); + + sipx->sipx_type = IPX_FRAME_ETHERII; + sipx->sipx_action = IPX_DLTITF; + sipx->sipx_family = AF_IPX; +/* + * Set the IPX device + */ + if (ioctl(skfd, SIOCSIFADDR, (caddr_t) &ifr) < 0) + { + syslog (LOG_INFO, "ioctl(SIOCAIFADDR, IPX_DLTITF) %d: %m", errno); + result = 0; + } + close (skfd); + } + return result; + } + +/* + * Turn off any option which is not supported by this implementation. + * + * This procedure is called after all of the options have been processed. + * It gives the implementation a chance to alter the configurtion options + * based upon the current support by the operating system. + */ + +void remove_sys_options() +{ +#ifdef IPX_CHANGE + extern int ipx_enabled, ip_enabled; + struct stat stat_buf; +/* + * Disable the IPX protocol if the support is not present in the kernel. + * If we disable it then ensure that IP support is enabled. + */ + while (ipx_enabled) { + char *path = path_to_proc(); + if (path != NULL) { + strcat (path, "/net/ipx_interface"); + if (lstat (path, &stat_buf) >= 0) + break; + } + syslog (LOG_ERR, "IPX support is not present in the kernel\n"); + ipx_enabled = 0; + ip_enabled = 1; + break; + } +#endif +} --- ppp-2.2.0f.orig/pppstats/Makefile.linux +++ ppp-2.2.0f/pppstats/Makefile.linux @@ -11,7 +11,7 @@ COMPILE_FLAGS = -D_linux_ LIBS = -INSTALL= install -o root -g daemon +INSTALL= install -s -o root -g daemon CFLAGS = $(COPTS) $(COMPILE_FLAGS) --- ppp-2.2.0f.orig/pppstats/pppstats.c +++ ppp-2.2.0f/pppstats/pppstats.c @@ -42,7 +42,6 @@ #include #include -#include #include #include #include --- ppp-2.2.0f.orig/usr.include.net/if_ppp.h +++ ppp-2.2.0f/usr.include.net/if_ppp.h @@ -0,0 +1 @@ +#include --- ppp-2.2.0f.orig/usr.include.net/if_pppvar.h +++ ppp-2.2.0f/usr.include.net/if_pppvar.h @@ -0,0 +1 @@ +#include --- ppp-2.2.0f.orig/usr.include.net/ppp-comp.h +++ ppp-2.2.0f/usr.include.net/ppp-comp.h @@ -0,0 +1 @@ +#include --- ppp-2.2.0f.orig/usr.include.net/ppp_defs.h +++ ppp-2.2.0f/usr.include.net/ppp_defs.h @@ -0,0 +1 @@ +#include --- ppp-2.2.0f.orig/usr.include.net/route.h +++ ppp-2.2.0f/usr.include.net/route.h @@ -0,0 +1 @@ +#include --- ppp-2.2.0f.orig/debian/control +++ ppp-2.2.0f/debian/control @@ -0,0 +1,31 @@ +Source: ppp +Section: net +Priority: standard +Maintainer: Christoph Lameter +Standards-Version: 2.1.0.0 + +Package: ppp +Architecture: any +Suggests: mgetty (>=0.99) +Depends: ${shlibs:Depends},netbase +Replaces: isp-ppp +Conflicts: isp-ppp +Description: Point-to-Point Protocol (PPP) daemon. + The Point-to-Point Protocol (PPP) provides a standard way to + transmit datagrams over a serial link, as well as a standard + way for the machines at either end of the link (the "peers") + to negotiate various optional characteristics of the link. Using + PPP, a serial link can be used to transmit Internet Protocol (IP) + datagrams, allowing TCP/IP connections between the peers. + . + This ppp implements the following special features (folded in from the + former isp-ppp package): + - Remote DNS Server Configuration for Microsoft Clients and compat. + - Remote WINS Server Configuration for Microsoft Clients amd compat. + - Bug Fix to accomodate incoming buggy Winsock PPPs (Trumpet Winsock) dialup + - Logs to LOG_LOCAL2 so that the ppp logs are completely separate. + . + Together with mgetty-0.99 this package will allow extremely easy dialup + configuration for Win95, NT or Win3.11 with IE 3.0. The user simply has + to type your phone number, username and password and the webbrowser will + work! No strange IP numbers to configure for the customer. --- ppp-2.2.0f.orig/debian/copyright +++ ppp-2.2.0f/debian/copyright @@ -0,0 +1,142 @@ +This is the Debian GNU/Linux prepackaged version of pppd. + +This package was constructed by Alvar Bray +from sources obtained from: + + sunsite.unc.edu:/pub/Linux/system/Network/serial/ppp-2.1.2e.tar.gz + +The options file was obtained from: + + sunsite.unc.edu:/pub/Linux/system/Network/serial/pppopt.tgz + +The ppp package was originally constructed by Ian Murdock + + +Then it was maintained by Alvar Bray + +Since the end of September it is maintained by +Christoph Lameter + + +The following files are covered by this copyright: + auth.c fsm.c fsm.h ipcp.c ipcp.h lcp.c lcp.h magic.c magic.h options.c + ppp.h pppd.h sys-bsd.c sys-linux.c sys-str.c sys-ultrix.c upap.c upap.h + +/* + * pppd.h - PPP daemon global declarations. + * + * Copyright (c) 1989 Carnegie Mellon University. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by Carnegie Mellon University. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED `AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * $Id: pppd.h,v 1.1.1.2 1996/01/28 22:11:37 alvar Exp $ + */ + +The file auth.c is covered by this copyright: + +/* + * Copyright (c) 1993 The Australian National University. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the Australian National University. The name of the University + * may not be used to endorse or promote products derived from this + * software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED `AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * Copyright (c) 1989 Carnegie Mellon University. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by Carnegie Mellon University. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED `AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +The files chap.c and chap.h are covered by this copyright: + +/* + * Copyright (c) 1991 Gregory M. Christy. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by Gregory M. Christy. The name of the author may not be used to + * endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED `AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ +The files md5.c and md5.h are covered by this copyright: + +/* + *********************************************************************** + ** Copyright (C) 1990, RSA Data Security, Inc. All rights reserved. ** + ** ** + ** License to copy and use this software is granted provided that ** + ** it is identified as the "RSA Data Security, Inc. MD5 Message- ** + ** Digest Algorithm" in all material mentioning or referencing this ** + ** software or this function. ** + ** ** + ** License is also granted to make and use derivative works ** + ** provided that such works are identified as "derived from the RSA ** + ** Data Security, Inc. MD5 Message-Digest Algorithm" in all ** + ** material mentioning or referencing the derived work. ** + ** ** + ** RSA Data Security, Inc. makes no representations concerning ** + ** either the merchantability of this software or the suitability ** + ** of this software for any particular purpose. It is provided "as ** + ** is" without express or implied warranty of any kind. ** + ** ** + ** These notices must be retained in any copies of any part of this ** + ** documentation and/or software. ** + *********************************************************************** + */ + +The logwtmp function is covered by this copyright: + +/* + * Copyright (c) 1988 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the University of California, Berkeley. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED `AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ --- ppp-2.2.0f.orig/debian/substvars +++ ppp-2.2.0f/debian/substvars @@ -0,0 +1 @@ +shlibs:Depends=libc5 (>= 5.4.0-0) --- ppp-2.2.0f.orig/debian/rules +++ ppp-2.2.0f/debian/rules @@ -0,0 +1,76 @@ +#!/usr/bin/make -f +# Sample debian.rules file - for GNU Hello (1.3). +# Copyright 1994,1995 by Ian Jackson. +# I hereby give you perpetual unlimited permission to copy, +# modify and relicense this file, provided that you do not remove +# my name from the file itself. (I assert my moral right of +# paternity under the Copyright, Designs and Patents Act 1988.) +# This file may have to be extensively modified + +package=ppp + +build: + $(checkdir) + ./configure +# make kernel + ( cd chat && make -f Makefile.linux ) + ( cd pppd && make -f Makefile.linux HAS_SHADOW=1 ) + ( cd pppstats && make -f Makefile.linux ) + touch build + +clean: + $(checkdir) + -rm -f build + ( cd chat && make -f Makefile.linux clean ) + ( cd pppd && make -f Makefile.linux clean ) + ( cd pppstats && make -f Makefile.linux clean ) + -make dist-clean + -rm `find . -name "*~"` + -rm -rf debian/tmp debian/files* + +binary-indep: checkroot build + $(checkdir) +# There are no architecture-independent files to be uploaded +# generated by this package. If there were any they would be +# made here. + +binary-arch: checkroot build + $(checkdir) + -rm -rf debian/tmp + install -d debian/tmp/etc/ppp \ + debian/tmp/usr/{sbin,bin} \ + debian/tmp/usr/man/man8 \ + debian/tmp/usr/include/net + +# pppd setups + cp debian/options.ttyXX debian/pap-secrets debian/options debian/ip-up debian/ip-down debian/tmp/etc/ppp + cp debian/ppp.chatscript debian/ppp.options_out debian/tmp/etc + install -s chat/chat pppd/pppd debian/tmp/usr/sbin + cp pppstats/pppstats debian/tmp/usr/sbin + cp debian/no_ppp_on_boot debian/tmp/etc/ppp + install debian/{poff,plog,pon} debian/tmp/usr/bin + chown -R root.root debian/tmp + chmod -R g-ws debian/tmp + chmod 600 debian/tmp/etc/ppp debian/tmp/etc/ppp.chatscript debian/tmp/etc/ppp/pap-secrets debian/tmp/etc/ppp.options_out + chgrp dip debian/tmp/usr/sbin/pppd + chmod 4754 debian/tmp/usr/sbin/pppd +# And continue with debian control files + debstd ppp debian/win95.ppp README.linux + dpkg-gencontrol + dpkg --build debian/tmp .. +define checkdir + test -f debian/rules +endef + +# Below here is fairly generic really + +binary: binary-indep binary-arch + +source diff: + @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false + +checkroot: + $(checkdir) + test root = "`whoami`" + +.PHONY: binary binary-arch binary-indep clean checkroot --- ppp-2.2.0f.orig/debian/changelog +++ ppp-2.2.0f/debian/changelog @@ -0,0 +1,233 @@ +ppp (2.2.0f-23) unstable; urgency=low + + * #6955 /etc/cron.daily/ppp made conffile + + -- Christoph Lameter Sat, 1 Mar 1997 18:20:16 -0800 + +ppp (2.2.0f-22) unstable; urgency=low + + * Remove /usr/include/net files + since they are provided by libc5-dev. #7601 + + -- Christoph Lameter Mon, 24 Feb 1997 12:10:31 -0800 + +ppp (2.2.0f-21) unstable; urgency=low + + * Support for 230kbps and 460kbps connections added thanks to + Paul Traina + * plog script changed according to suggestion by dave edmondson + + + -- Christoph Lameter Fri, 21 Feb 1997 07:29:11 -0800 + +ppp (2.2.0f-20) unstable; urgency=low + + * rebuild with newest debmake to fix some group ownerships Bug #6088 + * permissions on pppd did not follow policy (did not allow word read). + + -- Christoph Lameter Sun, 8 Dec 1996 07:02:35 -0800 + +ppp (2.2.0f-19) frozen unstable; urgency=low + + * optional suidmanager support through new debmake. + * last release had wrong permissions on pppd. + + -- Christoph Lameter Sat, 7 Dec 1996 17:07:19 -0800 + +ppp (2.2.0f-18) stable unstable; urgency=low + + * pppd made only executable for members of group dip. + + -- Christoph Lameter Wed, 13 Nov 1996 18:10:38 -0800 + +ppp (2.2.0f-17) unstable; urgency=low + + * pppd is not stopped and started on upgrade (only happened with ppp on bootup enabled) + + -- Christoph Lameter Tue, 5 Nov 1996 06:56:35 -0800 + +ppp (2.2.0f-16) unstable; urgency=low + + * chatscript aborts on no dialtone + * stripped pppstats + + -- Christoph Lameter Thu, 24 Oct 1996 10:11:07 -0700 + +ppp (2.2.0f-15) unstable; urgency=low + + * debmake 0.91 applied to ppp + * debmake takes over the /etc/init.d and the postrm stuff. + + -- Christoph Lameter Mon, 21 Oct 1996 18:58:19 -0800 + +ppp (2.2.0f-14) unstable; urgency=low + + * debmake problem with install scripts + + -- Christoph Lameter Thu, 17 Oct 1996 07:20:20 -0800 + +ppp (2.2.0f-13) unstable; urgency=low + + * Added \q after the password in ppp.chatscript + + -- Christoph Lameter Mon, 14 Oct 1996 17:59:45 -0800 + +ppp (2.2.0f-12) unstable; urgency=low + + * Added persist option to default configuration file ppp.options_out + to have pppd keep on dialing until connection is established. + * Added restarting of logging daemons to cron.daily script + + -- Christoph Lameter Sat, 12 Oct 1996 09:00:00 -0800 + +ppp (2.2.0f-11) unstable; urgency=medium + + * Postinst also customizes /etc/ppp/options.ttyXX + * Changed the bad example in /etc/ppp/options.ttyXX. + * Added log rotation + * Fixed persist option in pppd so that it waits 10 seconds before + reconnecting. Otherwise the reconnect attempt fails. + * Do not abort pppd on script failure with the persist option on. + * Added manpages for pon,poff,plog + + -- Christoph Lameter Mon, 7 Oct 1996 09:00:00 -0800 + +ppp (2.2.0f-10) unstable; urgency=medium + + * Tested the automatic-ppp-on-boot function + * Fixed bug in /etc/init.d/ppp (was not compatible with pon) + + -- Christoph Lameter Sun, 6 Oct 1996 09:00:00 -0800 + +ppp (2.2.0f-9) unstable; urgency=medium + + * Convenience scripts ( pon, poff, plog ) to control/monitor link + * Links were not activated in the last change + * Syslog output redirected to a separate file in /var/log/ppp.log + * Updated Documentation in README.debian + * Corrected changelog + * Finally got through to using ppp/mgetty on my home system and + found some inconveniences in the config files. + * moved /etc/ppp/chatscript to /etc/ppp.chatscript since /etc/ppp is not + to be accessed from userspace. + * New configuration file /etc/ppp.options_out for outbound options to + be able to handle mixed (inbound/outbound) usage. + I am not yet satisfied with the mixed setups such as I have at home. + + -- Christoph Lameter Sat, 5 Oct 1996 09:00:00 -0800 + +ppp (2.2.0f-8) unstable; urgency=low + + * links for /etc/init.d/ppp installed again + * pppd will come up on startup if /etc/ppp/ppp_on_boot exists + + -- Christoph Lameter Wed, 2 Oct 1996 09:00:00 -0800 + +ppp (2.2.0f-7) unstable; urgency=low + + * fixed a couple of bugs in postinst script. + * pppd now stripped + * etc/rc.d links for /etc/init.d/ppp not installed anymore + * /etc/init.d revised + + -- Christoph Lameter Wed, 2 Oct 1996 09:00:00 -0800 + +ppp (2.2.0f-6) unstable; urgency=low + + * pppstats program was not included + + -- Christoph Lameter Sun, 29 Sep 1996 09:00:00 -0800 + +ppp (2.2.0f-5) unstable; urgency=low + + * Updated standards + * Updated Documentation in /etc/ppp/options + + -- Christoph Lameter Fri, 27 Sep 1996 09:00:00 -0800 + +ppp (2.2.0f-4) unstable; urgency=low + + * Added example file for options.ttyXX + * Renamed to ppp to merge isp-ppp with ppp + * New maintainer for ppp package + * pppd runs setsuid + + -- Christoph Lameter Wed, 25 Sep 1996 09:00:00 -0800 + +isp-ppp (2.2.0f-2) unstable;urgency=low + + * Added "Conflicts: ppp" to control +isp-ppp (2.2.0f-1) unstable;urgency=low + + * Added pap-secrets file for mgetty integration + * Reworked control + + -- Christoph Lameter Fri, 6 Sep 1996 09:00:00 -0800 + +isp-ppp (2.2.0f-0) unstable;urgency=low + + * Added patch to fix trumpet winsock problems + * Update to standards 2.1.0.0 + * Named package isp-ppp to be able to release alternate pppd into debian + distribution + * pppd installed suid for regular dialup people who want to activate pppd + + -- Christoph Lameter Fri, 6 Sep 1996 09:00:00 -0800 + +Thu Jul 25 22:47:37 PDT 1996 Christoph Lameter + + * Added remote DNS and WINS configuration ability to pppd + ( See comments in /etc/ppp/options) + * Build on top of ppp of Alvar + +Sun Jul 7 17:01:22 BST 1996 Alvar Bray + * Setup to build/install pppstats utility. + * Modified to build on any archticture, Thanks due to + Yambo . + * Version 2.2.0f-3 released. + +Sun May 26 14:28:39 BST 1996 Alvar Bray + * Applied patches from Marek Michalkiewicz + to suport shadow + passwords. + * Added Architecture and priority fields to debian.control. + * Version 2.2.0f-2 released. + +Wed May 1 19:54:15 BST 1996 Alvar Bray + * Updated to upstream version 2.2.0f. + * Changed version to 2.2.0f-1. + +Sat Mar 23 09:39:49 GMT 1996 Alvar Bray + * Modified runlevel change start/kill links. + * Removed symlink /usr/include/net/route.h + * Revision 3 released. + +Tue Jan 30 23:14:51 GMT 1996 Alvar Bray + * used a documemented version of the options file from + source by Jim Knoble + * Removed /etc/ppp/ppp-connect script + * Added /etc/ppp/chatscript called by the options file + * Added empty ip-up and ip-down scripts. + +Sun Jan 28 22:34:09 GMT 1996 Alvar Bray + * Upgraded to version ppp-2.2.0e using CVS + * Renamed package ppp-2.2.0e + +Wed Nov 22 15:31:15 GMT 1995 Alvar Bray + * Rebuilt using elf format - added libc5 dependency. + * Made purge remove all ppp files (bug #1827) + * Added missing kernel header stubs to /usr/include/net + (bug #1795) + * Removed reference to /etc/init.d/functions in + /etc/init.d/ppp (bug #1725) + * Added dependency on netbase (bug #1443) + * New README (bug#1059) + * New source using ppp-2.2.0.c from + sunsite.unc.edu:/pub/Linux/system/Network/serial + +Ian Murdock + * added Debian GNU/Linux package maintenance system files + * changed Makefile variables in chat and pppd directories + + + --- ppp-2.2.0f.orig/debian/postinst +++ ppp-2.2.0f/debian/postinst @@ -0,0 +1,38 @@ +#!/bin/sh +set -e + +# fixup after ppp-connect removed +if [ -f /etc/ppp/ppp-connect ] ; then + echo + echo "The file /etc/ppp/ppp-connect is no longer part of the ppp" + echo -n "package, do you want to remove it [y/n]: " + read answer + if [ "$answer" = y ] ; then + rm /etc/ppp/ppp-connect + fi +fi + +# fixup after old update-rc.d +if [ -f /etc/rc2.d/K20ppp ] ; then + echo Fixing up start/stop scripts + rm -f /etc/rc2.d/K20ppp + rm -f /etc/rc3.d/K20ppp + rm -f /etc/rc4.d/K20ppp + rm -f /etc/rc5.d/K20ppp +fi + +# setup /etc/ppp/pap-secrets /etc/ppp/options.ttyXX if necessary +HOST="`hostname`" +for i in /etc/ppp/pap-secrets /etc/ppp/options.ttyXX; do + if grep -q hostname $i; then + cp $i /tmp/$$ + sed -e "s/hostname/$HOST/g" $i + rm /tmp/$$ + fi +done + +# add an entry to make syslogging of pppd distinct +if ! grep -q ^local2 /etc/syslog.conf; then + echo "local2.* -/var/log/ppp.log" >>/etc/syslog.conf + kill -HUP `cat /var/run/syslogd.pid` +fi --- ppp-2.2.0f.orig/debian/ip-down +++ ppp-2.2.0f/debian/ip-down @@ -0,0 +1,25 @@ +#!/bin/sh +# +# $Id: ip-down,v 1.1 1996/01/31 21:25:59 alvar Exp $ +# +# This script is run by the pppd _after_ the link is brought down. +# It should be used to delete routes, unset IP addresses etc. +# +# This script is called with the following arguments: +# Arg Name Example +# $1 Interface name ppp0 +# $2 The tty ttyS1 +# $3 The link speed 38400 +# $4 Local IP number 12.34.56.78 +# $5 Peer IP number 12.34.56.99 + +# +# The environment is cleared before executing this script +# so the path must be reset +# +PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin +export PATH + + + +# last line --- ppp-2.2.0f.orig/debian/conffiles +++ ppp-2.2.0f/debian/conffiles @@ -0,0 +1,8 @@ +/etc/init.d/ppp +/etc/ppp/options +/etc/ppp/ip-up +/etc/ppp/ip-down +/etc/ppp/pap-secrets +/etc/ppp.chatscript +/etc/ppp.options_out +/etc/cron.daily/ppp --- ppp-2.2.0f.orig/debian/ip-up +++ ppp-2.2.0f/debian/ip-up @@ -0,0 +1,26 @@ +#!/bin/sh +# +# $Id: ip-up,v 1.1 1996/01/31 21:25:59 alvar Exp $ +# +# This script is run by the pppd after the link is established. +# It should be used to add routes, set IP address, run the mailq +# etc. +# +# This script is called with the following arguments: +# Arg Name Example +# $1 Interface name ppp0 +# $2 The tty ttyS1 +# $3 The link speed 38400 +# $4 Local IP number 12.34.56.78 +# $5 Peer IP number 12.34.56.99 + +# +# The environment is cleared before executing this script +# so the path must be reset +# +PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin +export PATH + + + +# last line --- ppp-2.2.0f.orig/debian/options +++ ppp-2.2.0f/debian/options @@ -0,0 +1,269 @@ +# /etc/ppp/options +# +# $Id: options,v 1.4 1996/05/01 18:57:04 alvar Exp $ +# +# Originally created by Jim Knoble +# Modified for Debian by alvar Bray +# Modified for PPP Server setup by Christoph Lameter +# +# Use the command egrep -v '#|^ *$' /etc/ppp/options to quickly see what +# options are active in this file. + +# Specify which DNS Servers the incoming Win95 or WinNT Connection should use +# Two Servers can be remotely configured +# dns-addr 192.168.1.1 +# dns-addr 192.168.1.2 + +# Specify which WINS Servers the incoming connection Win95 or WinNT should use +# wins-addr 192.168.1.50 +# wins-addr 192.168.1.51 + +# Run the executable or shell command specified after pppd has +# terminated the link. This script could, for example, issue commands +# to the modem to cause it to hang up if hardware modem control signals +# were not available. +#disconnect "chat -- \d+++\d\c OK ath0 OK" + +# async character map -- 32-bit hex; each bit is a character +# that needs to be escaped for pppd to receive it. 0x00000001 +# represents '\x01', and 0x80000000 represents '\x1f'. +asyncmap 0 + +# Require the peer to authenticate itself before allowing network +# packets to be sent or received. +# For a PPP Server with script based logins not using PAP or CHAP +# you need to disable this setting. +# auth + +# Use hardware flow control (i.e. RTS/CTS) to control the flow of data +# on the serial port. +crtscts + +# Use software flow control (i.e. XON/XOFF) to control the flow of data +# on the serial port. +#xonxoff + +# Specifies that certain characters should be escaped on transmission +# (regardless of whether the peer requests them to be escaped with its +# async control character map). The characters to be escaped are +# specified as a list of hex numbers separated by commas. Note that +# almost any character can be specified for the escape option, unlike +# the asyncmap option which only allows control characters to be +# specified. The characters which may not be escaped are those with hex +# values 0x20 - 0x3f or 0x5e. +#escape 11,13,ff + +# Don't use the modem control lines. +#local + +# Specifies that pppd should use a UUCP-style lock on the serial device +# to ensure exclusive access to the device. +lock + +# Use the modem control lines. On Ultrix, this option implies hardware +# flow control, as for the crtscts option. (This option is not fully +# implemented.) +modem + +# Set the MRU [Maximum Receive Unit] value to for negotiation. pppd +# will ask the peer to send packets of no more than bytes. The +# minimum MRU value is 128. The default MRU value is 1500. A value of +# 296 is recommended for slow links (40 bytes for TCP/IP header + 256 +# bytes of data). +#mru 542 + +# Set the interface netmask to , a 32 bit netmask in "decimal dot" +# notation (e.g. 255.255.255.0). +#netmask 255.255.255.0 + +# Disables the default behaviour when no local IP address is specified, +# which is to determine (if possible) the local IP address from the +# hostname. With this option, the peer will have to supply the local IP +# address during IPCP negotiation (unless it specified explicitly on the +# command line or in an options file). +#noipdefault + +# Enables the "passive" option in the LCP. With this option, pppd will +# attempt to initiate a connection; if no reply is received from the +# peer, pppd will then just wait passively for a valid LCP packet from +# the peer (instead of exiting, as it does without this option). +#passive + +# With this option, pppd will not transmit LCP packets to initiate a +# connection until a valid LCP packet is received from the peer (as for +# the "passive" option with old versions of pppd). +#silent + +# Don't request or allow negotiation of any options for LCP and IPCP +# (use default values). +#-all + +# Disable Address/Control compression negotiation (use default, i.e. +# address/control field disabled). +#-ac + +# Disable asyncmap negotiation (use the default asyncmap, i.e. escape +# all control characters). +#-am + +# Don't fork to become a background process (otherwise pppd will do so +# if a serial device is specified). +#-detach + +# Disable IP address negotiation (with this option, the remote IP +# address must be specified with an option on the command line or in an +# options file). +#-ip + +# Disable magic number negotiation. With this option, pppd cannot +# detect a looped-back line. +#-mn + +# Disable MRU [Maximum Receive Unit] negotiation (use default, i.e. +# 1500). +#-mru + +# Disable protocol field compression negotiation (use default, i.e. +# protocol field compression disabled). +#-pc + +# Require the peer to authenticate itself using PAP. +#+pap + +# Don't agree to authenticate using PAP. +#-pap + +# Require the peer to authenticate itself using CHAP [Cryptographic +# Handshake Authentication Protocol] authentication. +#+chap + +# Don't agree to authenticate using CHAP. +#-chap + +# Disable negotiation of Van Jacobson style IP header compression (use +# default, i.e. no compression). +#-vj + +# Increase debugging level (same as -d). If this option is given, pppd +# will log the contents of all control packets sent or received in a +# readable form. The packets are logged through syslog with facility +# daemon and level debug. This information can be directed to a file by +# setting up /etc/syslog.conf appropriately (see syslog.conf(5)). (If +# pppd is compiled with extra debugging enabled, it will log messages +# using facility local2 instead of daemon). +#debug + +# Append the domain name to the local host name for authentication +# purposes. For example, if gethostname() returns the name porsche, +# but the fully qualified domain name is porsche.Quotron.COM, you would +# use the domain option to set the domain name to Quotron.COM. +#domain + +# Enable debugging code in the kernel-level PPP driver. The argument n +# is a number which is the sum of the following values: 1 to enable +# general debug messages, 2 to request that the contents of received +# packets be printed, and 4 to request that the contents of transmitted +# packets be printed. +#kdebug n + +# Set the MTU [Maximum Transmit Unit] value to . Unless the peer +# requests a smaller value via MRU negotiation, pppd will request that +# the kernel networking code send data packets of no more than n bytes +# through the PPP network interface. +#mtu + +# Enforce the use of the hostname as the name of the local system for +# authentication purposes (overrides the name option). +#usehostname + +# Set the assumed name of the remote system for authentication purposes +# to . +#remotename + +# Add an entry to this system's ARP [Address Resolution Protocol] +# table with the IP address of the peer and the Ethernet address of this +# system. +proxyarp + +# Use the system password database for authenticating the peer using +# PAP. Note: mgetty already provides this option. If this is specified +# then dialin from users using a script under Linux to fire up ppp wont work. +# login + +# If this option is given, pppd will send an LCP echo-request frame to +# the peer every n seconds. Under Linux, the echo-request is sent when +# no packets have been received from the peer for n seconds. Normally +# the peer should respond to the echo-request by sending an echo-reply. +# This option can be used with the lcp-echo-failure option to detect +# that the peer is no longer connected. +lcp-echo-interval 30 + +# If this option is given, pppd will presume the peer to be dead if n +# LCP echo-requests are sent without receiving a valid LCP echo-reply. +# If this happens, pppd will terminate the connection. Use of this +# option requires a non-zero value for the lcp-echo-interval parameter. +# This option can be used to enable pppd to terminate after the physical +# connection has been broken (e.g., the modem has hung up) in +# situations where no hardware modem control lines are available. +lcp-echo-failure 4 + +# Set the LCP restart interval (retransmission timeout) to seconds +# (default 3). +#lcp-restart + +# Set the maximum number of LCP terminate-request transmissions to +# (default 3). +#lcp-max-terminate + +# Set the maximum number of LCP configure-request transmissions to +# (default 10). +#lcp-max-configure + +# Set the maximum number of LCP configure-NAKs returned before starting +# to send configure-Rejects instead to (default 10). +#lcp-max-failure + +# Set the IPCP restart interval (retransmission timeout) to +# seconds (default 3). +#ipcp-restart + +# Set the maximum number of IPCP terminate-request transmissions to +# (default 3). +#ipcp-max-terminate + +# Set the maximum number of IPCP configure-request transmissions to +# (default 10). +#ipcp-max-configure + +# Set the maximum number of IPCP configure-NAKs returned before starting +# to send configure-Rejects instead to (default 10). +#ipcp-max-failure + +# Set the PAP restart interval (retransmission timeout) to seconds +# (default 3). +#pap-restart + +# Set the maximum number of PAP authenticate-request transmissions to +# (default 10). +#pap-max-authreq + +# Set the CHAP restart interval (retransmission timeout for +# challenges) to seconds (default 3). +#chap-restart + +# Set the maximum number of CHAP challenge transmissions to +# (default 10). +#chap-max-challenge + +# If this option is given, pppd will rechallenge the peer every +# seconds. +#chap-interval + +# With this option, pppd will accept the peer's idea of our local IP +# address, even if the local IP address was specified in an option. +#ipcp-accept-local + +# With this option, pppd will accept the peer's idea of its (remote) IP +# address, even if the remote IP address was specified in an option. +#ipcp-accept-remote + --- ppp-2.2.0f.orig/debian/pap-secrets +++ ppp-2.2.0f/debian/pap-secrets @@ -0,0 +1,37 @@ +# This is a pap-secrets file to be used with the AUTO_PPP function of mgetty +# mgetty-0.99 is preconfigured to startup pppd with the login option which +# will cause pppd to consult /etc/passwd after a user has passed this file +# Dont be disturbed therfore by the fact that this file defines logins with +# any password for users. /etc/passwd will catch passwd mismatches. +# +# This file should block ALL users that should not be able to do AUTO_PPP! +# AUTO_PPP bypasses the usual login program so its necessary to list all +# system userids with regular passwords here! +# +# ATTENTION: The definitions here can allow users to login without a +# password if you dont use the login option of pppd! +# The /etc/ppp/options file installed has the login option enabled + +# INBOUND connections + +# Every regular user can use PPP and has to use passwords from /etc/passwd +* hostname "" + +# UserIDs that cannot use PPP at all. Check your /etc/passwd and add any +# other accounts that should not be able to use pppd! +guest hostname "*" - +master hostname "*" - +root hostname "*" - +support hostname "*" - +stats hostname "*" - + +# OUTBOUND connections + +# Here you should add your userid password to connect to your providers via +# pap. The * means that the password is to be used for ANY host you connect +# to. Thus you do not have to worry about the foreign machine name. Just +# replace password with your password. +# If you have different providers with different passwords then you better +# remove the following line. + +hostname * password --- ppp-2.2.0f.orig/debian/options.ttyXX +++ ppp-2.2.0f/debian/options.ttyXX @@ -0,0 +1,19 @@ +# If you need to set up multiple serial lines then copy +# this file to +# options. for each tty with a modem on it. +# +# The options.tty file will assign an IP address to each PPP connection +# as it comes up. They must all be distinct! +# +# Example: +# options.ttyS1 for com2 under DOS. +# +# Edit the following line so that the first IP address +# mentioned is the ip address of the serial port while the second +# is the IP address of your host +# +# I usually use the convention hostname + dash + last 2 character of +# the ttyname to refer to serial ports. +# For example servername_s1 for ttyS1 on server "servername" + +hostname-s1:hostname --- ppp-2.2.0f.orig/debian/win95.ppp +++ ppp-2.2.0f/debian/win95.ppp @@ -0,0 +1,42 @@ +Short Guide on How to run a Win95 Connection with PPPD to Debian Linux +---------------------------------------------------------------------- + +1. Do not mess around with the Win95 configuration. + Do not manually configure DNS, Scripts etc. + Do not switch on the terminal windows. + Accept all defaults or better leave it as + it was at installation. + +2. You need to have a getty program that supports + automatic PPP protocol detection such as mgetty-0.99 + + You also need to have a pppd that supports remote DNS configuration. + The ppp usually coming with Debian has these options since ppp-2.2.0f-4 + + Without the extended ppp you still have to configure the DNS Server + on the Win95 wanting to connect to your Debian Linux Box. + +3. Configure PPP on Debian + A) Change the dns lines in /etc/ppp/options and review the + complete file for things you need to do. + + B) Make sure that your /etc/ppp/pap-secrets file is set + up correctly. It should allow your users in /etc/passwd + to establish ppp connections without a password. pppd will + check against /etc/passwd too! + The pap-secrets installed by this package is set up correctly + to handle user logins via pap. + If you are having trouble with authentication then remove + /etc/ppp/pap-secrets completely and it will usually work. + +4. Win95 PPP Dialup + Click on Dialup-Connection + A. Enter phone number of your linux server + B. Enter username when prompted + C. Enter password when prompted + +Win95 should connect to your Linux PPPD without problems and automatically +configure all IP-Addresses, Netmasks and DNS Servers. You can immediately +start Netscape, Internet Explorer or any other TCP/IP tools. + +Christoph Lameter, September 27, 1996 (clameter@debian.org) --- ppp-2.2.0f.orig/debian/pon +++ ppp-2.2.0f/debian/pon @@ -0,0 +1,6 @@ +#!/bin/sh +if [ -r /etc/ppp.options_out -a -r /etc/ppp.chatscript ]; then + /usr/sbin/pppd connect "/usr/sbin/chat -v -f /etc/ppp.chatscript" `cat /etc/ppp.options_out` +else + echo "You do not have permissions to access /etc/ppp.chatscript or /etc/ppp.options_out" +fi --- ppp-2.2.0f.orig/debian/no_ppp_on_boot +++ ppp-2.2.0f/debian/no_ppp_on_boot @@ -0,0 +1,2 @@ +Rename this file to ppp_on_boot and pppd will be fired up as +soon as linux comes up. --- ppp-2.2.0f.orig/debian/README.debian +++ ppp-2.2.0f/debian/README.debian @@ -0,0 +1,108 @@ +PPP for Debian +--------------- + +This release provides scripts to conveniently control ppp from user space. +Note that the scripts only work with the proper setup in /etc/ppp/options. Edit +the configuration files and test the operation of your link in superuser +mode first. + +Access to pppd is regulated through the group membership in group dip. +If you have permission problem then please first make sure that the user +is a member of group dip. + +Read the manpage for pon,poff,plog please. + + +Available scripts: +------------------ + +pon Bring link up. Executes pppd and will immediately + return the command prompt while still dialing. + use plog to figure out what pppd does. + +poff Bring link down. Kills pppd + +plog shows the last lines of the pppd log. + +Outbound and Inbound Dialing Setup +---------------------------------- +pppd attempts to handle both inbound and outbound through one set of +configuration files. The /etc/ppp/options file has been set up for the most +common setups. Please do not change it if at all possible. Specify +parameters on the commandline if necessary. If you find a change that will +be beneficial to all then please tell me about it. + +Outbound Setup (Simple one server setup!) +-------------- +Edit the file /etc/ppp.chatscript and make sure it contains what you +need to dialup into your server and eventually start up ppp. + +Edit the file /etc/ppp.options_out and put all options in it that you need +to connect to your server. The most common options are already provided for +you. If you need the common PAP-Password authentication then add +user to it. Otherwise you might also change the system name to be +like your username. The systemname is used for authentication if you do not +provide the "user" directive. See also pppd manpage. + +Please do not put comments in /etc/ppp.options_out!!!! + +Edit the file /etc/ppp/pap-secrets and put your password into the designated +location. + +You should then be able to start the ppp connection with pon. + +If you want to have ppp on bootup then rename the file +/etc/ppp/no_ppp_on_boot to /etc/ppp/ppp_on_boot. + +Inbound Setup (assuming mgetty 0.99 installed) +---------------------------------------------- +Edit the /etc/ppp/options file and uncomment the nameserver lines. Provide +the IP addresses that you want the users to use for their name services. + +Copy the file /etc/ppp/options.XX so that you have one options file +for each serial port you run mgetty on. Give each serial port an IP address +in those files. That way that port is locked into using that IP number. +Think what consequences that assignment might have for outbound use... + +That should be enough for dialup from a Win95 or NT Server. The +username/password on those system is used for a pap-authentication. +The /etc/ppp/pap-secrets is already set up for such a situation. Mgetty is +preconfigured to call pppd with parameters so that the pap-verification will +be done through the /etc/passwd file. + +All your users should now be able to establish ppp connections by just +specifying phone#, username,password from Win95 etc. + +Inbound dialup using dialup Scripts: +A ppp session can be established from the regular Linux prompt by executing +/usr/sbin/pppd. The user is limited to use the assigned IP adddress in +/etc/ppp/options.ttyname and will not be able to override it. + +Permissions: +------------ +You can control the pon,poff,plog access through the permissions on +/etc/ppp.chatscript and /etc/ppp.options_out. + +Permanent Links: +---------------- +Add the "persist" option to /etc/ppp.options_out to make the link +persistent. The pppd version for debian has been fixed so that the persist +option really works. + +Also if you want the pon command to keep trying until a connection is +established and also to reestablish the connection if the line drops then +you should also add the "persist" option in /etc/ppp.options_out + +Suidmanager support +------------------- +ppp can interact with the suidmanager. If you want to have other permissions +than the default on /usr/sbin/pppd then use suidmanager to keep those +settings across updates. + +Extensions to standard PPP functionality +---------------------------------------- +The pppd provided here has added functionality to allow remote DNS +configuration and remote WINS configuration for Win95 and WinNT clients. It +also has been extended to support high baudrates of 230kbps and 460kbps. + +Christoph Lameter, 10 Oct 1996 --- ppp-2.2.0f.orig/debian/poff +++ ppp-2.2.0f/debian/poff @@ -0,0 +1,18 @@ +#!/bin/sh + +# Lets see how many pppds are running.... +N=`ls /var/run/ppp* 2>/dev/null| wc -l` + +# If there no ppp running then poff does not make much sense +if [ $N = 0 ]; then + echo "No pppd is running" + exit 1 +fi +# If one is running then it cal be killed with killall +if [ $N = 1 ]; then + killall pppd + exit 0 +fi +# More than one! Aieehh.. Dont know which one to kill. +echo "More than one pppd running. None stopped" +exit 1 --- ppp-2.2.0f.orig/debian/plog +++ ppp-2.2.0f/debian/plog @@ -0,0 +1,2 @@ +#!/bin/sh +tail $* /var/log/ppp.log --- ppp-2.2.0f.orig/debian/purge +++ ppp-2.2.0f/debian/purge @@ -0,0 +1,5 @@ +/etc/ppp +/usr/include/net/if_ppp.h +/usr/include/net/if_pppvar.h +/usr/include/net/ppp-comp.h +/usr/include/net/ppp_defs.h --- ppp-2.2.0f.orig/debian/init.d +++ ppp-2.2.0f/debian/init.d @@ -0,0 +1,22 @@ +#! /bin/sh +# /etc/init.d/ppp: start or stop PPP. + +FLAGS="start 20 2 3 4 5 . stop 20 0 1 6 ." +# NO_RESTART_ON_UPGRADE + +test -x /usr/sbin/pppd -a -f /etc/ppp/ppp_on_boot || exit 0 + +case "$1" in + start) + start-stop-daemon --start --verbose --exec /usr/sbin/pppd -- \ + connect "/usr/sbin/chat -v -f /etc/ppp.chatscript" `cat /etc/ppp.options_out` + ;; + stop) + start-stop-daemon --stop --verbose --exec /usr/sbin/pppd + ;; + *) + echo "Usage: /etc/init.d/ppp {start|stop}" + exit 1 +esac + +exit 0 --- ppp-2.2.0f.orig/debian/ppp.options_out +++ ppp-2.2.0f/debian/ppp.options_out @@ -0,0 +1 @@ +defaultroute /dev/modem 38400 persist --- ppp-2.2.0f.orig/debian/ppp.chatscript +++ ppp-2.2.0f/debian/ppp.chatscript @@ -0,0 +1,7 @@ +ABORT BUSY +ABORT "NO CARRIER" +ABORT VOICE +ABORT "NO DIALTONE" +"" ATDT +ogin +word \q\q --- ppp-2.2.0f.orig/debian/cron.daily +++ ppp-2.2.0f/debian/cron.daily @@ -0,0 +1,6 @@ +#!/bin/sh + +if [ -f /var/log/ppp.log ]; then + savelog -g adm -m 644 -u root -c 4 /var/log/ppp.log >/dev/null + /etc/init.d/sysklogd reload +fi --- ppp-2.2.0f.orig/debian/plog.1 +++ ppp-2.2.0f/debian/plog.1 @@ -0,0 +1 @@ +.so man1/pon.1 --- ppp-2.2.0f.orig/debian/poff.1 +++ ppp-2.2.0f/debian/poff.1 @@ -0,0 +1 @@ +.so man1/pon.1 --- ppp-2.2.0f.orig/debian/pon.1 +++ ppp-2.2.0f/debian/pon.1 @@ -0,0 +1,50 @@ +.Id $Id: at.man,v 1.5 1995/10/30 20:35:01 ig25 Exp $ +.TH PLOG 1 "Oct 1996" local "Linux Programmer's Manual" +.SH NAME +pon, poff, plog \- startup, shutdown, or list the log of the PPP connection. +.SH SYNOPSIS +.B pon +.br +.B poff +.br +.B plog [tail-options] +.SH DESCRIPTION +.B pon +and +.B poff +switch the ppp connection on and off. Progress and logged events related to +the ppp connection can be viewed using +.B plog. +.B plog +can take all the arguments that +.B tail(1) +can take. For example +.B plog -f +will continously list ppp activity. +.SH REQUIREMENTS FOR the p-commands to work +.TP 8 +.B /etc/ppp.chatscript +must contain the correct chatscript to connect to your provider. All users +that are supposed to be able to use the p-commands should have read access +to this file. +.br +.TP 8 +.B /etc/ppp.options_out +contains the options for ppp to connect to your provider. This file also +must be readable by all users who should be able to use the p-commands. +.SH FILES +.I /etc/ppp.chatscript +.br +.I /etc/ppp.options_out +.br +.I /etc/ppp/options +.br +.I /var/log/ppp.log +.br +.I /etc/ppp/pap-secrets +.br +.I /etc/ppp/chap-secrets +.SH SEE ALSO +pppd(8), chat(8), and the documentation in /usr/doc/ppp +.SH AUTHOR +The p-commands were written by Christoph Lameter