diff options
author | Brian Somers <brian@FreeBSD.org> | 1998-03-16 22:54:35 +0000 |
---|---|---|
committer | Brian Somers <brian@FreeBSD.org> | 1998-03-16 22:54:35 +0000 |
commit | eaa4df37f41891389081dc62e17cc172b36b8736 (patch) | |
tree | 7ea4a43106846e68f185309b140991da56661db2 | |
parent | a0cbd833f36a8874a2770e45e3ecfa9f0eb700e1 (diff) | |
download | src-test2-eaa4df37f41891389081dc62e17cc172b36b8736.tar.gz src-test2-eaa4df37f41891389081dc62e17cc172b36b8736.zip |
Notes
-rw-r--r-- | usr.sbin/ppp/arp.c | 5 | ||||
-rw-r--r-- | usr.sbin/ppp/auth.c | 5 | ||||
-rw-r--r-- | usr.sbin/ppp/bundle.c | 5 | ||||
-rw-r--r-- | usr.sbin/ppp/ccp.c | 5 | ||||
-rw-r--r-- | usr.sbin/ppp/chap.c | 5 | ||||
-rw-r--r-- | usr.sbin/ppp/command.c | 4 | ||||
-rw-r--r-- | usr.sbin/ppp/datalink.c | 5 | ||||
-rw-r--r-- | usr.sbin/ppp/filter.c | 5 | ||||
-rw-r--r-- | usr.sbin/ppp/fsm.c | 5 | ||||
-rw-r--r-- | usr.sbin/ppp/hdlc.c | 7 | ||||
-rw-r--r-- | usr.sbin/ppp/ip.c | 3 | ||||
-rw-r--r-- | usr.sbin/ppp/ipcp.c | 10 | ||||
-rw-r--r-- | usr.sbin/ppp/ipcp.h | 8 | ||||
-rw-r--r-- | usr.sbin/ppp/lcp.c | 5 | ||||
-rw-r--r-- | usr.sbin/ppp/link.c | 5 | ||||
-rw-r--r-- | usr.sbin/ppp/lqr.c | 5 | ||||
-rw-r--r-- | usr.sbin/ppp/main.c | 3 | ||||
-rw-r--r-- | usr.sbin/ppp/modem.c | 5 | ||||
-rw-r--r-- | usr.sbin/ppp/pap.c | 5 | ||||
-rw-r--r-- | usr.sbin/ppp/physical.c | 7 | ||||
-rw-r--r-- | usr.sbin/ppp/prompt.c | 5 | ||||
-rw-r--r-- | usr.sbin/ppp/route.c | 5 | ||||
-rw-r--r-- | usr.sbin/ppp/slcompress.c | 86 | ||||
-rw-r--r-- | usr.sbin/ppp/slcompress.h | 22 | ||||
-rw-r--r-- | usr.sbin/ppp/tun.c | 5 | ||||
-rw-r--r-- | usr.sbin/ppp/vjcomp.c | 24 | ||||
-rw-r--r-- | usr.sbin/ppp/vjcomp.h | 5 |
27 files changed, 164 insertions, 95 deletions
diff --git a/usr.sbin/ppp/arp.c b/usr.sbin/ppp/arp.c index a355d403318d..a99458534b25 100644 --- a/usr.sbin/ppp/arp.c +++ b/usr.sbin/ppp/arp.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: arp.c,v 1.27.2.6 1998/03/13 21:07:26 brian Exp $ + * $Id: arp.c,v 1.27.2.7 1998/03/16 22:51:37 brian Exp $ * */ @@ -35,6 +35,8 @@ #include <net/if_types.h> #include <netinet/if_ether.h> #include <arpa/inet.h> +#include <netinet/in_systm.h> +#include <netinet/ip.h> #include <fcntl.h> #include <stdio.h> @@ -56,6 +58,7 @@ #include "defs.h" #include "iplist.h" #include "throughput.h" +#include "slcompress.h" #include "ipcp.h" #include "filter.h" #include "bundle.h" diff --git a/usr.sbin/ppp/auth.c b/usr.sbin/ppp/auth.c index 75416424370a..dd7d520d9e05 100644 --- a/usr.sbin/ppp/auth.c +++ b/usr.sbin/ppp/auth.c @@ -17,13 +17,15 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: auth.c,v 1.27.2.13 1998/03/13 21:07:26 brian Exp $ + * $Id: auth.c,v 1.27.2.14 1998/03/16 22:51:43 brian Exp $ * * TODO: * o Implement check against with registered IP addresses. */ #include <sys/param.h> #include <netinet/in.h> +#include <netinet/in_systm.h> +#include <netinet/ip.h> #include <assert.h> #include <pwd.h> @@ -39,6 +41,7 @@ #include "fsm.h" #include "iplist.h" #include "throughput.h" +#include "slcompress.h" #include "ipcp.h" #include "loadalias.h" #include "vars.h" diff --git a/usr.sbin/ppp/bundle.c b/usr.sbin/ppp/bundle.c index 4d8b22a5b65b..d1ec14ae7a76 100644 --- a/usr.sbin/ppp/bundle.c +++ b/usr.sbin/ppp/bundle.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: bundle.c,v 1.1.2.26 1998/03/16 22:51:45 brian Exp $ + * $Id: bundle.c,v 1.1.2.27 1998/03/16 22:53:04 brian Exp $ */ #include <sys/param.h> @@ -34,6 +34,8 @@ #include <arpa/inet.h> #include <net/route.h> #include <net/if_dl.h> +#include <netinet/in_systm.h> +#include <netinet/ip.h> #include <errno.h> #include <fcntl.h> @@ -54,6 +56,7 @@ #include "lqr.h" #include "hdlc.h" #include "throughput.h" +#include "slcompress.h" #include "ipcp.h" #include "link.h" #include "filter.h" diff --git a/usr.sbin/ppp/ccp.c b/usr.sbin/ppp/ccp.c index 64f7cf37cc7e..c39bdeeade0a 100644 --- a/usr.sbin/ppp/ccp.c +++ b/usr.sbin/ppp/ccp.c @@ -17,13 +17,15 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: ccp.c,v 1.30.2.21 1998/03/13 21:07:57 brian Exp $ + * $Id: ccp.c,v 1.30.2.22 1998/03/16 22:51:49 brian Exp $ * * TODO: * o Support other compression protocols */ #include <sys/param.h> #include <netinet/in.h> +#include <netinet/in_systm.h> +#include <netinet/ip.h> #include <stdio.h> #include <string.h> @@ -44,6 +46,7 @@ #include "deflate.h" #include "throughput.h" #include "iplist.h" +#include "slcompress.h" #include "ipcp.h" #include "filter.h" #include "bundle.h" diff --git a/usr.sbin/ppp/chap.c b/usr.sbin/ppp/chap.c index 79c012deefc4..5ad3b8cc20a7 100644 --- a/usr.sbin/ppp/chap.c +++ b/usr.sbin/ppp/chap.c @@ -17,12 +17,14 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: chap.c,v 1.28.2.16 1998/03/13 21:07:29 brian Exp $ + * $Id: chap.c,v 1.28.2.17 1998/03/16 22:51:52 brian Exp $ * * TODO: */ #include <sys/param.h> #include <netinet/in.h> +#include <netinet/in_systm.h> +#include <netinet/ip.h> #include <ctype.h> #ifdef HAVE_DES @@ -62,6 +64,7 @@ #include "descriptor.h" #include "physical.h" #include "iplist.h" +#include "slcompress.h" #include "ipcp.h" #include "filter.h" #include "bundle.h" diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c index d4ecec4296dc..1657468ceaf1 100644 --- a/usr.sbin/ppp/command.c +++ b/usr.sbin/ppp/command.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: command.c,v 1.131.2.38 1998/03/13 21:08:01 brian Exp $ + * $Id: command.c,v 1.131.2.39 1998/03/16 22:51:58 brian Exp $ * */ #include <sys/param.h> @@ -54,6 +54,7 @@ #include "lcp.h" #include "iplist.h" #include "throughput.h" +#include "slcompress.h" #include "ipcp.h" #include "modem.h" #ifndef NOALIAS @@ -70,7 +71,6 @@ #include "route.h" #include "ccp.h" #include "ip.h" -#include "slcompress.h" #include "auth.h" #include "async.h" #include "link.h" diff --git a/usr.sbin/ppp/datalink.c b/usr.sbin/ppp/datalink.c index dd1e272dcdb3..135c2fe3a578 100644 --- a/usr.sbin/ppp/datalink.c +++ b/usr.sbin/ppp/datalink.c @@ -23,11 +23,13 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: datalink.c,v 1.1.2.22 1998/03/13 21:07:30 brian Exp $ + * $Id: datalink.c,v 1.1.2.23 1998/03/16 22:52:01 brian Exp $ */ #include <sys/param.h> #include <netinet/in.h> +#include <netinet/in_systm.h> +#include <netinet/ip.h> #include <alias.h> #include <stdio.h> @@ -52,6 +54,7 @@ #include "link.h" #include "physical.h" #include "iplist.h" +#include "slcompress.h" #include "ipcp.h" #include "filter.h" #include "bundle.h" diff --git a/usr.sbin/ppp/filter.c b/usr.sbin/ppp/filter.c index 74f99ecbd6da..ae2021372c86 100644 --- a/usr.sbin/ppp/filter.c +++ b/usr.sbin/ppp/filter.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: filter.c,v 1.22.2.7 1998/03/13 21:07:31 brian Exp $ + * $Id: filter.c,v 1.22.2.8 1998/03/16 22:52:04 brian Exp $ * * TODO: Shoud send ICMP error message when we discard packets. */ @@ -26,6 +26,8 @@ #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> +#include <netinet/in_systm.h> +#include <netinet/ip.h> #include <stdio.h> #include <stdlib.h> @@ -45,6 +47,7 @@ #include "hdlc.h" #include "link.h" #include "fsm.h" +#include "slcompress.h" #include "ipcp.h" #include "filter.h" #include "descriptor.h" diff --git a/usr.sbin/ppp/fsm.c b/usr.sbin/ppp/fsm.c index 6da79a6d9b92..d62efc5dbafb 100644 --- a/usr.sbin/ppp/fsm.c +++ b/usr.sbin/ppp/fsm.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: fsm.c,v 1.27.2.20 1998/03/13 21:08:01 brian Exp $ + * $Id: fsm.c,v 1.27.2.21 1998/03/16 22:52:10 brian Exp $ * * TODO: * o Refer loglevel for log output @@ -25,6 +25,8 @@ */ #include <sys/param.h> #include <netinet/in.h> +#include <netinet/in_systm.h> +#include <netinet/ip.h> #include <stdio.h> #include <string.h> @@ -50,6 +52,7 @@ #include "descriptor.h" #include "physical.h" #include "iplist.h" +#include "slcompress.h" #include "ipcp.h" #include "filter.h" #include "bundle.h" diff --git a/usr.sbin/ppp/hdlc.c b/usr.sbin/ppp/hdlc.c index 7f0db11357d9..283e3906e8f2 100644 --- a/usr.sbin/ppp/hdlc.c +++ b/usr.sbin/ppp/hdlc.c @@ -17,12 +17,14 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: hdlc.c,v 1.28.2.19 1998/03/13 21:07:33 brian Exp $ + * $Id: hdlc.c,v 1.28.2.20 1998/03/16 22:52:15 brian Exp $ * * TODO: */ #include <sys/param.h> #include <netinet/in.h> +#include <netinet/in_systm.h> +#include <netinet/ip.h> #include <stdio.h> #include <string.h> @@ -39,6 +41,7 @@ #include "lcpproto.h" #include "iplist.h" #include "throughput.h" +#include "slcompress.h" #include "ipcp.h" #include "ip.h" #include "vjcomp.h" @@ -410,7 +413,7 @@ DecodePacket(struct bundle *bundle, u_short proto, struct mbuf * bp, break; case PROTO_VJUNCOMP: case PROTO_VJCOMP: - bp = VjCompInput(bp, proto); + bp = VjCompInput(&bundle->ncp.ipcp, bp, proto); if (bp == NULL) break; /* fall down */ diff --git a/usr.sbin/ppp/ip.c b/usr.sbin/ppp/ip.c index ef62e8ebd675..c9c896536246 100644 --- a/usr.sbin/ppp/ip.c +++ b/usr.sbin/ppp/ip.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: ip.c,v 1.38.2.12 1998/03/13 21:07:34 brian Exp $ + * $Id: ip.c,v 1.38.2.13 1998/03/16 22:52:17 brian Exp $ * * TODO: * o Return ICMP message for filterd packet @@ -59,6 +59,7 @@ #include "vars.h" #include "throughput.h" #include "iplist.h" +#include "slcompress.h" #include "ipcp.h" #include "filter.h" #include "bundle.h" diff --git a/usr.sbin/ppp/ipcp.c b/usr.sbin/ppp/ipcp.c index 9fb327f11caa..b79d990406a8 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.50.2.22 1998/03/13 21:08:03 brian Exp $ + * $Id: ipcp.c,v 1.50.2.23 1998/03/16 22:52:20 brian Exp $ * * TODO: * o More RFC1772 backwoard compatibility @@ -50,8 +50,8 @@ #include "lcp.h" #include "iplist.h" #include "throughput.h" -#include "ipcp.h" #include "slcompress.h" +#include "ipcp.h" #include "filter.h" #include "bundle.h" #include "loadalias.h" @@ -234,6 +234,8 @@ ipcp_Init(struct ipcp *ipcp, struct bundle *bundle, struct link *l, ipcp->cfg.nbns_entries[0].s_addr = INADDR_ANY; ipcp->cfg.nbns_entries[1].s_addr = INADDR_ANY; + memset(&ipcp->vj, '\0', sizeof ipcp->vj); + ipcp->my_ifip.s_addr = INADDR_ANY; ipcp->peer_ifip.s_addr = INADDR_ANY; @@ -281,7 +283,7 @@ ipcp_Setup(struct ipcp *ipcp) ipcp->cfg.VJInitComp; else ipcp->my_compproto = 0; - VjInit(ipcp->cfg.VJInitSlots - 1); + sl_compress_init(&ipcp->vj.cslc, ipcp->cfg.VJInitSlots - 1); ipcp->peer_reject = 0; ipcp->my_reject = 0; @@ -542,7 +544,7 @@ IpcpLayerUp(struct fsm *fp) tbuff, inet_ntoa(ipcp->peer_ip)); if (ipcp->peer_compproto >> 16 == PROTO_VJCOMP) - VjInit((ipcp->peer_compproto >> 8) & 255); + sl_compress_init(&ipcp->vj.cslc, (ipcp->peer_compproto >> 8) & 255); if (ipcp_SetIPaddress(fp->bundle, ipcp->my_ip, ipcp->peer_ip, 0) < 0) { diff --git a/usr.sbin/ppp/ipcp.h b/usr.sbin/ppp/ipcp.h index c9581ec92cdf..16e5698ed5c2 100644 --- a/usr.sbin/ppp/ipcp.h +++ b/usr.sbin/ppp/ipcp.h @@ -15,7 +15,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: ipcp.h,v 1.18.2.15 1998/03/13 21:07:37 brian Exp $ + * $Id: ipcp.h,v 1.18.2.16 1998/03/13 21:08:04 brian Exp $ * * TODO: */ @@ -60,6 +60,12 @@ struct ipcp { #endif } cfg; + struct { + struct slcompress cslc; /* VJ state */ + struct slstat slstat; /* VJ statistics */ + } vj; + + int heis1172 : 1; /* True if he is speaking rfc1172 */ struct in_addr peer_ip; /* IP address he's willing to use */ diff --git a/usr.sbin/ppp/lcp.c b/usr.sbin/ppp/lcp.c index 3de368f409b6..ba89226a342f 100644 --- a/usr.sbin/ppp/lcp.c +++ b/usr.sbin/ppp/lcp.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: lcp.c,v 1.55.2.28 1998/03/13 21:08:05 brian Exp $ + * $Id: lcp.c,v 1.55.2.29 1998/03/16 22:52:23 brian Exp $ * * TODO: * o Limit data field length by MRU @@ -30,6 +30,8 @@ #include <net/if_tun.h> #include <netinet/in.h> #include <arpa/inet.h> +#include <netinet/in_systm.h> +#include <netinet/ip.h> #include <signal.h> #include <stdarg.h> @@ -49,6 +51,7 @@ #include "lcp.h" #include "iplist.h" #include "throughput.h" +#include "slcompress.h" #include "ipcp.h" #include "lcpproto.h" #include "filter.h" diff --git a/usr.sbin/ppp/link.c b/usr.sbin/ppp/link.c index f9fd3d886f4a..ea1e8fd9faed 100644 --- a/usr.sbin/ppp/link.c +++ b/usr.sbin/ppp/link.c @@ -23,12 +23,14 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: link.c,v 1.1.2.11 1998/03/13 21:07:38 brian Exp $ + * $Id: link.c,v 1.1.2.12 1998/03/16 22:52:24 brian Exp $ * */ #include <sys/param.h> #include <netinet/in.h> +#include <netinet/in_systm.h> +#include <netinet/ip.h> #include <stdio.h> #include <termios.h> @@ -47,6 +49,7 @@ #include "link.h" #include "fsm.h" #include "iplist.h" +#include "slcompress.h" #include "ipcp.h" #include "filter.h" #include "bundle.h" diff --git a/usr.sbin/ppp/lqr.c b/usr.sbin/ppp/lqr.c index 33b86bfc54e7..0f9dff9c73f6 100644 --- a/usr.sbin/ppp/lqr.c +++ b/usr.sbin/ppp/lqr.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: lqr.c,v 1.22.2.12 1998/03/13 21:07:39 brian Exp $ + * $Id: lqr.c,v 1.22.2.13 1998/03/16 22:52:25 brian Exp $ * * o LQR based on RFC1333 * @@ -28,6 +28,8 @@ #include <sys/param.h> #include <netinet/in.h> +#include <netinet/in_systm.h> +#include <netinet/ip.h> #include <stdio.h> #include <string.h> @@ -49,6 +51,7 @@ #include "descriptor.h" #include "physical.h" #include "iplist.h" +#include "slcompress.h" #include "ipcp.h" #include "filter.h" #include "bundle.h" diff --git a/usr.sbin/ppp/main.c b/usr.sbin/ppp/main.c index 6a616e77d1b7..b86ece4982d7 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.121.2.33 1998/03/16 22:52:28 brian Exp $ + * $Id: main.c,v 1.121.2.34 1998/03/16 22:53:11 brian Exp $ * * TODO: * o Add commands for traffic summary, version display, etc. @@ -60,6 +60,7 @@ #include "ccp.h" #include "iplist.h" #include "throughput.h" +#include "slcompress.h" #include "ipcp.h" #include "filter.h" #include "bundle.h" diff --git a/usr.sbin/ppp/modem.c b/usr.sbin/ppp/modem.c index 5cf46e652cab..81507913f791 100644 --- a/usr.sbin/ppp/modem.c +++ b/usr.sbin/ppp/modem.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: modem.c,v 1.77.2.35 1998/03/13 21:07:41 brian Exp $ + * $Id: modem.c,v 1.77.2.36 1998/03/16 22:52:32 brian Exp $ * * TODO: */ @@ -26,6 +26,8 @@ #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> +#include <netinet/in_systm.h> +#include <netinet/ip.h> #include <errno.h> #include <fcntl.h> @@ -60,6 +62,7 @@ #include "throughput.h" #include "async.h" #include "iplist.h" +#include "slcompress.h" #include "ipcp.h" #include "filter.h" #include "bundle.h" diff --git a/usr.sbin/ppp/pap.c b/usr.sbin/ppp/pap.c index 519d21d2c8ec..8eebd192900f 100644 --- a/usr.sbin/ppp/pap.c +++ b/usr.sbin/ppp/pap.c @@ -18,12 +18,14 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: pap.c,v 1.20.2.17 1998/03/13 21:07:42 brian Exp $ + * $Id: pap.c,v 1.20.2.18 1998/03/16 22:52:35 brian Exp $ * * TODO: */ #include <sys/param.h> #include <netinet/in.h> +#include <netinet/in_systm.h> +#include <netinet/ip.h> #include <pwd.h> #include <stdio.h> @@ -57,6 +59,7 @@ #include "descriptor.h" #include "physical.h" #include "iplist.h" +#include "slcompress.h" #include "ipcp.h" #include "filter.h" #include "bundle.h" diff --git a/usr.sbin/ppp/physical.c b/usr.sbin/ppp/physical.c index 08928fd77dec..2187be573b6b 100644 --- a/usr.sbin/ppp/physical.c +++ b/usr.sbin/ppp/physical.c @@ -16,11 +16,15 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: physical.c,v 1.1.2.16 1998/03/13 21:07:43 brian Exp $ + * $Id: physical.c,v 1.1.2.17 1998/03/16 22:52:38 brian Exp $ * */ #include <sys/param.h> +#include <netinet/in.h> +#include <netinet/in_systm.h> +#include <netinet/ip.h> + #include <sys/tty.h> #include <sys/uio.h> @@ -58,6 +62,7 @@ #include "vars.h" #include "iplist.h" +#include "slcompress.h" #include "ipcp.h" #include "filter.h" #include "bundle.h" diff --git a/usr.sbin/ppp/prompt.c b/usr.sbin/ppp/prompt.c index 7f4fcf007d82..55efde4c5849 100644 --- a/usr.sbin/ppp/prompt.c +++ b/usr.sbin/ppp/prompt.c @@ -23,11 +23,13 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: prompt.c,v 1.1.2.13 1998/03/16 22:52:48 brian Exp $ + * $Id: prompt.c,v 1.1.2.14 1998/03/16 22:53:15 brian Exp $ */ #include <sys/param.h> #include <netinet/in.h> +#include <netinet/in_systm.h> +#include <netinet/ip.h> #include <stdarg.h> #include <stdio.h> @@ -50,6 +52,7 @@ #include "main.h" #include "iplist.h" #include "throughput.h" +#include "slcompress.h" #include "ipcp.h" #include "filter.h" #include "bundle.h" diff --git a/usr.sbin/ppp/route.c b/usr.sbin/ppp/route.c index ec65627cb48a..c1c0a36fb57d 100644 --- a/usr.sbin/ppp/route.c +++ b/usr.sbin/ppp/route.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: route.c,v 1.42.2.10 1998/03/13 21:07:44 brian Exp $ + * $Id: route.c,v 1.42.2.11 1998/03/16 22:52:50 brian Exp $ * */ @@ -30,6 +30,8 @@ #include <netinet/in.h> #include <arpa/inet.h> #include <net/if_dl.h> +#include <netinet/in_systm.h> +#include <netinet/ip.h> #include <errno.h> #include <machine/endian.h> @@ -55,6 +57,7 @@ #include "hdlc.h" #include "link.h" #include "fsm.h" +#include "slcompress.h" #include "ipcp.h" #include "filter.h" #include "bundle.h" diff --git a/usr.sbin/ppp/slcompress.c b/usr.sbin/ppp/slcompress.c index 53ebbf563d28..7b0f92f031b3 100644 --- a/usr.sbin/ppp/slcompress.c +++ b/usr.sbin/ppp/slcompress.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: slcompress.c,v 1.15.2.1 1998/01/29 23:11:43 brian Exp $ + * $Id: slcompress.c,v 1.15.2.2 1998/02/10 03:23:42 brian Exp $ * * Van Jacobson (van@helios.ee.lbl.gov), Dec 31, 1989: * - Initial distribution. @@ -42,19 +42,13 @@ #include "vars.h" #include "descriptor.h" #include "prompt.h" - -static struct slstat { - int sls_packets; /* outbound packets */ - int sls_compressed; /* outbound compressed packets */ - int sls_searches; /* searches for connection state */ - int sls_misses; /* times couldn't find conn. state */ - int sls_uncompressedin; /* inbound uncompressed packets */ - int sls_compressedin; /* inbound compressed packets */ - int sls_errorin; /* inbound unknown type packets */ - int sls_tossed; /* inbound packets tossed because of error */ -} slstat; - -#define INCR(counter) slstat.counter++; +#include "timer.h" +#include "fsm.h" +#include "throughput.h" +#include "iplist.h" +#include "ipcp.h" +#include "filter.h" +#include "bundle.h" void sl_compress_init(struct slcompress * comp, int max_state) @@ -132,7 +126,8 @@ sl_compress_init(struct slcompress * comp, int max_state) u_char sl_compress_tcp(struct mbuf * m, struct ip * ip, - struct slcompress * comp, + struct slcompress *comp, + struct slstat *slstat, int compress_cid) { register struct cstate *cs = comp->last_cs->cs_next; @@ -169,10 +164,10 @@ sl_compress_tcp(struct mbuf * m, * it's most likely to be used again & we don't have to do any reordering * if it's used. */ - INCR(sls_packets) - if (ip->ip_src.s_addr != cs->cs_ip.ip_src.s_addr || - ip->ip_dst.s_addr != cs->cs_ip.ip_dst.s_addr || - *(int *) th != ((int *) &cs->cs_ip)[cs->cs_ip.ip_hl]) { + slstat->sls_packets++; + if (ip->ip_src.s_addr != cs->cs_ip.ip_src.s_addr || + ip->ip_dst.s_addr != cs->cs_ip.ip_dst.s_addr || + *(int *) th != ((int *) &cs->cs_ip)[cs->cs_ip.ip_hl]) { /* * Wasn't the first -- search for it. @@ -190,10 +185,10 @@ sl_compress_tcp(struct mbuf * m, do { lcs = cs; cs = cs->cs_next; - INCR(sls_searches) - if (ip->ip_src.s_addr == cs->cs_ip.ip_src.s_addr - && ip->ip_dst.s_addr == cs->cs_ip.ip_dst.s_addr - && *(int *) th == ((int *) &cs->cs_ip)[cs->cs_ip.ip_hl]) + slstat->sls_searches++; + if (ip->ip_src.s_addr == cs->cs_ip.ip_src.s_addr + && ip->ip_dst.s_addr == cs->cs_ip.ip_dst.s_addr + && *(int *) th == ((int *) &cs->cs_ip)[cs->cs_ip.ip_hl]) goto found; } while (cs != lastcs); @@ -204,7 +199,7 @@ sl_compress_tcp(struct mbuf * m, * state points to the newest and we only need to set last_cs to update * the lru linkage. */ - INCR(sls_misses) + slstat->sls_misses++; comp->last_cs = lcs; #define THOFFSET(th) (th->th_off) hlen += th->th_off; @@ -385,8 +380,8 @@ found: *cp++ = deltaA >> 8; *cp++ = deltaA; memcpy(cp, new_seq, deltaS); - INCR(sls_compressed) - return (TYPE_COMPRESSED_TCP); + slstat->sls_compressed++; + return (TYPE_COMPRESSED_TCP); /* * Update connection state cs & send uncompressed packet ('uncompressed' @@ -402,10 +397,8 @@ uncompressed: int -sl_uncompress_tcp(u_char ** bufp, - int len, - u_int type, - struct slcompress * comp) +sl_uncompress_tcp(u_char ** bufp, int len, u_int type, + struct slcompress *comp, struct slstat *slstat) { register u_char *cp; register u_int hlen, changes; @@ -437,8 +430,8 @@ sl_uncompress_tcp(u_char ** bufp, memcpy(&cs->cs_ip, ip, hlen); cs->cs_ip.ip_sum = 0; cs->cs_hlen = hlen; - INCR(sls_uncompressedin) - return (len); + slstat->sls_uncompressedin++; + return (len); default: goto bad; @@ -447,8 +440,8 @@ sl_uncompress_tcp(u_char ** bufp, break; } /* We've got a compressed packet. */ - INCR(sls_compressedin) - cp = *bufp; + slstat->sls_compressedin++; + cp = *bufp; changes = *cp++; LogPrintf(LogDEBUG, "compressed: changes = %02x\n", changes); if (changes & NEW_C) { @@ -470,8 +463,8 @@ sl_uncompress_tcp(u_char ** bufp, * the packet. */ if (comp->flags & SLF_TOSS) { - INCR(sls_tossed) - return (0); + slstat->sls_tossed++; + return (0); } } cs = &comp->rstate[comp->last_recv]; @@ -568,20 +561,25 @@ sl_uncompress_tcp(u_char ** bufp, return (len); bad: comp->flags |= SLF_TOSS; - INCR(sls_errorin) - return (0); + slstat->sls_errorin++; + return (0); } int ReportCompress(struct cmdargs const *arg) { - prompt_Printf(&prompt, "Out: %d (compress) / %d (total)", - slstat.sls_compressed, slstat.sls_packets); + prompt_Printf(&prompt, "VJ compression statistics:\n"); + prompt_Printf(&prompt, " Out: %d (compress) / %d (total)", + arg->bundle->ncp.ipcp.vj.slstat.sls_compressed, + arg->bundle->ncp.ipcp.vj.slstat.sls_packets); prompt_Printf(&prompt, " %d (miss) / %d (search)\n", - slstat.sls_misses, slstat.sls_searches); - prompt_Printf(&prompt, "In: %d (compress), %d (uncompress)", - slstat.sls_compressedin, slstat.sls_uncompressedin); + arg->bundle->ncp.ipcp.vj.slstat.sls_misses, + arg->bundle->ncp.ipcp.vj.slstat.sls_searches); + prompt_Printf(&prompt, " In: %d (compress), %d (uncompress)", + arg->bundle->ncp.ipcp.vj.slstat.sls_compressedin, + arg->bundle->ncp.ipcp.vj.slstat.sls_uncompressedin); prompt_Printf(&prompt, " %d (error), %d (tossed)\n", - slstat.sls_errorin, slstat.sls_tossed); + arg->bundle->ncp.ipcp.vj.slstat.sls_errorin, + arg->bundle->ncp.ipcp.vj.slstat.sls_tossed); return 0; } diff --git a/usr.sbin/ppp/slcompress.h b/usr.sbin/ppp/slcompress.h index 8cbafa015049..d4310960ad65 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.10.2.1 1998/01/29 23:11:44 brian Exp $ + * $Header: /home/ncvs/src/usr.sbin/ppp/slcompress.h,v 1.10.2.2 1998/02/21 01:45:25 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.10.2.1 1998/01/29 23:11:44 brian Exp $ + * $Id: slcompress.h,v 1.10.2.2 1998/02/21 01:45:25 brian Exp $ * * Van Jacobson (van@helios.ee.lbl.gov), Dec 31, 1989: * - Initial distribution. @@ -126,11 +126,23 @@ struct slcompress { struct cstate rstate[MAX_VJ_STATES]; /* receive connection states */ }; +struct slstat { + int sls_packets; /* outbound packets */ + int sls_compressed; /* outbound compressed packets */ + int sls_searches; /* searches for connection state */ + int sls_misses; /* times couldn't find conn. state */ + int sls_uncompressedin; /* inbound uncompressed packets */ + int sls_compressedin; /* inbound compressed packets */ + int sls_errorin; /* inbound unknown type packets */ + int sls_tossed; /* inbound packets tossed because of error */ +}; + /* flag values */ #define SLF_TOSS 1 /* tossing rcvd frames because of input err */ extern void sl_compress_init(struct slcompress *, int); -extern u_char sl_compress_tcp - (struct mbuf *, struct ip *, struct slcompress *, int); -extern int sl_uncompress_tcp(u_char **, int, u_int, struct slcompress *); +extern u_char sl_compress_tcp(struct mbuf *, struct ip *, struct slcompress *, + struct slstat *, int); +extern int sl_uncompress_tcp(u_char **, int, u_int, struct slcompress *, + struct slstat *); extern int ReportCompress(struct cmdargs const *); diff --git a/usr.sbin/ppp/tun.c b/usr.sbin/ppp/tun.c index 5dfc2c88afed..dc6a263029ba 100644 --- a/usr.sbin/ppp/tun.c +++ b/usr.sbin/ppp/tun.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: tun.c,v 1.6.4.6 1998/03/13 21:07:45 brian Exp $ + * $Id: tun.c,v 1.6.4.7 1998/03/16 22:52:52 brian Exp $ */ #include <sys/param.h> @@ -33,6 +33,8 @@ #include <net/if.h> #include <sys/select.h> #include <net/if_tun.h> +#include <netinet/in_systm.h> +#include <netinet/ip.h> #include <stdio.h> #include <string.h> @@ -51,6 +53,7 @@ #include "fsm.h" #include "throughput.h" #include "iplist.h" +#include "slcompress.h" #include "ipcp.h" #include "filter.h" #include "bundle.h" diff --git a/usr.sbin/ppp/vjcomp.c b/usr.sbin/ppp/vjcomp.c index 42d7d8e41d06..a1137f4b338c 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.16.2.7 1998/03/13 21:07:46 brian Exp $ + * $Id: vjcomp.c,v 1.16.2.8 1998/03/16 22:52:54 brian Exp $ * * TODO: */ @@ -51,14 +51,6 @@ #define MAX_VJHEADER 16 /* Maximum size of compressed header */ -static struct slcompress cslc; - -void -VjInit(int max_state) -{ - sl_compress_init(&cslc, max_state); -} - void SendPppFrame(struct link *l, struct mbuf * bp, struct bundle *bundle) { @@ -71,7 +63,9 @@ SendPppFrame(struct link *l, struct mbuf * bp, struct bundle *bundle) bundle->ncp.ipcp.peer_compproto); if (((struct ip *) MBUF_CTOP(bp))->ip_p == IPPROTO_TCP && cproto == PROTO_VJCOMP) { - type = sl_compress_tcp(bp, (struct ip *)MBUF_CTOP(bp), &cslc, + type = sl_compress_tcp(bp, (struct ip *)MBUF_CTOP(bp), + &bundle->ncp.ipcp.vj.cslc, + &bundle->ncp.ipcp.vj.slstat, bundle->ncp.ipcp.peer_compproto & 0xff); LogPrintf(LogDEBUG, "SendPppFrame: type = %x\n", type); switch (type) { @@ -97,7 +91,7 @@ SendPppFrame(struct link *l, struct mbuf * bp, struct bundle *bundle) } static struct mbuf * -VjUncompressTcp(struct mbuf * bp, u_char type) +VjUncompressTcp(struct ipcp *ipcp, struct mbuf * bp, u_char type) { u_char *bufp; int len, olen, rlen; @@ -112,7 +106,7 @@ VjUncompressTcp(struct mbuf * bp, u_char type) * space for uncompression job. */ bufp = MBUF_CTOP(bp); - len = sl_uncompress_tcp(&bufp, len, type, &cslc); + len = sl_uncompress_tcp(&bufp, len, type, &ipcp->vj.cslc, &ipcp->vj.slstat); if (len <= 0) { pfree(bp); bp = NULL; @@ -130,7 +124,7 @@ VjUncompressTcp(struct mbuf * bp, u_char type) rlen = len; bufp = work + MAX_HDR; bp = mbread(bp, bufp, rlen); - len = sl_uncompress_tcp(&bufp, olen, type, &cslc); + len = sl_uncompress_tcp(&bufp, olen, type, &ipcp->vj.cslc, &ipcp->vj.slstat); if (len <= 0) { pfree(bp); return NULL; @@ -144,7 +138,7 @@ VjUncompressTcp(struct mbuf * bp, u_char type) } struct mbuf * -VjCompInput(struct mbuf * bp, int proto) +VjCompInput(struct ipcp *ipcp, struct mbuf *bp, int proto) { u_char type; @@ -162,7 +156,7 @@ VjCompInput(struct mbuf * bp, int proto) LogPrintf(LogERROR, "VjCompInput...???\n"); return (bp); } - bp = VjUncompressTcp(bp, type); + bp = VjUncompressTcp(ipcp, bp, type); return (bp); } diff --git a/usr.sbin/ppp/vjcomp.h b/usr.sbin/ppp/vjcomp.h index 28689cc47847..360971b91431 100644 --- a/usr.sbin/ppp/vjcomp.h +++ b/usr.sbin/ppp/vjcomp.h @@ -23,10 +23,9 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: vjcomp.h,v 1.5.4.2 1998/01/30 19:46:07 brian Exp $ + * $Id: vjcomp.h,v 1.5.4.3 1998/02/23 00:38:44 brian Exp $ */ -extern void VjInit(int); extern void SendPppFrame(struct link *, struct mbuf *, struct bundle *); -extern struct mbuf *VjCompInput(struct mbuf *, int); +extern struct mbuf *VjCompInput(struct ipcp *, struct mbuf *, int); extern const char *vj2asc(u_int32_t); |