summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1997-12-03 23:28:02 +0000
committerbrian <brian@FreeBSD.org>1997-12-03 23:28:02 +0000
commit0d728a957362d7c1f83d15ab6af61c7851c5ca36 (patch)
treecc9f8897259fb11a5c2086f2005379c4d4aca7f8 /usr.sbin
parent4060d586346e71874cc8ce0771450b84d88cea41 (diff)
downloadFreeBSD-src-0d728a957362d7c1f83d15ab6af61c7851c5ca36.zip
FreeBSD-src-0d728a957362d7c1f83d15ab6af61c7851c5ca36.tar.gz
Fix the CCP Type field value for DEFLATE.
(I *really* meant to do this *before* committing the deflate changes in the first place - oops). Pppd is horribly broken in this respect - refer to the ppp man page for details. Ppp *WON'T* negotiate deflate with pppd by default - you must ``enable'' and ``accept'' ``pppd-deflate'' in your config. While I'm in there, update the cftypes in ccp.c so that we recognise some more protocols (we don't actually do anything with them - just send a REJ).
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ppp/ccp.c39
-rw-r--r--usr.sbin/ppp/ccp.h5
-rw-r--r--usr.sbin/ppp/deflate.c90
-rw-r--r--usr.sbin/ppp/deflate.h3
-rw-r--r--usr.sbin/ppp/ppp.843
-rw-r--r--usr.sbin/ppp/ppp.8.m443
-rw-r--r--usr.sbin/ppp/vars.c5
-rw-r--r--usr.sbin/ppp/vars.h23
8 files changed, 203 insertions, 48 deletions
diff --git a/usr.sbin/ppp/ccp.c b/usr.sbin/ppp/ccp.c
index a72ad5c..1b3ab34 100644
--- a/usr.sbin/ppp/ccp.c
+++ b/usr.sbin/ppp/ccp.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: ccp.c,v 1.20 1997/11/22 03:37:25 brian Exp $
+ * $Id: ccp.c,v 1.21 1997/12/03 10:23:44 brian Exp $
*
* TODO:
* o Support other compression protocols
@@ -80,21 +80,24 @@ struct fsm CcpFsm = {
static char const *cftypes[] = {
/* Check out the latest ``Compression Control Protocol'' rfc (rfc1962.txt) */
- "OUI", /* 0: OUI */
- "PRED1", /* 1: Predictor type 1 */
- "PRED2", /* 2: Predictor type 2 */
- "PUDDLE", /* 3: Puddle Jumber */
- "???", "???", "???", "???", "???", "???",
- "???", "???", "???", "???", "???", "???",
- "HWPPC", /* 16: Hewlett-Packard PPC */
- "STAC", /* 17: Stac Electronics LZS */
- "MSPPC", /* 18: Microsoft PPC */
- "GAND", /* 19: Gandalf FZA */
- "V42BIS", /* 20: ARG->DATA.42bis compression */
- "BSD", /* 21: BSD LZW Compress */
- "???",
- "???",
- "DEFLATE", /* 24: PPP Deflate */
+ "OUI", /* 0: OUI */
+ "PRED1", /* 1: Predictor type 1 */
+ "PRED2", /* 2: Predictor type 2 */
+ "PUDDLE", /* 3: Puddle Jumber */
+ "???", "???", "???", "???", "???", "???",
+ "???", "???", "???", "???", "???", "???",
+ "HWPPC", /* 16: Hewlett-Packard PPC */
+ "STAC", /* 17: Stac Electronics LZS (rfc1974) */
+ "MSPPC", /* 18: Microsoft PPC */
+ "GAND", /* 19: Gandalf FZA (rfc1993) */
+ "V42BIS", /* 20: ARG->DATA.42bis compression */
+ "BSD", /* 21: BSD LZW Compress */
+ "???",
+ "LZS-DCP", /* 23: LZS-DCP Compression Protocol (rfc1967) */
+ "MAGNALINK/DEFLATE", /* 24: Magnalink Variable Resource (rfc1975) */
+ /* 24: Deflate (according to pppd-2.3.1) */
+ "DCE", /* 25: Data Circuit-Terminating Equip (rfc1976) */
+ "DEFLATE", /* 26: Deflate (rfc1979) */
};
#define NCFTYPES (sizeof(cftypes)/sizeof(char *))
@@ -107,9 +110,11 @@ protoname(int proto)
return cftypes[proto];
}
+/* We support these algorithms, and Req them in the given order */
static const struct ccp_algorithm *algorithm[] = {
+ &DeflateAlgorithm,
&Pred1Algorithm,
- &DeflateAlgorithm
+ &PppdDeflateAlgorithm
};
static int in_algorithm = -1;
diff --git a/usr.sbin/ppp/ccp.h b/usr.sbin/ppp/ccp.h
index a9e7e8f..e6ff2c5 100644
--- a/usr.sbin/ppp/ccp.h
+++ b/usr.sbin/ppp/ccp.h
@@ -15,7 +15,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: ccp.h,v 1.9 1997/11/22 03:37:25 brian Exp $
+ * $Id: ccp.h,v 1.10 1997/12/03 10:23:45 brian Exp $
*
* TODO:
*/
@@ -32,7 +32,8 @@
#define TY_GAND 19 /* Gandalf FZA */
#define TY_V42BIS 20 /* V.42bis compression */
#define TY_BSD 21 /* BSD LZW Compress */
-#define TY_DEFLATE 24 /* Deflate (gzip) */
+#define TY_PPPD_DEFLATE 24 /* Deflate (gzip) - (mis) numbered by pppd */
+#define TY_DEFLATE 26 /* Deflate (gzip) - rfc 1979 */
struct ccpstate {
u_long his_proto; /* peer's compression protocol */
diff --git a/usr.sbin/ppp/deflate.c b/usr.sbin/ppp/deflate.c
index a759288..46fe138 100644
--- a/usr.sbin/ppp/deflate.c
+++ b/usr.sbin/ppp/deflate.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: deflate.c,v 1.1 1997/12/03 10:23:45 brian Exp $
*/
#include <sys/param.h>
@@ -343,6 +343,8 @@ DeflateDictSetup(u_short proto, struct mbuf *mi)
break; /* Done */
LogPrintf(LogERROR, "DeflateDictSetup: inflate returned %d (%s)\n",
res, InputState.cx.msg ? InputState.cx.msg : "");
+ LogPrintf(LogERROR, "DeflateDictSetup: avail_in %d, avail_out %d\n",
+ InputState.cx.avail_in, InputState.cx.avail_out);
CcpSendResetReq(&CcpFsm);
mbfree(mi_head); /* lose our allocated ``head'' buf */
return;
@@ -383,39 +385,50 @@ DeflateDispOpts(struct lcp_opt *o)
}
static void
-DeflateGetOpts(struct lcp_opt *o)
+DeflateGetInputOpts(struct lcp_opt *o)
{
o->id = TY_DEFLATE;
o->len = 4;
+ o->data[0] = ((iWindowSize-8)<<4)+8;
o->data[1] = '\0';
}
static void
-DeflateGetInputOpts(struct lcp_opt *o)
+DeflateGetOutputOpts(struct lcp_opt *o)
{
- DeflateGetOpts(o);
+ o->id = TY_DEFLATE;
+ o->len = 4;
+ o->data[0] = ((oWindowSize-8)<<4)+8;
+ o->data[1] = '\0';
+}
+
+static void
+PppdDeflateGetInputOpts(struct lcp_opt *o)
+{
+ o->id = TY_PPPD_DEFLATE;
+ o->len = 4;
o->data[0] = ((iWindowSize-8)<<4)+8;
+ o->data[1] = '\0';
}
static void
-DeflateGetOutputOpts(struct lcp_opt *o)
+PppdDeflateGetOutputOpts(struct lcp_opt *o)
{
- DeflateGetOpts(o);
+ o->id = TY_PPPD_DEFLATE;
+ o->len = 4;
o->data[0] = ((oWindowSize-8)<<4)+8;
+ o->data[1] = '\0';
}
static int
DeflateSetOpts(struct lcp_opt *o, int *sz)
{
- if (o->id != TY_DEFLATE || o->len != 4 ||
- (o->data[0]&15) != 8 || o->data[1] != '\0') {
- DeflateGetOpts(o);
+ if (o->len != 4 || (o->data[0]&15) != 8 || o->data[1] != '\0') {
return MODE_REJ;
}
*sz = (o->data[0] >> 4) + 8;
if (*sz > 15) {
*sz = 15;
- DeflateGetOpts(o);
return MODE_NAK;
}
@@ -425,13 +438,41 @@ DeflateSetOpts(struct lcp_opt *o, int *sz)
static int
DeflateSetInputOpts(struct lcp_opt *o)
{
- return DeflateSetOpts(o, &iWindowSize);
+ int res;
+ res = DeflateSetOpts(o, &iWindowSize);
+ if (res != MODE_ACK)
+ DeflateGetInputOpts(o);
+ return res;
}
static int
DeflateSetOutputOpts(struct lcp_opt *o)
{
- return DeflateSetOpts(o, &oWindowSize);
+ int res;
+ res = DeflateSetOpts(o, &oWindowSize);
+ if (res != MODE_ACK)
+ DeflateGetOutputOpts(o);
+ return res;
+}
+
+static int
+PppdDeflateSetInputOpts(struct lcp_opt *o)
+{
+ int res;
+ res = DeflateSetOpts(o, &iWindowSize);
+ if (res != MODE_ACK)
+ PppdDeflateGetInputOpts(o);
+ return res;
+}
+
+static int
+PppdDeflateSetOutputOpts(struct lcp_opt *o)
+{
+ int res;
+ res = DeflateSetOpts(o, &oWindowSize);
+ if (res != MODE_ACK)
+ PppdDeflateGetOutputOpts(o);
+ return res;
}
static int
@@ -475,8 +516,31 @@ DeflateTermOutput(void)
deflateEnd(&OutputState.cx);
}
+const struct ccp_algorithm PppdDeflateAlgorithm = {
+ TY_PPPD_DEFLATE, /* pppd (wrongly) expects this ``type'' field */
+ ConfPppdDeflate,
+ DeflateDispOpts,
+ {
+ PppdDeflateGetInputOpts,
+ PppdDeflateSetInputOpts,
+ DeflateInitInput,
+ DeflateTermInput,
+ DeflateResetInput,
+ DeflateInput,
+ DeflateDictSetup
+ },
+ {
+ PppdDeflateGetOutputOpts,
+ PppdDeflateSetOutputOpts,
+ DeflateInitOutput,
+ DeflateTermOutput,
+ DeflateResetOutput,
+ DeflateOutput
+ },
+};
+
const struct ccp_algorithm DeflateAlgorithm = {
- TY_DEFLATE,
+ TY_DEFLATE, /* rfc 1979 */
ConfDeflate,
DeflateDispOpts,
{
diff --git a/usr.sbin/ppp/deflate.h b/usr.sbin/ppp/deflate.h
index a879a29..84e2189 100644
--- a/usr.sbin/ppp/deflate.h
+++ b/usr.sbin/ppp/deflate.h
@@ -1,5 +1,6 @@
/*
- * $Id$
+ * $Id: deflate.h,v 1.1 1997/12/03 10:23:45 brian Exp $
*/
+extern const struct ccp_algorithm PppdDeflateAlgorithm;
extern const struct ccp_algorithm DeflateAlgorithm;
diff --git a/usr.sbin/ppp/ppp.8 b/usr.sbin/ppp/ppp.8
index a607e55..fd7a12f 100644
--- a/usr.sbin/ppp/ppp.8
+++ b/usr.sbin/ppp/ppp.8
@@ -1,4 +1,4 @@
-.\" $Id: ppp.8,v 1.80 1997/11/18 14:52:06 brian Exp $
+.\" $Id: ppp.8,v 1.81 1997/12/03 10:23:51 brian Exp $
.Dd 20 September 1995
.Os FreeBSD
.Dt PPP 8
@@ -1594,6 +1594,37 @@ This is the same algorithm as used by the
.Xr gzip 1
program.
+Note: There is a problem negotiating
+.Ar deflate
+capabilities with
+.Xr pppd 8
+- a
+.Em PPP
+implementation available under many operating systems.
+.Nm Pppd
+(version 2.3.1) incorrectly attempts to negotiate
+.Ar deflate
+compression using type
+.Em 24
+as the CCP configuration type rather than type
+.Em 26
+as specified in
+.Pa rfc1979 .
+Type
+.Ar 24
+is actually specified as
+.Dq PPP Magnalink Variable Resource Compression
+in
+.Pa rfc1975 Ns No !
+.Nm Ppp
+is capable of negotiating with
+.Nm pppd ,
+but only if
+.Dq pppd-deflate
+is
+.Ar enable Ns No d
+and
+.Ar accept Ns No ed .
.It lqr
Default: Disabled and Accepted. This option decides if Link Quality
@@ -1628,6 +1659,16 @@ in
.Pa /etc/ppp/ppp.conf .
PAP is accepted by default.
+.It pppd-deflate
+Default: Disabled and Denied. This is a variance of the
+.Ar deflate
+option, allowing negotiation with the
+.Xr pppd 8
+program. Refer to the
+.Ar deflate
+section above for details. It is disabled by default as it violates
+.Pa rfc1975 .
+
.It pred1
Default: Enabled and Accepted. This option decides if Predictor 1
compression will be used by the Compression Control Protocol (CCP).
diff --git a/usr.sbin/ppp/ppp.8.m4 b/usr.sbin/ppp/ppp.8.m4
index a607e55..fd7a12f 100644
--- a/usr.sbin/ppp/ppp.8.m4
+++ b/usr.sbin/ppp/ppp.8.m4
@@ -1,4 +1,4 @@
-.\" $Id: ppp.8,v 1.80 1997/11/18 14:52:06 brian Exp $
+.\" $Id: ppp.8,v 1.81 1997/12/03 10:23:51 brian Exp $
.Dd 20 September 1995
.Os FreeBSD
.Dt PPP 8
@@ -1594,6 +1594,37 @@ This is the same algorithm as used by the
.Xr gzip 1
program.
+Note: There is a problem negotiating
+.Ar deflate
+capabilities with
+.Xr pppd 8
+- a
+.Em PPP
+implementation available under many operating systems.
+.Nm Pppd
+(version 2.3.1) incorrectly attempts to negotiate
+.Ar deflate
+compression using type
+.Em 24
+as the CCP configuration type rather than type
+.Em 26
+as specified in
+.Pa rfc1979 .
+Type
+.Ar 24
+is actually specified as
+.Dq PPP Magnalink Variable Resource Compression
+in
+.Pa rfc1975 Ns No !
+.Nm Ppp
+is capable of negotiating with
+.Nm pppd ,
+but only if
+.Dq pppd-deflate
+is
+.Ar enable Ns No d
+and
+.Ar accept Ns No ed .
.It lqr
Default: Disabled and Accepted. This option decides if Link Quality
@@ -1628,6 +1659,16 @@ in
.Pa /etc/ppp/ppp.conf .
PAP is accepted by default.
+.It pppd-deflate
+Default: Disabled and Denied. This is a variance of the
+.Ar deflate
+option, allowing negotiation with the
+.Xr pppd 8
+program. Refer to the
+.Ar deflate
+section above for details. It is disabled by default as it violates
+.Pa rfc1975 .
+
.It pred1
Default: Enabled and Accepted. This option decides if Predictor 1
compression will be used by the Compression Control Protocol (CCP).
diff --git a/usr.sbin/ppp/vars.c b/usr.sbin/ppp/vars.c
index fde9089..a6429a2 100644
--- a/usr.sbin/ppp/vars.c
+++ b/usr.sbin/ppp/vars.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: vars.c,v 1.37 1997/11/22 13:47:02 brian Exp $
+ * $Id: vars.c,v 1.38 1997/12/03 10:23:53 brian Exp $
*
*/
#include <sys/param.h>
@@ -39,7 +39,7 @@
#include "auth.h"
char VarVersion[] = "PPP Version 1.5";
-char VarLocalVersion[] = "$Date: 1997/11/22 13:47:02 $";
+char VarLocalVersion[] = "$Date: 1997/12/03 10:23:53 $";
int Utmp = 0;
int ipInOctets = 0;
int ipOutOctets = 0;
@@ -58,6 +58,7 @@ struct confdesc pppConfs[] = {
{"deflate", CONF_ENABLE, CONF_ACCEPT},
{"lqr", CONF_DISABLE, CONF_ACCEPT},
{"pap", CONF_DISABLE, CONF_ACCEPT},
+ {"pppd-deflate", CONF_DISABLE, CONF_DENY},
{"pred1", CONF_ENABLE, CONF_ACCEPT},
{"protocomp", CONF_ENABLE, CONF_ACCEPT},
{"vjcomp", CONF_ENABLE, CONF_ACCEPT},
diff --git a/usr.sbin/ppp/vars.h b/usr.sbin/ppp/vars.h
index 5f6cf88..b5bc7ca 100644
--- a/usr.sbin/ppp/vars.h
+++ b/usr.sbin/ppp/vars.h
@@ -15,7 +15,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: vars.h,v 1.35 1997/11/22 03:37:54 brian Exp $
+ * $Id: vars.h,v 1.36 1997/12/03 10:23:54 brian Exp $
*
* TODO:
*/
@@ -37,16 +37,17 @@ struct confdesc {
#define ConfDeflate 2
#define ConfLqr 3
#define ConfPap 4
-#define ConfPred1 5
-#define ConfProtocomp 6
-#define ConfVjcomp 7
-
-#define ConfMSExt 8
-#define ConfPasswdAuth 9
-#define ConfProxy 10
-#define ConfThroughput 11
-#define ConfUtmp 12
-#define MAXCONFS 13
+#define ConfPppdDeflate 5
+#define ConfPred1 6
+#define ConfProtocomp 7
+#define ConfVjcomp 8
+
+#define ConfMSExt 9
+#define ConfPasswdAuth 10
+#define ConfProxy 11
+#define ConfThroughput 12
+#define ConfUtmp 13
+#define MAXCONFS 14
#define Enabled(x) (pppConfs[x].myside & CONF_ENABLE)
#define Acceptable(x) (pppConfs[x].hisside & CONF_ACCEPT)
OpenPOWER on IntegriCloud