aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/ppp/slcompress.c
diff options
context:
space:
mode:
authorBrian Somers <brian@FreeBSD.org>1997-10-07 00:56:58 +0000
committerBrian Somers <brian@FreeBSD.org>1997-10-07 00:56:58 +0000
commit03604f35741201f02ec51f12de926cbec5ee2663 (patch)
tree5f26aa5cdb88805185c9b6f9a51e34d82ac01c3a /usr.sbin/ppp/slcompress.c
parent19c53cc05df3d7a714e57f69f27acc1ddc482246 (diff)
downloadsrc-03604f35741201f02ec51f12de926cbec5ee2663.tar.gz
src-03604f35741201f02ec51f12de926cbec5ee2663.zip
Support VJ maximum slot identifiers != 15.
Support VJ slot id compression. Previously, ppp would negotiate a max slot between 2 & 15 (if asked), and would agree to slot id compression (if asked). It would then proceed to use 16 slots and no compression anyway. The result was a rather unusable connection.
Notes
Notes: svn path=/head/; revision=30187
Diffstat (limited to 'usr.sbin/ppp/slcompress.c')
-rw-r--r--usr.sbin/ppp/slcompress.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/usr.sbin/ppp/slcompress.c b/usr.sbin/ppp/slcompress.c
index 77aaa6f09133..9fc45c3062c2 100644
--- a/usr.sbin/ppp/slcompress.c
+++ b/usr.sbin/ppp/slcompress.c
@@ -17,13 +17,13 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: slcompress.c,v 1.9 1997/06/09 03:27:37 brian Exp $
+ * $Id: slcompress.c,v 1.10 1997/08/25 00:29:28 brian Exp $
*
* Van Jacobson (van@helios.ee.lbl.gov), Dec 31, 1989:
* - Initial distribution.
*/
#ifndef lint
-static char const rcsid[] = "$Id: slcompress.c,v 1.9 1997/06/09 03:27:37 brian Exp $";
+static char const rcsid[] = "$Id: slcompress.c,v 1.10 1997/08/25 00:29:28 brian Exp $";
#endif
@@ -47,17 +47,17 @@ struct slstat slstat;
#endif
void
-sl_compress_init(struct slcompress * comp)
+sl_compress_init(struct slcompress * comp, int max_state)
{
register u_int i;
register struct cstate *tstate = comp->tstate;
bzero((char *) comp, sizeof(*comp));
- for (i = MAX_STATES - 1; i > 0; --i) {
+ for (i = max_state; i > 0; --i) {
tstate[i].cs_id = i;
tstate[i].cs_next = &tstate[i - 1];
}
- tstate[0].cs_next = &tstate[MAX_STATES - 1];
+ tstate[0].cs_next = &tstate[max_state];
tstate[0].cs_id = 0;
comp->last_cs = &tstate[0];
comp->last_recv = 255;
@@ -359,14 +359,11 @@ found:
* know what order packets will go on the line. In this case, we always
* send a "new" connection id so the receiver state stays synchronized.
*/
-#ifdef SL_NOFASTQ
- if (comp->last_xmit == cs->cs_id) {
+ if (comp->last_xmit == cs->cs_id && compress_cid) {
hlen -= deltaS + 3;
cp += hlen;
*cp++ = changes;
- } else
-#endif
- {
+ } else {
comp->last_xmit = cs->cs_id;
hlen -= deltaS + 4;
cp += hlen;
@@ -428,7 +425,7 @@ sl_uncompress_tcp(u_char ** bufp,
if (hlen > MAX_HDR)
goto bad;
BCOPY(ip, &cs->cs_ip, hlen);
- cs->cs_ip.ip_sum = 0;
+ /* cs->cs_ip.ip_sum = 0; */
cs->cs_hlen = hlen;
INCR(sls_uncompressedin)
return (len);
@@ -552,6 +549,7 @@ sl_uncompress_tcp(u_char ** bufp,
{
register u_short *bp = (u_short *) cp;
+ cs->cs_ip.ip_sum = 0;
for (changes = 0; hlen > 0; hlen -= 2)
changes += *bp++;
changes = (changes & 0xffff) + (changes >> 16);