From 21cdaec64fc3385795f4318fdf2358f503ec26ba Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Tue, 8 Oct 1996 04:38:08 +0000 Subject: [PATCH] fix for freebsd --- chat/Makefile.bsd | 4 +- common/zlib.c | 7 +- configure | 6 +- freebsd-2.0/if_ppp.c | 4 +- freebsd-2.0/if_pppvar.h | 4 +- freebsd-2.0/kinstall.sh | 2 +- freebsd-2.0/ppp_defs.h | 150 +++++++++++++++++++++++++++++++++++++++ netbsd-1.1/ppp-deflate.c | 6 +- pppd/Makefile.bsd | 5 +- pppstats/Makefile.bsd | 6 +- 10 files changed, 175 insertions(+), 19 deletions(-) create mode 100644 freebsd-2.0/ppp_defs.h diff --git a/chat/Makefile.bsd b/chat/Makefile.bsd index d299d9a..5006338 100644 --- a/chat/Makefile.bsd +++ b/chat/Makefile.bsd @@ -1,8 +1,8 @@ -# $Id: Makefile.bsd,v 1.3 1995/04/28 06:21:15 paulus Exp $ +# $Id: Makefile.bsd,v 1.4 1996/10/08 04:37:59 paulus Exp $ PROG= chat SRCS= chat.c -MAN8= chat.0 +MAN8= chat.8 MAN= chat.cat8 BINDIR= /usr/sbin diff --git a/common/zlib.c b/common/zlib.c index 4a518e2..e9dc177 100644 --- a/common/zlib.c +++ b/common/zlib.c @@ -11,7 +11,7 @@ * - added Z_PACKET_FLUSH (see zlib.h for details) * - added inflateIncomp * - * $Id: zlib.c,v 1.3 1996/09/26 06:29:43 paulus Exp $ + * $Id: zlib.c,v 1.4 1996/10/08 04:38:00 paulus Exp $ */ /* @@ -88,12 +88,15 @@ extern char *z_errmsg[]; /* indexed by 1-zlib_error */ /* functions */ #if defined(KERNEL) || defined(_KERNEL) -/* Assume we're not being compiled under Linux */ #include #include # define zmemcpy(d, s, n) bcopy((s), (d), (n)) # define zmemzero bzero +#ifdef FreeBSD +#define inflate inflate_ppp +#endif + #else #if defined(__KERNEL__) /* Assume this is Linux */ diff --git a/configure b/configure index 90c76d2..3b2bb80 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #!/bin/sh -# $Id: configure,v 1.11 1996/09/26 06:15:36 paulus Exp $ +# $Id: configure,v 1.12 1996/10/08 04:36:56 paulus Exp $ if [ -d /NextApps ]; then system="NeXTStep" @@ -47,8 +47,8 @@ case $system in makext="bsd"; case $release in 1.*) state="known"; ksrc="freebsd-old";; - 2.0*) state="known"; ksrc="freebsd-2.0";; - 2.[1-9]*) state="late"; ksrc="freebsd-2.0";; + 2.[01]*) state="known"; ksrc="freebsd-2.0";; + 2.[2-9]*) state="late"; ksrc="freebsd-2.0";; esac;; NeXTStep) makext="NeXT"; diff --git a/freebsd-2.0/if_ppp.c b/freebsd-2.0/if_ppp.c index f540a9b..4388646 100644 --- a/freebsd-2.0/if_ppp.c +++ b/freebsd-2.0/if_ppp.c @@ -69,7 +69,7 @@ * Paul Mackerras (paulus@cs.anu.edu.au). */ -/* $Id: if_ppp.c,v 1.9 1996/09/26 06:24:39 paulus Exp $ */ +/* $Id: if_ppp.c,v 1.10 1996/10/08 04:38:03 paulus Exp $ */ /* from if_sl.c,v 1.11 84/10/04 12:54:47 rick Exp */ /* from NetBSD: if_ppp.c,v 1.15.2.2 1994/07/28 05:17:58 cgd Exp */ @@ -234,7 +234,7 @@ pppalloc(pid) sc->sc_relinq = NULL; bzero((char *)&sc->sc_stats, sizeof(sc->sc_stats)); #ifdef VJC - MALLOC(sc->sc_comp, struct slcompress *, sizeof(struct slcompress), + MALLOC(sc->sc_comp, struct vjcompress *, sizeof(struct vjcompress), M_DEVBUF, M_NOWAIT); if (sc->sc_comp) vj_compress_init(sc->sc_comp, -1); diff --git a/freebsd-2.0/if_pppvar.h b/freebsd-2.0/if_pppvar.h index 4673334..22a5e4c 100644 --- a/freebsd-2.0/if_pppvar.h +++ b/freebsd-2.0/if_pppvar.h @@ -1,4 +1,4 @@ -/* $Id: if_pppvar.h,v 1.2 1996/07/01 01:00:28 paulus Exp $ */ +/* $Id: if_pppvar.h,v 1.3 1996/10/08 04:38:03 paulus Exp $ */ /* * if_pppvar.h - private structures and declarations for PPP. * @@ -76,7 +76,7 @@ struct ppp_softc { time_t sc_last_sent; /* time (secs) last NP pkt sent */ time_t sc_last_recv; /* time (secs) last NP pkt rcvd */ #ifdef VJC - struct slcompress *sc_comp; /* vjc control buffer */ + struct vjcompress *sc_comp; /* vjc control buffer */ #endif /* Device-dependent part for async lines. */ diff --git a/freebsd-2.0/kinstall.sh b/freebsd-2.0/kinstall.sh index bb0d88a..ae90a05 100755 --- a/freebsd-2.0/kinstall.sh +++ b/freebsd-2.0/kinstall.sh @@ -16,7 +16,7 @@ CONFIG=config # Copy new versions of files into /sys/net -for f in net/if_ppp.h net/ppp-comp.h net/ppp_defs.h $SRC/bsd-comp.c \ +for f in net/if_ppp.h net/ppp-comp.h $SRC/ppp_defs.h $SRC/bsd-comp.c \ $SRC/ppp-deflate.c $SRC/if_ppp.c $SRC/if_pppvar.h $SRC/ppp_tty.c \ $SRC/pppcompress.c $SRC/pppcompress.h common/zlib.c common/zlib.h; do dest=$SYS/net/$(basename $f) diff --git a/freebsd-2.0/ppp_defs.h b/freebsd-2.0/ppp_defs.h new file mode 100644 index 0000000..41d7e86 --- /dev/null +++ b/freebsd-2.0/ppp_defs.h @@ -0,0 +1,150 @@ +/* $Id: ppp_defs.h,v 1.1 1996/10/08 04:38:04 paulus Exp $ */ + +/* + * ppp_defs.h - PPP definitions. + * + * Copyright (c) 1994 The Australian National University. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation is hereby granted, provided that the above copyright + * notice appears in all copies. This software is provided without any + * warranty, express or implied. The Australian National University + * makes no representations about the suitability of this software for + * any purpose. + * + * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY + * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF + * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO + * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, + * OR MODIFICATIONS. + */ + +#ifndef _PPP_DEFS_H_ +#define _PPP_DEFS_H_ + +/* + * The basic PPP frame. + */ +#define PPP_HDRLEN 4 /* octets for standard ppp header */ +#define PPP_FCSLEN 2 /* octets for FCS */ +#define PPP_MRU 1500 /* default MRU = max length of info field */ + +#define PPP_ADDRESS(p) (((u_char *)(p))[0]) +#define PPP_CONTROL(p) (((u_char *)(p))[1]) +#define PPP_PROTOCOL(p) ((((u_char *)(p))[2] << 8) + ((u_char *)(p))[3]) + +/* + * Significant octet values. + */ +#define PPP_ALLSTATIONS 0xff /* All-Stations broadcast address */ +#define PPP_UI 0x03 /* Unnumbered Information */ +#define PPP_FLAG 0x7e /* Flag Sequence */ +#define PPP_ESCAPE 0x7d /* Asynchronous Control Escape */ +#define PPP_TRANS 0x20 /* Asynchronous transparency modifier */ + +/* + * Protocol field values. + */ +#define PPP_IP 0x21 /* Internet Protocol */ +#define PPP_VJC_COMP 0x2d /* VJ compressed TCP */ +#define PPP_VJC_UNCOMP 0x2f /* VJ uncompressed TCP */ +#define PPP_COMP 0xfd /* compressed packet */ +#define PPP_IPCP 0x8021 /* IP Control Protocol */ +#define PPP_CCP 0x80fd /* Compression Control Protocol */ +#define PPP_LCP 0xc021 /* Link Control Protocol */ +#define PPP_PAP 0xc023 /* Password Authentication Protocol */ +#define PPP_LQR 0xc025 /* Link Quality Report protocol */ +#define PPP_CHAP 0xc223 /* Cryptographic Handshake Auth. Protocol */ +#define PPP_CBCP 0xc029 /* Callback Control Protocol */ + +/* + * Values for FCS calculations. + */ +#define PPP_INITFCS 0xffff /* Initial FCS value */ +#define PPP_GOODFCS 0xf0b8 /* Good final FCS value */ +#define PPP_FCS(fcs, c) (((fcs) >> 8) ^ fcstab[((fcs) ^ (c)) & 0xff]) + +/* + * Extended asyncmap - allows any character to be escaped. + */ +typedef u_int32_t ext_accm[8]; + +/* + * What to do with network protocol (NP) packets. + */ +enum NPmode { + NPMODE_PASS, /* pass the packet through */ + NPMODE_DROP, /* silently drop the packet */ + NPMODE_ERROR, /* return an error */ + NPMODE_QUEUE /* save it up for later. */ +}; + +/* + * Statistics. + */ +struct pppstat { + unsigned int ppp_ibytes; /* bytes received */ + unsigned int ppp_ipackets; /* packets received */ + unsigned int ppp_ierrors; /* receive errors */ + unsigned int ppp_obytes; /* bytes sent */ + unsigned int ppp_opackets; /* packets sent */ + unsigned int ppp_oerrors; /* transmit errors */ +}; + +struct vjstat { + unsigned int vjs_packets; /* outbound packets */ + unsigned int vjs_compressed; /* outbound compressed packets */ + unsigned int vjs_searches; /* searches for connection state */ + unsigned int vjs_misses; /* times couldn't find conn. state */ + unsigned int vjs_uncompressedin; /* inbound uncompressed packets */ + unsigned int vjs_compressedin; /* inbound compressed packets */ + unsigned int vjs_errorin; /* inbound unknown type packets */ + unsigned int vjs_tossed; /* inbound packets tossed because of error */ +}; + +struct ppp_stats { + struct pppstat p; /* basic PPP statistics */ + struct vjstat vj; /* VJ header compression statistics */ +}; + +struct compstat { + unsigned int unc_bytes; /* total uncompressed bytes */ + unsigned int unc_packets; /* total uncompressed packets */ + unsigned int comp_bytes; /* compressed bytes */ + unsigned int comp_packets; /* compressed packets */ + unsigned int inc_bytes; /* incompressible bytes */ + unsigned int inc_packets; /* incompressible packets */ + unsigned int ratio; /* recent compression ratio << 8 */ +}; + +struct ppp_comp_stats { + struct compstat c; /* packet compression statistics */ + struct compstat d; /* packet decompression statistics */ +}; + +/* + * The following structure records the time in seconds since + * the last NP packet was sent or received. + */ +struct ppp_idle { + time_t xmit_idle; /* time since last NP packet sent */ + time_t recv_idle; /* time since last NP packet received */ +}; + +#ifndef __P +#ifdef __STDC__ +#define __P(x) x +#else +#define __P(x) () +#endif +#endif + +#endif /* _PPP_DEFS_H_ */ diff --git a/netbsd-1.1/ppp-deflate.c b/netbsd-1.1/ppp-deflate.c index 5092e9a..6470235 100644 --- a/netbsd-1.1/ppp-deflate.c +++ b/netbsd-1.1/ppp-deflate.c @@ -1,4 +1,4 @@ -/* $Id: ppp-deflate.c,v 1.3 1996/08/28 06:37:09 paulus Exp $ */ +/* $Id: ppp-deflate.c,v 1.4 1996/10/08 04:38:06 paulus Exp $ */ /* * ppp_deflate.c - interface the zlib procedures for Deflate compression @@ -41,6 +41,10 @@ #if DO_DEFLATE +#ifdef FreeBSD +#define inflate inflate_ppp /* FreeBSD already has an inflate :-( */ +#endif + #define DEFLATE_DEBUG 1 /* diff --git a/pppd/Makefile.bsd b/pppd/Makefile.bsd index a1aab1f..a1f6b84 100644 --- a/pppd/Makefile.bsd +++ b/pppd/Makefile.bsd @@ -1,4 +1,4 @@ -# $Id: Makefile.bsd,v 1.12 1996/08/28 06:37:41 paulus Exp $ +# $Id: Makefile.bsd,v 1.13 1996/10/08 04:33:33 paulus Exp $ BINDIR?= /usr/sbin # -D_BITYPES is for FreeBSD, which doesn't define anything to @@ -10,8 +10,7 @@ PROG= pppd SRCS= main.c magic.c fsm.c lcp.c ipcp.c upap.c chap.c md5.c ccp.c \ demand.c auth.c options.c sys-bsd.c MAN= pppd.cat8 -# The next line is for NetBSD-1.0 and other older *BSD systems. -MAN8= pppd.0 +MAN8= pppd.8 BINMODE=4555 BINOWN= root diff --git a/pppstats/Makefile.bsd b/pppstats/Makefile.bsd index e1fe4a2..ef61364 100644 --- a/pppstats/Makefile.bsd +++ b/pppstats/Makefile.bsd @@ -1,9 +1,9 @@ -# $Id: Makefile.bsd,v 1.4 1995/04/28 06:23:18 paulus Exp $ +# $Id: Makefile.bsd,v 1.5 1996/10/08 04:38:08 paulus Exp $ PROG= pppstats SRCS= pppstats.c -CFLAGS+=-I.. -MAN8= pppstats.0 +CFLAGS+=-I.. -D_BITYPES +MAN8= pppstats.8 MAN= pppstats.cat8 BINDIR= /usr/sbin -- 2.39.2