summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pppd
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1998-06-20 17:35:17 +0000
committerpeter <peter@FreeBSD.org>1998-06-20 17:35:17 +0000
commit644163fc0e0fa2bcfcabc2bc198763a158431e7a (patch)
treee3dd874cf3ab0e72a3baec58bec0acbd46a58822 /usr.sbin/pppd
parent82529a59a4dcb49e065ad6f39c6c259601a20415 (diff)
downloadFreeBSD-src-644163fc0e0fa2bcfcabc2bc198763a158431e7a.zip
FreeBSD-src-644163fc0e0fa2bcfcabc2bc198763a158431e7a.tar.gz
Import user-mode parts of kernel ppp v2.3.5
Obtained from: Paul Mackerras; ftp://cs.anu.edu.au/pub/software/ppp
Diffstat (limited to 'usr.sbin/pppd')
-rw-r--r--usr.sbin/pppd/ccp.c102
-rw-r--r--usr.sbin/pppd/ccp.h4
-rw-r--r--usr.sbin/pppd/chap_ms.c6
-rw-r--r--usr.sbin/pppd/ipxcp.c23
4 files changed, 95 insertions, 40 deletions
diff --git a/usr.sbin/pppd/ccp.c b/usr.sbin/pppd/ccp.c
index d4e3b3c..6d328b7 100644
--- a/usr.sbin/pppd/ccp.c
+++ b/usr.sbin/pppd/ccp.c
@@ -26,19 +26,18 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: ccp.c,v 1.21 1997/05/22 06:45:59 paulus Exp $";
+static char rcsid[] = "$Id: ccp.c,v 1.22 1998/03/25 01:25:02 paulus Exp $";
#endif
#include <string.h>
#include <syslog.h>
#include <sys/ioctl.h>
#include <sys/types.h>
-#include <net/ppp_defs.h>
-#include <net/ppp-comp.h>
#include "pppd.h"
#include "fsm.h"
#include "ccp.h"
+#include <net/ppp-comp.h>
/*
* Protocol entry points from main code.
@@ -151,8 +150,12 @@ ccp_init(unit)
ccp_wantoptions[0].deflate = 1;
ccp_wantoptions[0].deflate_size = DEFLATE_MAX_SIZE;
+ ccp_wantoptions[0].deflate_correct = 1;
+ ccp_wantoptions[0].deflate_draft = 1;
ccp_allowoptions[0].deflate = 1;
ccp_allowoptions[0].deflate_size = DEFLATE_MAX_SIZE;
+ ccp_allowoptions[0].deflate_correct = 1;
+ ccp_allowoptions[0].deflate_draft = 1;
ccp_wantoptions[0].bsd_compress = 1;
ccp_wantoptions[0].bsd_bits = BSD_MAX_BITS;
@@ -315,11 +318,23 @@ ccp_resetci(f)
go->bsd_compress = 0;
}
if (go->deflate) {
- opt_buf[0] = CI_DEFLATE;
- opt_buf[1] = CILEN_DEFLATE;
- opt_buf[2] = DEFLATE_MAKE_OPT(DEFLATE_MIN_SIZE);
- opt_buf[3] = DEFLATE_CHK_SEQUENCE;
- if (ccp_test(f->unit, opt_buf, CILEN_DEFLATE, 0) <= 0)
+ if (go->deflate_correct) {
+ opt_buf[0] = CI_DEFLATE;
+ opt_buf[1] = CILEN_DEFLATE;
+ opt_buf[2] = DEFLATE_MAKE_OPT(DEFLATE_MIN_SIZE);
+ opt_buf[3] = DEFLATE_CHK_SEQUENCE;
+ if (ccp_test(f->unit, opt_buf, CILEN_DEFLATE, 0) <= 0)
+ go->deflate_correct = 0;
+ }
+ if (go->deflate_draft) {
+ opt_buf[0] = CI_DEFLATE_DRAFT;
+ opt_buf[1] = CILEN_DEFLATE;
+ opt_buf[2] = DEFLATE_MAKE_OPT(DEFLATE_MIN_SIZE);
+ opt_buf[3] = DEFLATE_CHK_SEQUENCE;
+ if (ccp_test(f->unit, opt_buf, CILEN_DEFLATE, 0) <= 0)
+ go->deflate_draft = 0;
+ }
+ if (!go->deflate_correct && !go->deflate_draft)
go->deflate = 0;
}
if (go->predictor_1) {
@@ -370,7 +385,7 @@ ccp_addci(f, p, lenp)
* in case it gets Acked.
*/
if (go->deflate) {
- p[0] = CI_DEFLATE;
+ p[0] = go->deflate_correct? CI_DEFLATE: CI_DEFLATE_DRAFT;
p[1] = CILEN_DEFLATE;
p[2] = DEFLATE_MAKE_OPT(go->deflate_size);
p[3] = DEFLATE_CHK_SEQUENCE;
@@ -387,6 +402,13 @@ ccp_addci(f, p, lenp)
--go->deflate_size;
p[2] = DEFLATE_MAKE_OPT(go->deflate_size);
}
+ if (p != p0 && go->deflate_correct && go->deflate_draft) {
+ p[0] = CI_DEFLATE_DRAFT;
+ p[1] = CILEN_DEFLATE;
+ p[2] = p[2 - CILEN_DEFLATE];
+ p[3] = DEFLATE_CHK_SEQUENCE;
+ p += CILEN_DEFLATE;
+ }
}
if (go->bsd_compress) {
p[0] = CI_BSD_COMPRESS;
@@ -450,7 +472,8 @@ ccp_ackci(f, p, len)
if (go->deflate) {
if (len < CILEN_DEFLATE
- || p[0] != CI_DEFLATE || p[1] != CILEN_DEFLATE
+ || p[0] != (go->deflate_correct? CI_DEFLATE: CI_DEFLATE_DRAFT)
+ || p[1] != CILEN_DEFLATE
|| p[2] != DEFLATE_MAKE_OPT(go->deflate_size)
|| p[3] != DEFLATE_CHK_SEQUENCE)
return 0;
@@ -459,6 +482,16 @@ ccp_ackci(f, p, len)
/* XXX Cope with first/fast ack */
if (len == 0)
return 1;
+ if (go->deflate_correct && go->deflate_draft) {
+ if (len < CILEN_DEFLATE
+ || p[0] != CI_DEFLATE_DRAFT
+ || p[1] != CILEN_DEFLATE
+ || p[2] != DEFLATE_MAKE_OPT(go->deflate_size)
+ || p[3] != DEFLATE_CHK_SEQUENCE)
+ return 0;
+ p += CILEN_DEFLATE;
+ len -= CILEN_DEFLATE;
+ }
}
if (go->bsd_compress) {
if (len < CILEN_BSD_COMPRESS
@@ -515,7 +548,8 @@ ccp_nakci(f, p, len)
try = *go;
if (go->deflate && len >= CILEN_DEFLATE
- && p[0] == CI_DEFLATE && p[1] == CILEN_DEFLATE) {
+ && p[0] == (go->deflate_correct? CI_DEFLATE: CI_DEFLATE_DRAFT)
+ && p[1] == CILEN_DEFLATE) {
no.deflate = 1;
/*
* Peer wants us to use a different code size or something.
@@ -529,6 +563,12 @@ ccp_nakci(f, p, len)
try.deflate_size = DEFLATE_SIZE(p[2]);
p += CILEN_DEFLATE;
len -= CILEN_DEFLATE;
+ if (go->deflate_correct && go->deflate_draft
+ && len >= CILEN_DEFLATE && p[0] == CI_DEFLATE_DRAFT
+ && p[1] == CILEN_DEFLATE) {
+ p += CILEN_DEFLATE;
+ len -= CILEN_DEFLATE;
+ }
}
if (go->bsd_compress && len >= CILEN_BSD_COMPRESS
@@ -582,13 +622,29 @@ ccp_rejci(f, p, len)
return -1;
if (go->deflate && len >= CILEN_DEFLATE
- && p[0] == CI_DEFLATE && p[1] == CILEN_DEFLATE) {
+ && p[0] == (go->deflate_correct? CI_DEFLATE: CI_DEFLATE_DRAFT)
+ && p[1] == CILEN_DEFLATE) {
if (p[2] != DEFLATE_MAKE_OPT(go->deflate_size)
|| p[3] != DEFLATE_CHK_SEQUENCE)
return 0; /* Rej is bad */
- try.deflate = 0;
+ if (go->deflate_correct)
+ try.deflate_correct = 0;
+ else
+ try.deflate_draft = 0;
p += CILEN_DEFLATE;
len -= CILEN_DEFLATE;
+ if (go->deflate_correct && go->deflate_draft
+ && len >= CILEN_DEFLATE && p[0] == CI_DEFLATE_DRAFT
+ && p[1] == CILEN_DEFLATE) {
+ if (p[2] != DEFLATE_MAKE_OPT(go->deflate_size)
+ || p[3] != DEFLATE_CHK_SEQUENCE)
+ return 0; /* Rej is bad */
+ try.deflate_draft = 0;
+ p += CILEN_DEFLATE;
+ len -= CILEN_DEFLATE;
+ }
+ if (!try.deflate_correct && !try.deflate_draft)
+ try.deflate = 0;
}
if (go->bsd_compress && len >= CILEN_BSD_COMPRESS
&& p[0] == CI_BSD_COMPRESS && p[1] == CILEN_BSD_COMPRESS) {
@@ -658,7 +714,10 @@ ccp_reqci(f, p, lenp, dont_nak)
switch (type) {
case CI_DEFLATE:
- if (!ao->deflate || clen != CILEN_DEFLATE) {
+ case CI_DEFLATE_DRAFT:
+ if (!ao->deflate || clen != CILEN_DEFLATE
+ || (!ao->deflate_correct && type == CI_DEFLATE)
+ || (!ao->deflate_draft && type == CI_DEFLATE_DRAFT)) {
newret = CONFREJ;
break;
}
@@ -811,11 +870,15 @@ method_name(opt, opt2)
return "(none)";
switch (opt->method) {
case CI_DEFLATE:
+ case CI_DEFLATE_DRAFT:
if (opt2 != NULL && opt2->deflate_size != opt->deflate_size)
- sprintf(result, "Deflate (%d/%d)", opt->deflate_size,
- opt2->deflate_size);
+ sprintf(result, "Deflate%s (%d/%d)",
+ (opt->method == CI_DEFLATE_DRAFT? "(old#)": ""),
+ opt->deflate_size, opt2->deflate_size);
else
- sprintf(result, "Deflate (%d)", opt->deflate_size);
+ sprintf(result, "Deflate%s (%d)",
+ (opt->method == CI_DEFLATE_DRAFT? "(old#)": ""),
+ opt->deflate_size);
break;
case CI_BSD_COMPRESS:
if (opt2 != NULL && opt2->bsd_bits != opt->bsd_bits)
@@ -932,8 +995,11 @@ ccp_printpkt(p, plen, printer, arg)
optend = p + optlen;
switch (code) {
case CI_DEFLATE:
+ case CI_DEFLATE_DRAFT:
if (optlen >= CILEN_DEFLATE) {
- printer(arg, "deflate %d", DEFLATE_SIZE(p[2]));
+ printer(arg, "deflate%s %d",
+ (code == CI_DEFLATE_DRAFT? "(old#)": ""),
+ DEFLATE_SIZE(p[2]));
if (DEFLATE_METHOD(p[2]) != DEFLATE_METHOD_VAL)
printer(arg, " method %d", DEFLATE_METHOD(p[2]));
if (p[3] != DEFLATE_CHK_SEQUENCE)
diff --git a/usr.sbin/pppd/ccp.h b/usr.sbin/pppd/ccp.h
index 1f15345..2fcba91 100644
--- a/usr.sbin/pppd/ccp.h
+++ b/usr.sbin/pppd/ccp.h
@@ -24,7 +24,7 @@
* OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
* OR MODIFICATIONS.
*
- * $Id: ccp.h,v 1.7 1996/07/01 01:11:49 paulus Exp $
+ * $Id: ccp.h,v 1.8 1998/03/25 01:25:03 paulus Exp $
*/
typedef struct ccp_options {
@@ -32,6 +32,8 @@ typedef struct ccp_options {
u_int deflate: 1; /* do Deflate? */
u_int predictor_1: 1; /* do Predictor-1? */
u_int predictor_2: 1; /* do Predictor-2? */
+ u_int deflate_correct: 1; /* use correct code for deflate? */
+ u_int deflate_draft: 1; /* use draft RFC code for deflate? */
u_short bsd_bits; /* # bits/code for BSD Compress */
u_short deflate_size; /* lg(window size) for Deflate */
short method; /* code for chosen compression method */
diff --git a/usr.sbin/pppd/chap_ms.c b/usr.sbin/pppd/chap_ms.c
index db6f4cf..7ae8e42 100644
--- a/usr.sbin/pppd/chap_ms.c
+++ b/usr.sbin/pppd/chap_ms.c
@@ -32,7 +32,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: chap_ms.c,v 1.5 1997/11/27 06:08:10 paulus Exp $";
+static char rcsid[] = "$Id: chap_ms.c,v 1.8 1998/04/01 00:15:43 paulus Exp $";
#endif
#ifdef CHAPMS
@@ -44,6 +44,9 @@ static char rcsid[] = "$Id: chap_ms.c,v 1.5 1997/11/27 06:08:10 paulus Exp $";
#include <sys/time.h>
#include <syslog.h>
#include <unistd.h>
+#ifdef HAVE_CRYPT_H
+#include <crypt.h>
+#endif
#include "pppd.h"
#include "chap.h"
@@ -255,7 +258,6 @@ ChapMS_NT(rchallenge, rchallenge_len, secret, secret_len, response)
MD4_CTX md4Context;
u_char hash[MD4_SIGNATURE_SIZE];
u_char unicodePassword[MAX_NT_PASSWORD * 2];
- static int low_byte_first = -1;
/* Initialize the Unicode version of the secret (== password). */
/* This implicitly supports 8-bit ISO8859/1 characters. */
diff --git a/usr.sbin/pppd/ipxcp.c b/usr.sbin/pppd/ipxcp.c
index 9de3462..0374910 100644
--- a/usr.sbin/pppd/ipxcp.c
+++ b/usr.sbin/pppd/ipxcp.c
@@ -19,7 +19,7 @@
#ifdef IPX_CHANGE
#ifndef lint
-static char rcsid[] = "$Id: ipxcp.c,v 1.5 1997/03/04 03:39:32 paulus Exp $";
+static char rcsid[] = "$Id: ipxcp.c,v 1.6 1998/03/25 03:08:16 paulus Exp $";
#endif
/*
@@ -163,7 +163,7 @@ ipx_ntoa(ipxaddr)
u_int32_t ipxaddr;
{
static char b[64];
- sprintf(b, "%lx", ipxaddr);
+ sprintf(b, "%x", ipxaddr);
return b;
}
@@ -336,9 +336,6 @@ static void
ipxcp_resetci(f)
fsm *f;
{
- u_int32_t network;
- int unit = f->unit;
-
wo->req_node = wo->neg_node && ao->neg_node;
wo->req_nn = wo->neg_nn && ao->neg_nn;
@@ -387,7 +384,6 @@ static int
ipxcp_cilen(f)
fsm *f;
{
- int unit = f->unit;
int len;
len = go->neg_nn ? CILEN_NETN : 0;
@@ -411,8 +407,6 @@ ipxcp_addci(f, ucp, lenp)
u_char *ucp;
int *lenp;
{
- int len = *lenp;
- int unit = f->unit;
/*
* Add the options to the record.
*/
@@ -462,7 +456,6 @@ ipxcp_ackci(f, p, len)
u_char *p;
int len;
{
- int unit = f->unit;
u_short cilen, citype, cishort;
u_char cichar;
u_int32_t cilong;
@@ -571,7 +564,6 @@ ipxcp_nakci(f, p, len)
u_char *p;
int len;
{
- int unit = f->unit;
u_char citype, cilen, *next;
u_short s;
u_int32_t l;
@@ -690,7 +682,6 @@ ipxcp_rejci(f, p, len)
u_char *p;
int len;
{
- int unit = f->unit;
u_short cilen, citype, cishort;
u_char cichar;
u_int32_t cilong;
@@ -807,17 +798,15 @@ ipxcp_reqci(f, inp, len, reject_if_disagree)
int *len; /* Length of requested CIs */
int reject_if_disagree;
{
- int unit = f->unit;
u_char *cip, *next; /* Pointer to current and next CIs */
u_short cilen, citype; /* Parsed len, type */
- u_short cishort, ts; /* Parsed short value */
- u_int32_t tl, cinetwork, outnet;/* Parsed address values */
+ u_short cishort; /* Parsed short value */
+ u_int32_t cinetwork; /* Parsed address values */
int rc = CONFACK; /* Final packet return code */
int orc; /* Individual option return code */
u_char *p; /* Pointer to next char to parse */
u_char *ucp = inp; /* Pointer to current output char */
int l = *len; /* Length left */
- u_char maxslotindex, cflag;
/*
* Reset all his options.
@@ -1094,7 +1083,6 @@ endswitch:
if (rc != CONFREJ && !ho->neg_node &&
wo->req_nn && !reject_if_disagree) {
- u_char *ps;
if (rc == CONFACK) {
rc = CONFNAK;
wo->req_nn = 0; /* don't ask again */
@@ -1197,8 +1185,6 @@ static void
ipxcp_down(f)
fsm *f;
{
- u_int32_t ournn, network;
-
IPXCPDEBUG((LOG_INFO, "ipxcp: down"));
cipxfaddr (f->unit);
@@ -1216,7 +1202,6 @@ ipxcp_script(f, script)
fsm *f;
char *script;
{
- int unit = f->unit;
char strspeed[32], strlocal[32], strremote[32];
char strnetwork[32], strpid[32];
char *argv[14], strproto_lcl[32], strproto_rmt[32];
OpenPOWER on IntegriCloud