From 5d5b8675792d627c639016dd4939b030741ba9ec Mon Sep 17 00:00:00 2001 From: brian Date: Tue, 7 Oct 1997 00:56:58 +0000 Subject: 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. --- usr.sbin/ppp/ipcp.c | 7 ++++++- usr.sbin/ppp/main.c | 6 +++--- usr.sbin/ppp/slcompress.c | 20 +++++++++----------- usr.sbin/ppp/slcompress.h | 6 +++--- usr.sbin/ppp/vjcomp.c | 6 +++--- 5 files changed, 24 insertions(+), 21 deletions(-) diff --git a/usr.sbin/ppp/ipcp.c b/usr.sbin/ppp/ipcp.c index 3ac6953..78918730 100644 --- a/usr.sbin/ppp/ipcp.c +++ b/usr.sbin/ppp/ipcp.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: ipcp.c,v 1.27 1997/08/31 22:59:29 brian Exp $ + * $Id: ipcp.c,v 1.28 1997/09/03 02:08:18 brian Exp $ * * TODO: * o More RFC1772 backwoard compatibility @@ -40,6 +40,7 @@ #include "loadalias.h" #include "vars.h" +extern void VjInit(int); extern void PutConfValue(); extern void Prompt(); extern struct in_addr ifnetmask; @@ -300,6 +301,10 @@ IpcpLayerUp(struct fsm * fp) LogPrintf(LogIPCP, "IpcpLayerUp(%d).\n", fp->state); snprintf(tbuff, sizeof(tbuff), "myaddr = %s ", inet_ntoa(IpcpInfo.want_ipaddr)); + + if (IpcpInfo.his_compproto >> 16 == PROTO_VJCOMP) + VjInit((IpcpInfo.his_compproto >> 8) & 255); + LogPrintf(LogIsKept(LogIPCP) ? LogIPCP : LogLINK, " %s hisaddr = %s\n", tbuff, inet_ntoa(IpcpInfo.his_ipaddr)); if (OsSetIpaddress(IpcpInfo.want_ipaddr, IpcpInfo.his_ipaddr, ifnetmask) < 0) { diff --git a/usr.sbin/ppp/main.c b/usr.sbin/ppp/main.c index 8eb55fa..9e07a6a 100644 --- a/usr.sbin/ppp/main.c +++ b/usr.sbin/ppp/main.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: main.c,v 1.80 1997/09/21 20:26:46 brian Exp $ + * $Id: main.c,v 1.81 1997/09/22 00:46:55 brian Exp $ * * TODO: * o Add commands for traffic summary, version display, etc. @@ -60,7 +60,7 @@ #endif #endif -extern void VjInit(), AsyncInit(); +extern void VjInit(int), AsyncInit(); extern void AsyncInput(); extern int SelectSystem(); @@ -501,7 +501,7 @@ PacketMode() return; } AsyncInit(); - VjInit(); + VjInit(15); LcpInit(); IpcpInit(); CcpInit(); diff --git a/usr.sbin/ppp/slcompress.c b/usr.sbin/ppp/slcompress.c index 77aaa6f..9fc45c3 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); diff --git a/usr.sbin/ppp/slcompress.h b/usr.sbin/ppp/slcompress.h index 1506d08..812c1a3 100644 --- a/usr.sbin/ppp/slcompress.h +++ b/usr.sbin/ppp/slcompress.h @@ -1,7 +1,7 @@ /* * Definitions for tcp compression routines. * - * $Header: /home/ncvs/src/usr.sbin/ppp/slcompress.h,v 1.6 1997/06/09 03:27:38 brian Exp $ + * $Header: /home/ncvs/src/usr.sbin/ppp/slcompress.h,v 1.7 1997/08/25 00:29:29 brian Exp $ * * Copyright (c) 1989 Regents of the University of California. * All rights reserved. @@ -18,7 +18,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: slcompress.h,v 1.6 1997/06/09 03:27:38 brian Exp $ + * $Id: slcompress.h,v 1.7 1997/08/25 00:29:29 brian Exp $ * * Van Jacobson (van@helios.ee.lbl.gov), Dec 31, 1989: * - Initial distribution. @@ -138,7 +138,7 @@ struct slstat { /* flag values */ #define SLF_TOSS 1 /* tossing rcvd frames because of input err */ -extern void sl_compress_init(struct slcompress *); +extern void sl_compress_init(struct slcompress *, int max_state); extern u_char sl_compress_tcp __P((struct mbuf *, struct ip *, struct slcompress *, int compress_cid_flag)); diff --git a/usr.sbin/ppp/vjcomp.c b/usr.sbin/ppp/vjcomp.c index f18f8d6..fef6a97 100644 --- a/usr.sbin/ppp/vjcomp.c +++ b/usr.sbin/ppp/vjcomp.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: vjcomp.c,v 1.8 1997/06/09 03:27:43 brian Exp $ + * $Id: vjcomp.c,v 1.9 1997/08/25 00:29:32 brian Exp $ * * TODO: */ @@ -34,9 +34,9 @@ struct slcompress cslc; void -VjInit() +VjInit(int max_state) { - sl_compress_init(&cslc); + sl_compress_init(&cslc, max_state); } void -- cgit v1.1