Apply diffs from patchlevel 5.

This commit is contained in:
christos 1998-09-02 20:55:55 +00:00
parent 453b195c4d
commit 44d3b0974b
14 changed files with 133 additions and 149 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: chat.c,v 1.14 1998/07/26 15:48:43 mycroft Exp $ */ /* $NetBSD: chat.c,v 1.15 1998/09/02 20:55:55 christos Exp $ */
/* /*
* Chat -- a program for automatic session establishment (i.e. dial * Chat -- a program for automatic session establishment (i.e. dial
@ -84,7 +84,7 @@
#if 0 #if 0
static char rcsid[] = "Id: chat.c,v 1.19 1998/03/24 23:57:48 paulus Exp "; static char rcsid[] = "Id: chat.c,v 1.19 1998/03/24 23:57:48 paulus Exp ";
#else #else
__RCSID("$NetBSD: chat.c,v 1.14 1998/07/26 15:48:43 mycroft Exp $"); __RCSID("$NetBSD: chat.c,v 1.15 1998/09/02 20:55:55 christos Exp $");
#endif #endif
#endif #endif
@ -1484,11 +1484,11 @@ vfmtmsg(buf, buflen, fmt, args)
int width, prec, fillch; int width, prec, fillch;
int base, len, neg, quoted; int base, len, neg, quoted;
unsigned long val = 0; unsigned long val = 0;
char *buf0, *s; char *str, *buf0;
const char *str, *f; const char *f;
unsigned char *p; unsigned char *p;
char num[32]; char num[32];
static const char hexchars[] = "0123456789abcdef"; static char hexchars[] = "0123456789abcdef";
buf0 = buf; buf0 = buf;
--buflen; --buflen;
@ -1626,25 +1626,24 @@ vfmtmsg(buf, buflen, fmt, args)
continue; continue;
} }
if (base != 0) { if (base != 0) {
s = num + sizeof(num); str = num + sizeof(num);
*--s = 0; *--str = 0;
while (s > num + neg) { while (str > num + neg) {
*--s = hexchars[val % base]; *--str = hexchars[val % base];
val = val / base; val = val / base;
if (--prec <= 0 && val == 0) if (--prec <= 0 && val == 0)
break; break;
} }
switch (neg) { switch (neg) {
case 1: case 1:
*--s = '-'; *--str = '-';
break; break;
case 2: case 2:
*--s = 'x'; *--str = 'x';
*--s = '0'; *--str = '0';
break; break;
} }
len = num + sizeof(num) - 1 - s; len = num + sizeof(num) - 1 - str;
str = s;
} else { } else {
len = strlen(str); len = strlen(str);
if (prec > 0 && len > prec) if (prec > 0 && len > prec)

View File

@ -1,4 +1,4 @@
/* $NetBSD: auth.c,v 1.22 1998/07/27 00:52:01 mycroft Exp $ */ /* $NetBSD: auth.c,v 1.23 1998/09/02 20:55:55 christos Exp $ */
/* /*
* auth.c - PPP authentication and phase control. * auth.c - PPP authentication and phase control.
@ -39,7 +39,7 @@
#if 0 #if 0
static char rcsid[] = "Id: auth.c,v 1.37 1998/03/26 04:46:03 paulus Exp "; static char rcsid[] = "Id: auth.c,v 1.37 1998/03/26 04:46:03 paulus Exp ";
#else #else
__RCSID("$NetBSD: auth.c,v 1.22 1998/07/27 00:52:01 mycroft Exp $"); __RCSID("$NetBSD: auth.c,v 1.23 1998/09/02 20:55:55 christos Exp $");
#endif #endif
#endif #endif
@ -147,7 +147,7 @@ static int ip_addr_check __P((u_int32_t, struct wordlist *));
static int scan_authfile __P((FILE *, char *, char *, u_int32_t, char *, static int scan_authfile __P((FILE *, char *, char *, u_int32_t, char *,
struct wordlist **, char *)); struct wordlist **, char *));
static void free_wordlist __P((struct wordlist *)); static void free_wordlist __P((struct wordlist *));
static void auth_script __P((const char *)); static void auth_script __P((char *));
static void set_allowed_addrs __P((int, struct wordlist *)); static void set_allowed_addrs __P((int, struct wordlist *));
/* /*
@ -1481,13 +1481,13 @@ free_wordlist(wp)
*/ */
static void static void
auth_script(script) auth_script(script)
const char *script; char *script;
{ {
char strspeed[32]; char strspeed[32];
struct passwd *pw; struct passwd *pw;
char struid[32]; char struid[32];
const char *user_name; char *user_name;
const char *argv[8]; char *argv[8];
if ((pw = getpwuid(getuid())) != NULL && pw->pw_name != NULL) if ((pw = getpwuid(getuid())) != NULL && pw->pw_name != NULL)
user_name = pw->pw_name; user_name = pw->pw_name;

View File

@ -1,4 +1,4 @@
/* $NetBSD: chap.c,v 1.12 1998/07/06 07:04:28 mrg Exp $ */ /* $NetBSD: chap.c,v 1.13 1998/09/02 20:55:55 christos Exp $ */
/* /*
* chap.c - Challenge Handshake Authentication Protocol. * chap.c - Challenge Handshake Authentication Protocol.
@ -40,7 +40,7 @@
#if 0 #if 0
static char rcsid[] = "Id: chap.c,v 1.15 1997/11/27 06:07:48 paulus Exp "; static char rcsid[] = "Id: chap.c,v 1.15 1997/11/27 06:07:48 paulus Exp ";
#else #else
__RCSID("$NetBSD: chap.c,v 1.12 1998/07/06 07:04:28 mrg Exp $"); __RCSID("$NetBSD: chap.c,v 1.13 1998/09/02 20:55:55 christos Exp $");
#endif #endif
#endif #endif
@ -395,7 +395,7 @@ ChapReceiveChallenge(cstate, inp, id, len)
u_char *rchallenge; u_char *rchallenge;
int secret_len; int secret_len;
char secret[MAXSECRETLEN]; char secret[MAXSECRETLEN];
char rhostname[MAXNAMELEN+1]; char rhostname[256];
MD5_CTX mdContext; MD5_CTX mdContext;
u_char hash[MD5_SIGNATURE_SIZE]; u_char hash[MD5_SIGNATURE_SIZE];
@ -494,7 +494,7 @@ ChapReceiveResponse(cstate, inp, id, len)
u_char *remmd, remmd_len; u_char *remmd, remmd_len;
int secret_len, old_state; int secret_len, old_state;
int code; int code;
char rhostname[MAXNAMELEN+1]; char rhostname[256];
MD5_CTX mdContext; MD5_CTX mdContext;
char secret[MAXSECRETLEN]; char secret[MAXSECRETLEN];
u_char hash[MD5_SIGNATURE_SIZE]; u_char hash[MD5_SIGNATURE_SIZE];

View File

@ -1,4 +1,4 @@
/* $NetBSD: ipcp.c,v 1.15 1998/07/27 00:52:01 mycroft Exp $ */ /* $NetBSD: ipcp.c,v 1.16 1998/09/02 20:55:56 christos Exp $ */
/* /*
* ipcp.c - PPP IP Control Protocol. * ipcp.c - PPP IP Control Protocol.
@ -24,7 +24,7 @@
#if 0 #if 0
static char rcsid[] = "Id: ipcp.c,v 1.33 1998/03/25 03:08:47 paulus Exp "; static char rcsid[] = "Id: ipcp.c,v 1.33 1998/03/25 03:08:47 paulus Exp ";
#else #else
__RCSID("$NetBSD: ipcp.c,v 1.15 1998/07/27 00:52:01 mycroft Exp $"); __RCSID("$NetBSD: ipcp.c,v 1.16 1998/09/02 20:55:56 christos Exp $");
#endif #endif
#endif #endif
@ -69,7 +69,7 @@ static int ipcp_rejci __P((fsm *, u_char *, int)); /* Peer rej'd our CI */
static int ipcp_reqci __P((fsm *, u_char *, int *, int)); /* Rcv CI */ static int ipcp_reqci __P((fsm *, u_char *, int *, int)); /* Rcv CI */
static void ipcp_up __P((fsm *)); /* We're UP */ static void ipcp_up __P((fsm *)); /* We're UP */
static void ipcp_down __P((fsm *)); /* We're DOWN */ static void ipcp_down __P((fsm *)); /* We're DOWN */
static void ipcp_script __P((fsm *, const char *)); /* Run an up/down script */ static void ipcp_script __P((fsm *, char *)); /* Run an up/down script */
static void ipcp_finished __P((fsm *)); /* Don't need lower layer */ static void ipcp_finished __P((fsm *)); /* Don't need lower layer */
fsm ipcp_fsm[NUM_PPP]; /* IPCP fsm structure */ fsm ipcp_fsm[NUM_PPP]; /* IPCP fsm structure */
@ -1342,10 +1342,10 @@ ipcp_finished(f)
static void static void
ipcp_script(f, script) ipcp_script(f, script)
fsm *f; fsm *f;
const char *script; char *script;
{ {
char strspeed[32], strlocal[32], strremote[32]; char strspeed[32], strlocal[32], strremote[32];
const char *argv[8]; char *argv[8];
sprintf(strspeed, "%d", baud_rate); sprintf(strspeed, "%d", baud_rate);
strcpy(strlocal, ip_ntoa(ipcp_gotoptions[f->unit].ouraddr)); strcpy(strlocal, ip_ntoa(ipcp_gotoptions[f->unit].ouraddr));
@ -1359,7 +1359,6 @@ ipcp_script(f, script)
argv[5] = strremote; argv[5] = strremote;
argv[6] = ipparam; argv[6] = ipparam;
argv[7] = NULL; argv[7] = NULL;
run_program(script, argv, 0); run_program(script, argv, 0);
} }
@ -1419,9 +1418,9 @@ ipcp_printpkt(p, plen, printer, arg)
if (olen == CILEN_ADDRS) { if (olen == CILEN_ADDRS) {
p += 2; p += 2;
GETLONG(cilong, p); GETLONG(cilong, p);
printer(arg, "addrs %s", ip_ntoa(htonl(cilong))); printer(arg, "addrs %I", htonl(cilong));
GETLONG(cilong, p); GETLONG(cilong, p);
printer(arg, " %s", ip_ntoa(htonl(cilong))); printer(arg, " %I", htonl(cilong));
} }
break; break;
case CI_COMPRESSTYPE: case CI_COMPRESSTYPE:
@ -1445,20 +1444,20 @@ ipcp_printpkt(p, plen, printer, arg)
if (olen == CILEN_ADDR) { if (olen == CILEN_ADDR) {
p += 2; p += 2;
GETLONG(cilong, p); GETLONG(cilong, p);
printer(arg, "addr %s", ip_ntoa(htonl(cilong))); printer(arg, "addr %I", htonl(cilong));
} }
break; break;
case CI_MS_DNS1: case CI_MS_DNS1:
case CI_MS_DNS2: case CI_MS_DNS2:
p += 2; p += 2;
GETLONG(cilong, p); GETLONG(cilong, p);
printer(arg, "dns-addr %s", ip_ntoa(htonl(cilong))); printer(arg, "ms-dns %I", htonl(cilong));
break; break;
case CI_MS_WINS1: case CI_MS_WINS1:
case CI_MS_WINS2: case CI_MS_WINS2:
p += 2; p += 2;
GETLONG(cilong, p); GETLONG(cilong, p);
printer(arg, "wins-addr %s", ip_ntoa(htonl(cilong))); printer(arg, "ms-wins %I", htonl(cilong));
break; break;
} }
while (p < optend) { while (p < optend) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: ipxcp.c,v 1.4 1998/05/02 14:19:14 christos Exp $ */ /* $NetBSD: ipxcp.c,v 1.5 1998/09/02 20:55:56 christos Exp $ */
/* /*
* ipxcp.c - PPP IPX Control Protocol. * ipxcp.c - PPP IPX Control Protocol.
@ -25,7 +25,7 @@
#if 0 #if 0
static char rcsid[] = "Id: ipxcp.c,v 1.6 1998/03/25 03:08:16 paulus Exp "; static char rcsid[] = "Id: ipxcp.c,v 1.6 1998/03/25 03:08:16 paulus Exp ";
#else #else
__RCSID("$NetBSD: ipxcp.c,v 1.4 1998/05/02 14:19:14 christos Exp $"); __RCSID("$NetBSD: ipxcp.c,v 1.5 1998/09/02 20:55:56 christos Exp $");
#endif #endif
#endif #endif
@ -36,6 +36,7 @@ __RCSID("$NetBSD: ipxcp.c,v 1.4 1998/05/02 14:19:14 christos Exp $");
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <syslog.h> #include <syslog.h>
#include <unistd.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
@ -44,6 +45,7 @@ __RCSID("$NetBSD: ipxcp.c,v 1.4 1998/05/02 14:19:14 christos Exp $");
#include "fsm.h" #include "fsm.h"
#include "ipxcp.h" #include "ipxcp.h"
#include "pathnames.h" #include "pathnames.h"
#include "magic.h"
/* global vars */ /* global vars */
ipxcp_options ipxcp_wantoptions[NUM_PPP]; /* Options that we want to request */ ipxcp_options ipxcp_wantoptions[NUM_PPP]; /* Options that we want to request */

View File

@ -1,4 +1,4 @@
/* $NetBSD: lcp.c,v 1.17 1998/05/02 14:19:15 christos Exp $ */ /* $NetBSD: lcp.c,v 1.18 1998/09/02 20:55:56 christos Exp $ */
/* /*
* lcp.c - PPP Link Control Protocol. * lcp.c - PPP Link Control Protocol.
@ -24,7 +24,7 @@
#if 0 #if 0
static char rcsid[] = "Id: lcp.c,v 1.31 1997/11/27 06:08:44 paulus Exp "; static char rcsid[] = "Id: lcp.c,v 1.31 1997/11/27 06:08:44 paulus Exp ";
#else #else
__RCSID("$NetBSD: lcp.c,v 1.17 1998/05/02 14:19:15 christos Exp $"); __RCSID("$NetBSD: lcp.c,v 1.18 1998/09/02 20:55:56 christos Exp $");
#endif #endif
#endif #endif
@ -1627,6 +1627,20 @@ lcp_printpkt(p, plen, printer, arg)
break; break;
case PPP_CHAP: case PPP_CHAP:
printer(arg, "chap"); printer(arg, "chap");
if (p < optend) {
switch (*p) {
case CHAP_DIGEST_MD5:
printer(arg, " MD5");
++p;
break;
#ifdef CHAPMS
case CHAP_MICROSOFT:
printer(arg, " m$oft");
++p;
break;
#endif
}
}
break; break;
default: default:
printer(arg, "0x%x", cishort); printer(arg, "0x%x", cishort);

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.32 1998/07/27 00:52:02 mycroft Exp $ */ /* $NetBSD: main.c,v 1.33 1998/09/02 20:55:56 christos Exp $ */
/* /*
* main.c - Point-to-Point Protocol main module * main.c - Point-to-Point Protocol main module
@ -24,7 +24,7 @@
#if 0 #if 0
static char rcsid[] = "Id: main.c,v 1.47 1998/03/30 06:25:34 paulus Exp "; static char rcsid[] = "Id: main.c,v 1.47 1998/03/30 06:25:34 paulus Exp ";
#else #else
__RCSID("$NetBSD: main.c,v 1.32 1998/07/27 00:52:02 mycroft Exp $"); __RCSID("$NetBSD: main.c,v 1.33 1998/09/02 20:55:56 christos Exp $");
#endif #endif
#endif #endif
@ -79,7 +79,7 @@ char ifname[32]; /* Interface name */
int ifunit; /* Interface unit number */ int ifunit; /* Interface unit number */
char *progname; /* Name of this program */ char *progname; /* Name of this program */
char hostname[MAXNAMELEN + 1]; /* Our hostname */ char hostname[MAXNAMELEN]; /* Our hostname */
static char pidfilename[MAXPATHLEN]; /* name of pid file */ static char pidfilename[MAXPATHLEN]; /* name of pid file */
static char default_devnam[MAXPATHLEN]; /* name of default device */ static char default_devnam[MAXPATHLEN]; /* name of default device */
static pid_t pid; /* Our pid */ static pid_t pid; /* Our pid */
@ -173,7 +173,7 @@ main(argc, argv)
{ {
int i, fdflags; int i, fdflags;
struct sigaction sa; struct sigaction sa;
const char *p; char *p;
struct passwd *pw; struct passwd *pw;
struct timeval timo; struct timeval timo;
sigset_t mask; sigset_t mask;
@ -197,11 +197,11 @@ main(argc, argv)
setlogmask(LOG_UPTO(LOG_INFO)); setlogmask(LOG_UPTO(LOG_INFO));
#endif #endif
if (gethostname(hostname, sizeof(hostname)) < 0 ) { if (gethostname(hostname, MAXNAMELEN) < 0 ) {
option_error("Couldn't get hostname: %m"); option_error("Couldn't get hostname: %m");
die(1); die(1);
} }
hostname[sizeof(hostname) - 1] = 0; hostname[MAXNAMELEN-1] = 0;
uid = getuid(); uid = getuid();
privileged = uid == 0; privileged = uid == 0;
@ -1044,6 +1044,11 @@ static void
bad_signal(sig) bad_signal(sig)
int sig; int sig;
{ {
static int crashed = 0;
if (crashed)
_exit(127);
crashed = 1;
syslog(LOG_ERR, "Fatal signal %d", sig); syslog(LOG_ERR, "Fatal signal %d", sig);
if (conn_running) if (conn_running)
kill_my_pg(SIGTERM); kill_my_pg(SIGTERM);
@ -1130,8 +1135,8 @@ device_script(program, in, out)
*/ */
int int
run_program(prog, args, must_exist) run_program(prog, args, must_exist)
const char *prog; char *prog;
const char **args; char **args;
int must_exist; int must_exist;
{ {
int pid; int pid;
@ -1179,7 +1184,7 @@ run_program(prog, args, must_exist)
/* SysV recommends a second fork at this point. */ /* SysV recommends a second fork at this point. */
/* run the program; give it a null environment */ /* run the program; give it a null environment */
execve(prog, (char **)args, script_env); execve(prog, args, script_env);
if (must_exist || errno != ENOENT) if (must_exist || errno != ENOENT)
syslog(LOG_WARNING, "Can't execute %s: %m", prog); syslog(LOG_WARNING, "Can't execute %s: %m", prog);
_exit(-1); _exit(-1);
@ -1294,10 +1299,9 @@ pr_log __V((void *arg, char *fmt, ...))
fmt = va_arg(pvar, char *); fmt = va_arg(pvar, char *);
#endif #endif
vsprintf(buf, fmt, pvar); n = vfmtmsg(buf, sizeof(buf), fmt, pvar);
va_end(pvar); va_end(pvar);
n = strlen(buf);
if (linep + n + 1 > line + sizeof(line)) { if (linep + n + 1 > line + sizeof(line)) {
syslog(LOG_DEBUG, "%s", line); syslog(LOG_DEBUG, "%s", line);
linep = line; linep = line;
@ -1394,19 +1398,18 @@ int
vfmtmsg(buf, buflen, fmt, args) vfmtmsg(buf, buflen, fmt, args)
char *buf; char *buf;
int buflen; int buflen;
const char *fmt; char *fmt;
va_list args; va_list args;
{ {
int c, i, n; int c, i, n;
int width, prec, fillch; int width, prec, fillch;
int base, len, neg, quoted; int base, len, neg, quoted;
unsigned long val = 0; unsigned long val = 0;
char *buf0, *s; char *str, *f, *buf0;
const char *str, *f;
unsigned char *p; unsigned char *p;
char num[32]; char num[32];
time_t t; time_t t;
static const char hexchars[] = "0123456789abcdef"; static char hexchars[] = "0123456789abcdef";
buf0 = buf; buf0 = buf;
--buflen; --buflen;
@ -1506,9 +1509,9 @@ vfmtmsg(buf, buflen, fmt, args)
continue; continue;
case 't': case 't':
time(&t); time(&t);
s = ctime(&t); str = ctime(&t);
s[19] = 0; /* chop off year and newline */ str += 4; /* chop off the day name */
str = s + 4; /* chop off the day name */ str[15] = 0; /* chop off year and newline */
break; break;
case 'v': /* "visible" string */ case 'v': /* "visible" string */
case 'q': /* quoted string */ case 'q': /* quoted string */
@ -1564,25 +1567,24 @@ vfmtmsg(buf, buflen, fmt, args)
continue; continue;
} }
if (base != 0) { if (base != 0) {
s = num + sizeof(num); str = num + sizeof(num);
*--s = 0; *--str = 0;
while (s > num + neg) { while (str > num + neg) {
*--s = hexchars[val % base]; *--str = hexchars[val % base];
val = val / base; val = val / base;
if (--prec <= 0 && val == 0) if (--prec <= 0 && val == 0)
break; break;
} }
switch (neg) { switch (neg) {
case 1: case 1:
*--s = '-'; *--str = '-';
break; break;
case 2: case 2:
*--s = 'x'; *--str = 'x';
*--s = '0'; *--str = '0';
break; break;
} }
len = num + sizeof(num) - 1 - s; len = num + sizeof(num) - 1 - str;
str = s;
} else { } else {
len = strlen(str); len = strlen(str);
if (prec > 0 && len > prec) if (prec > 0 && len > prec)

View File

@ -1,4 +1,4 @@
/* $NetBSD: options.c,v 1.25 1998/07/27 00:52:02 mycroft Exp $ */ /* $NetBSD: options.c,v 1.26 1998/09/02 20:55:57 christos Exp $ */
/* /*
* options.c - handles option processing for PPP. * options.c - handles option processing for PPP.
@ -24,7 +24,7 @@
#if 0 #if 0
static char rcsid[] = "Id: options.c,v 1.42 1998/03/26 04:46:06 paulus Exp "; static char rcsid[] = "Id: options.c,v 1.42 1998/03/26 04:46:06 paulus Exp ";
#else #else
__RCSID("$NetBSD: options.c,v 1.25 1998/07/27 00:52:02 mycroft Exp $"); __RCSID("$NetBSD: options.c,v 1.26 1998/09/02 20:55:57 christos Exp $");
#endif #endif
#endif #endif
@ -178,7 +178,6 @@ static int setdomain __P((char **));
static int setnetmask __P((char **)); static int setnetmask __P((char **));
static int setcrtscts __P((char **)); static int setcrtscts __P((char **));
static int setnocrtscts __P((char **)); static int setnocrtscts __P((char **));
static int setcdtrcts __P((char **));
static int setxonxoff __P((char **)); static int setxonxoff __P((char **));
static int setnodetach __P((char **)); static int setnodetach __P((char **));
static int setupdetach __P((char **)); static int setupdetach __P((char **));
@ -319,9 +318,6 @@ static struct cmd {
{"crtscts", 0, setcrtscts}, /* set h/w flow control */ {"crtscts", 0, setcrtscts}, /* set h/w flow control */
{"nocrtscts", 0, setnocrtscts}, /* clear h/w flow control */ {"nocrtscts", 0, setnocrtscts}, /* clear h/w flow control */
{"-crtscts", 0, setnocrtscts}, /* clear h/w flow control */ {"-crtscts", 0, setnocrtscts}, /* clear h/w flow control */
{"cdtrcts", 0, setcdtrcts}, /* set alternate h/w flow control */
{"nocdtrcts", 0, setnocrtscts}, /* clear h/w flow control */
{"-cdtrcts", 0, setnocrtscts}, /* clear h/w flow control */
{"xonxoff", 0, setxonxoff}, /* set s/w flow control */ {"xonxoff", 0, setxonxoff}, /* set s/w flow control */
{"debug", 0, setdebug}, /* Increase debugging level */ {"debug", 0, setdebug}, /* Increase debugging level */
{"kdebug", 1, setkdebug}, /* Enable kernel-level debugging */ {"kdebug", 1, setkdebug}, /* Enable kernel-level debugging */
@ -446,7 +442,6 @@ Usage: %s [ options ], where options are:\n\
auth Require authentication from peer\n\ auth Require authentication from peer\n\
connect <p> Invoke shell command <p> to set up the serial line\n\ connect <p> Invoke shell command <p> to set up the serial line\n\
crtscts Use hardware RTS/CTS flow control\n\ crtscts Use hardware RTS/CTS flow control\n\
cdtrcts Use hardware DTR/CTS flow control (if supported)\n\
defaultroute Add default route through interface\n\ defaultroute Add default route through interface\n\
file <f> Take options from file <f>\n\ file <f> Take options from file <f>\n\
modem Use modem control lines\n\ modem Use modem control lines\n\
@ -670,8 +665,7 @@ err:
int int
options_from_user() options_from_user()
{ {
const char *user; char *user, *path, *file;
char *path, *file;
int ret; int ret;
struct passwd *pw; struct passwd *pw;
@ -1579,8 +1573,7 @@ setdomain(argv)
option_error("using the domain option requires root privilege"); option_error("using the domain option requires root privilege");
return 0; return 0;
} }
gethostname(hostname, sizeof(hostname)); gethostname(hostname, MAXNAMELEN);
hostname[sizeof(hostname) - 1] = '\0';
if (**argv != 0) { if (**argv != 0) {
if (**argv != '.') if (**argv != '.')
strncat(hostname, ".", MAXNAMELEN - strlen(hostname)); strncat(hostname, ".", MAXNAMELEN - strlen(hostname));
@ -1867,14 +1860,6 @@ setnocrtscts(argv)
return (1); return (1);
} }
static int
setcdtrcts(argv)
char **argv;
{
crtscts = 2;
return (1);
}
static int static int
setxonxoff(argv) setxonxoff(argv)
char **argv; char **argv;

View File

@ -1,8 +1,8 @@
/* $NetBSD: patchlevel.h,v 1.15 1998/05/02 14:19:15 christos Exp $ */ /* $NetBSD: patchlevel.h,v 1.16 1998/09/02 20:55:57 christos Exp $ */
/* Id: patchlevel.h,v 1.32 1998/03/25 01:29:43 paulus Exp */ /* Id: patchlevel.h,v 1.32 1998/03/25 01:29:43 paulus Exp */
#define PATCHLEVEL 4 #define PATCHLEVEL 5
#define VERSION "2.3" #define VERSION "2.3"
#define IMPLEMENTATION "" #define IMPLEMENTATION ""
#define DATE "25 March 1998" #define DATE "4 May 1998"

View File

@ -1,4 +1,4 @@
.\" $NetBSD: pppd.8,v 1.21 1998/05/02 14:19:15 christos Exp $ .\" $NetBSD: pppd.8,v 1.22 1998/09/02 20:55:57 christos Exp $
.\" manual page [] for pppd 2.3 .\" manual page [] for pppd 2.3
.\" Id: pppd.8,v 1.27 1998/03/31 04:31:08 paulus Exp .\" Id: pppd.8,v 1.27 1998/03/31 04:31:08 paulus Exp
.\" SH section heading .\" SH section heading
@ -93,29 +93,10 @@ program to dial the modem and start the remote ppp session. This
option is privileged if the \fInoauth\fR option is used. option is privileged if the \fInoauth\fR option is used.
.TP .TP
.B crtscts .B crtscts
Use hardware flow control (i.e. RTS/CTS) to control the flow of Use hardware flow control (i.e. RTS/CTS) to control the flow of data
data on the serial port. If neither the \fIcrtscts\fR, the on the serial port. If neither the \fIcrtscts\fR nor the
\fInocrtscts\fR, the \fIcdtrcts\fR nor the \fInocdtrcts\fR option \fInocrtscts\fR option is given, the hardware flow control setting
is given, the hardware flow control setting for the serial port is for the serial port is left unchanged.
left unchanged.
Some serial ports (such as Macintosh serial ports) lack a true
RTS output. Such serial ports use this mode to impliment
unidirectional flow control. The serial port will
suspend transmission when requested by the modem (via CTS)
but will be unable to request the modem stop sending to the
computer. This mode retains the ability to use DTR as
a modem control line.
.TP
.B cdtrcts
Use a non-standard hardware flow control (i.e. DTR/CTS) to control
the flow of data on the serial port. If neither the \fIcrtscts\fR,
the \fInocrtscts\fR, the \fIcdtrcts\fR nor the \fInocdtrcts\fR
option is given, the hardware flow control setting for the serial
port is left unchanged.
Some serial ports (such as Macintosh serial ports) lack a true
RTS output. Such serial ports use this mode to impliment true
bi-directional flow control. The sacrafice is that this flow
control mode does not permit using DTR as a modem control line.
.TP .TP
.B defaultroute .B defaultroute
Add a default route to the system routing tables, using the peer as Add a default route to the system routing tables, using the peer as
@ -489,14 +470,10 @@ should only be required if the peer is buggy and gets confused by
requests from pppd for CCP negotiation. requests from pppd for CCP negotiation.
.TP .TP
.B nocrtscts .B nocrtscts
Disable hardware flow control (i.e. RTS/CTS) on the serial port. Disable hardware flow control (i.e. RTS/CTS) on the serial port. If
If neither the \fIcrtscts\fR nor the \fInocrtscts\fR nor the neither the \fIcrtscts\fR nor the \fInocrtscts\fR option is given,
\fIcdtrcts\fR nor the \fInodtrcts\fR option is given, the hardware the hardware flow control setting for the serial port is left
flow control setting for the serial port is left unchanged. unchanged.
.TP
.B nodtrcts
This option is a synonym for \fInocrtscts\fR. Either of these options will
disable both forms of hardware flow control.
.TP .TP
.B nodefaultroute .B nodefaultroute
Disable the \fIdefaultroute\fR option. The system administrator who Disable the \fIdefaultroute\fR option. The system administrator who

View File

@ -1,4 +1,4 @@
/* $NetBSD: pppd.h,v 1.15 1998/07/27 00:52:02 mycroft Exp $ */ /* $NetBSD: pppd.h,v 1.16 1998/09/02 20:55:57 christos Exp $ */
/* /*
* pppd.h - PPP daemon global declarations. * pppd.h - PPP daemon global declarations.
@ -50,11 +50,7 @@
#define NUM_PPP 1 /* One PPP interface supported (per process) */ #define NUM_PPP 1 /* One PPP interface supported (per process) */
#define MAXWORDLEN 1024 /* max length of word in file (incl null) */ #define MAXWORDLEN 1024 /* max length of word in file (incl null) */
#define MAXARGS 1 /* max # args to a command */ #define MAXARGS 1 /* max # args to a command */
#ifdef MAXHOSTNAMELEN
#define MAXNAMELEN MAXHOSTNAMELEN /* max length of hostname or name for auth */
#else
#define MAXNAMELEN 256 /* max length of hostname or name for auth */ #define MAXNAMELEN 256 /* max length of hostname or name for auth */
#endif
#define MAXSECRETLEN 256 /* max length of password or secret */ #define MAXSECRETLEN 256 /* max length of password or secret */
/* /*
@ -65,7 +61,7 @@ extern int hungup; /* Physical layer has disconnected */
extern int ifunit; /* Interface unit number */ extern int ifunit; /* Interface unit number */
extern char ifname[]; /* Interface name */ extern char ifname[]; /* Interface name */
extern int ttyfd; /* Serial device file descriptor */ extern int ttyfd; /* Serial device file descriptor */
extern char hostname[MAXNAMELEN+1]; /* Our hostname */ extern char hostname[]; /* Our hostname */
extern u_char outpacket_buf[]; /* Buffer for outgoing packets */ extern u_char outpacket_buf[]; /* Buffer for outgoing packets */
extern int phase; /* Current state of link - see values below */ extern int phase; /* Current state of link - see values below */
extern int baud_rate; /* Current link speed in bits/sec */ extern int baud_rate; /* Current link speed in bits/sec */
@ -191,7 +187,7 @@ void timeout __P((void (*func)(void *), void *arg, int t));
/* Call func(arg) after t seconds */ /* Call func(arg) after t seconds */
void untimeout __P((void (*func)(void *), void *arg)); void untimeout __P((void (*func)(void *), void *arg));
/* Cancel call to func(arg) */ /* Cancel call to func(arg) */
int run_program __P((const char *prog, const char **args, int must_exist)); int run_program __P((char *prog, char **args, int must_exist));
/* Run program prog with args in child */ /* Run program prog with args in child */
void demuxprotrej __P((int, int)); void demuxprotrej __P((int, int));
/* Demultiplex a Protocol-Reject */ /* Demultiplex a Protocol-Reject */
@ -202,7 +198,7 @@ void log_packet __P((u_char *, int, char *, int));
void print_string __P((char *, int, void (*) (void *, char *, ...), void print_string __P((char *, int, void (*) (void *, char *, ...),
void *)); /* Format a string for output */ void *)); /* Format a string for output */
int fmtmsg __P((char *, int, char *, ...)); /* sprintf++ */ int fmtmsg __P((char *, int, char *, ...)); /* sprintf++ */
int vfmtmsg __P((char *, int, const char *, va_list)); /* vsprintf++ */ int vfmtmsg __P((char *, int, char *, va_list)); /* vsprintf++ */
void script_setenv __P((char *, char *)); /* set script env var */ void script_setenv __P((char *, char *)); /* set script env var */
void script_unsetenv __P((char *)); /* unset script env var */ void script_unsetenv __P((char *)); /* unset script env var */
@ -309,6 +305,10 @@ int get_host_seed __P((void)); /* Get host-dependent random number seed */
int set_filters __P((struct bpf_program *pass, struct bpf_program *active)); int set_filters __P((struct bpf_program *pass, struct bpf_program *active));
/* Set filter programs in kernel */ /* Set filter programs in kernel */
#endif #endif
#ifdef IPX_CHANGE
int sipxfaddr __P((int, unsigned long, unsigned char *));
int cipxfaddr __P((int));
#endif
/* Procedures exported from options.c */ /* Procedures exported from options.c */
int parse_args __P((int argc, char **argv)); int parse_args __P((int argc, char **argv));

View File

@ -1,4 +1,4 @@
/* $NetBSD: sys-bsd.c,v 1.27 1998/08/27 06:55:16 christos Exp $ */ /* $NetBSD: sys-bsd.c,v 1.28 1998/09/02 20:55:57 christos Exp $ */
/* /*
* sys-bsd.c - System-dependent procedures for setting up * sys-bsd.c - System-dependent procedures for setting up
@ -27,7 +27,7 @@
#if 0 #if 0
static char rcsid[] = "Id: sys-bsd.c,v 1.31 1998/04/02 12:04:19 paulus Exp "; static char rcsid[] = "Id: sys-bsd.c,v 1.31 1998/04/02 12:04:19 paulus Exp ";
#else #else
__RCSID("$NetBSD: sys-bsd.c,v 1.27 1998/08/27 06:55:16 christos Exp $"); __RCSID("$NetBSD: sys-bsd.c,v 1.28 1998/09/02 20:55:57 christos Exp $");
#endif #endif
#endif #endif
@ -395,13 +395,10 @@ set_up_tty(fd, local)
} }
tios.c_cflag &= ~(CSIZE | CSTOPB | PARENB | CLOCAL); tios.c_cflag &= ~(CSIZE | CSTOPB | PARENB | CLOCAL);
if (crtscts > 0 && !local) { if (crtscts > 0 && !local)
if (crtscts == 2) tios.c_cflag |= CRTSCTS;
tios.c_cflag |= CDTRCTS; else if (crtscts < 0)
else tios.c_cflag &= ~CRTSCTS;
tios.c_cflag |= CRTSCTS;
} else if (crtscts < 0)
tios.c_cflag &= ~(CRTSCTS | CDTRCTS);
tios.c_cflag |= CS8 | CREAD | HUPCL; tios.c_cflag |= CS8 | CREAD | HUPCL;
if (local || !modem) if (local || !modem)

View File

@ -1,4 +1,4 @@
.\" $NetBSD: pppstats.8,v 1.9 1997/07/22 15:19:30 perry Exp $ .\" $NetBSD: pppstats.8,v 1.10 1998/09/02 20:55:58 christos Exp $
.\" @(#) Id: pppstats.8,v 1.3 1996/07/01 01:22:35 paulus Exp .\" @(#) Id: pppstats.8,v 1.3 1996/07/01 01:22:35 paulus Exp
.TH PPPSTATS 8 "26 June 1995" .TH PPPSTATS 8 "26 June 1995"
.SH NAME .SH NAME
@ -100,7 +100,7 @@ this interface because of preceding errors. Only reported when the
option is specified. option is specified.
.TP .TP
.B NON-VJ .B NON-VJ
The total number of non-VJ packets received by this interface. Only The total number of non-TCP packets received by this interface. Only
reported when the reported when the
.B -v .B -v
option is specified. option is specified.
@ -139,7 +139,7 @@ Not reported when the
option is specified. option is specified.
.TP .TP
.B NON-VJ .B NON-VJ
The total number of non-VJ packets transmitted from this interface. The total number of non-TCP packets transmitted from this interface.
Not reported when the Not reported when the
.B -r .B -r
option is specified. option is specified.
@ -173,7 +173,7 @@ option is specified.
When the When the
.B -z .B -z
option is specified, option is specified,
.B pppstats .Nm pppstats
instead displays the following fields, relating to the packet instead displays the following fields, relating to the packet
compression algorithm currently in use. If packet compression is not compression algorithm currently in use. If packet compression is not
in use, these fields will all display zeroes. The fields displayed on in use, these fields will all display zeroes. The fields displayed on

View File

@ -1,4 +1,4 @@
/* $NetBSD: pppstats.c,v 1.19 1998/06/18 08:03:08 lukem Exp $ */ /* $NetBSD: pppstats.c,v 1.20 1998/09/02 20:55:58 christos Exp $ */
/* /*
* print PPP statistics: * print PPP statistics:
@ -38,7 +38,7 @@
#if 0 #if 0
static char rcsid[] = "Id: pppstats.c,v 1.22 1998/03/31 23:48:03 paulus Exp "; static char rcsid[] = "Id: pppstats.c,v 1.22 1998/03/31 23:48:03 paulus Exp ";
#else #else
__RCSID("$NetBSD: pppstats.c,v 1.19 1998/06/18 08:03:08 lukem Exp $"); __RCSID("$NetBSD: pppstats.c,v 1.20 1998/09/02 20:55:58 christos Exp $");
#endif #endif
#endif #endif
@ -64,11 +64,12 @@ __RCSID("$NetBSD: pppstats.c,v 1.19 1998/06/18 08:03:08 lukem Exp $");
#else #else
/* Linux */ /* Linux */
#if __GLIBC__ >= 2 #if __GLIBC__ >= 2
#include <asm/types.h> /* glibc 2 conflicts with linux/types.h */
#include <net/if.h> #include <net/if.h>
#else #else
#include <linux/types.h>
#include <linux/if.h> #include <linux/if.h>
#endif #endif
#include <linux/types.h>
#include <linux/ppp_defs.h> #include <linux/ppp_defs.h>
#include <linux/if_ppp.h> #include <linux/if_ppp.h>
#endif /* _linux_ */ #endif /* _linux_ */
@ -180,17 +181,25 @@ get_ppp_cstats(csp)
} }
#ifdef _linux_ #ifdef _linux_
if (creq.stats.c.bytes_out == 0) {
creq.stats.c.bytes_out = creq.stats.c.comp_bytes + creq.stats.c.inc_bytes;
creq.stats.c.in_count = creq.stats.c.unc_bytes;
}
if (creq.stats.c.bytes_out == 0) if (creq.stats.c.bytes_out == 0)
creq.stats.c.ratio = 0.0; creq.stats.c.ratio = 0.0;
else else
creq.stats.c.ratio = (double) creq.stats.c.in_count / creq.stats.c.ratio = 256.0 * creq.stats.c.in_count /
(double) creq.stats.c.bytes_out; creq.stats.c.bytes_out;
if (creq.stats.d.bytes_out == 0) {
creq.stats.d.bytes_out = creq.stats.d.comp_bytes + creq.stats.d.inc_bytes;
creq.stats.d.in_count = creq.stats.d.unc_bytes;
}
if (creq.stats.d.bytes_out == 0) if (creq.stats.d.bytes_out == 0)
creq.stats.d.ratio = 0.0; creq.stats.d.ratio = 0.0;
else else
creq.stats.d.ratio = (double) creq.stats.d.in_count / creq.stats.d.ratio = 256.0 * creq.stats.d.in_count /
(double) creq.stats.d.bytes_out; creq.stats.d.bytes_out;
#endif #endif
*csp = creq.stats; *csp = creq.stats;
@ -534,5 +543,5 @@ main(argc, argv)
#endif /* STREAMS */ #endif /* STREAMS */
intpr(); intpr();
return 0; exit(0);
} }