This commit was manufactured by cvs2svn to create branch 'MACKERRAS'.
This commit is contained in:
parent
3c8817d4b7
commit
d0ef3f5136
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/vendor/pppd/dist/; revision=11968
1114
sys/net/bsd_comp.c
Normal file
1114
sys/net/bsd_comp.c
Normal file
File diff suppressed because it is too large
Load Diff
104
sys/net/if_pppvar.h
Normal file
104
sys/net/if_pppvar.h
Normal file
@ -0,0 +1,104 @@
|
||||
/* $Id: if_pppvar.h,v 1.1 1994/12/15 22:28:09 paulus Exp $ */
|
||||
/*
|
||||
* if_pppvar.h - private structures and declarations for PPP.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Copyright (c) 1989 Carnegie Mellon University.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
* advertising materials, and other materials related to such
|
||||
* distribution and use acknowledge that the software was developed
|
||||
* by Carnegie Mellon University. The name of the
|
||||
* University may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Supported network protocols. These values are used for
|
||||
* indexing sc_npmode.
|
||||
*/
|
||||
#define NP_IP 0 /* Internet Protocol */
|
||||
#define NUM_NP 1 /* Number of NPs. */
|
||||
|
||||
/*
|
||||
* Structure describing each ppp unit.
|
||||
*/
|
||||
struct ppp_softc {
|
||||
struct ifnet sc_if; /* network-visible interface */
|
||||
u_int sc_flags; /* control/status bits; see if_ppp.h */
|
||||
void *sc_devp; /* pointer to device-dep structure */
|
||||
void (*sc_start) __P((struct ppp_softc *)); /* start output proc */
|
||||
void (*sc_ctlp) __P((struct ppp_softc *)); /* rcvd control pkt */
|
||||
void (*sc_relinq) __P((struct ppp_softc *)); /* relinquish ifunit */
|
||||
short sc_mru; /* max receive unit */
|
||||
pid_t sc_xfer; /* used in transferring unit */
|
||||
struct ifqueue sc_rawq; /* received packets */
|
||||
struct ifqueue sc_inq; /* queue of input packets for daemon */
|
||||
struct ifqueue sc_fastq; /* interactive output packet q */
|
||||
struct mbuf *sc_togo; /* output packet ready to go */
|
||||
struct mbuf *sc_npqueue; /* output packets not to be sent yet */
|
||||
struct mbuf **sc_npqtail; /* ptr to last next ptr in npqueue */
|
||||
#ifdef VJC
|
||||
struct vjcompress sc_comp; /* vjc control buffer */
|
||||
#endif
|
||||
u_int sc_bytessent; /* count of octets sent */
|
||||
u_int sc_bytesrcvd; /* count of octets received */
|
||||
caddr_t sc_bpf; /* hook for BPF */
|
||||
enum NPmode sc_npmode[NUM_NP]; /* what to do with each NP */
|
||||
struct compressor *sc_xcomp; /* transmit compressor */
|
||||
void *sc_xc_state; /* transmit compressor state */
|
||||
struct compressor *sc_rcomp; /* receive decompressor */
|
||||
void *sc_rc_state; /* receive decompressor state */
|
||||
time_t sc_last_sent; /* time (secs) last NP pkt sent */
|
||||
time_t sc_last_recv; /* time (secs) last NP pkt rcvd */
|
||||
|
||||
/* Device-dependent part for async lines. */
|
||||
ext_accm sc_asyncmap; /* async control character map */
|
||||
u_long sc_rasyncmap; /* receive async control char map */
|
||||
struct mbuf *sc_outm; /* mbuf chain currently being output */
|
||||
struct mbuf *sc_m; /* pointer to input mbuf chain */
|
||||
struct mbuf *sc_mc; /* pointer to current input mbuf */
|
||||
char *sc_mp; /* ptr to next char in input mbuf */
|
||||
short sc_ilen; /* length of input packet so far */
|
||||
u_short sc_fcs; /* FCS so far (input) */
|
||||
u_short sc_outfcs; /* FCS so far for output packet */
|
||||
u_char sc_rawin[16]; /* chars as received */
|
||||
int sc_rawin_count; /* # in sc_rawin */
|
||||
};
|
||||
|
||||
struct ppp_softc ppp_softc[NPPP];
|
||||
|
||||
struct ppp_softc *pppalloc __P((pid_t pid));
|
||||
void pppdealloc __P((struct ppp_softc *sc));
|
||||
int pppioctl __P((struct ppp_softc *sc, int cmd, caddr_t data,
|
||||
int flag, struct proc *p));
|
||||
void ppppktin __P((struct ppp_softc *sc, struct mbuf *m, int lost));
|
||||
struct mbuf *ppp_dequeue __P((struct ppp_softc *sc));
|
136
sys/net/ppp_comp.h
Normal file
136
sys/net/ppp_comp.h
Normal file
@ -0,0 +1,136 @@
|
||||
/*
|
||||
* ppp-comp.h - Definitions for doing PPP packet compression.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* $Id: ppp-comp.h,v 1.7 1995/05/01 01:43:37 paulus Exp $
|
||||
*/
|
||||
|
||||
#ifndef _NET_PPP_COMP_H
|
||||
#define _NET_PPP_COMP_H
|
||||
|
||||
/*
|
||||
* The following symbols control whether we include code for
|
||||
* various compression methods.
|
||||
*/
|
||||
#ifndef DO_BSD_COMPRESS
|
||||
#define DO_BSD_COMPRESS 1 /* by default, include BSD-Compress */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Structure giving methods for compression/decompression.
|
||||
*/
|
||||
#ifdef PACKETPTR
|
||||
struct compressor {
|
||||
int compress_proto; /* CCP compression protocol number */
|
||||
|
||||
/* Allocate space for a compressor (transmit side) */
|
||||
void *(*comp_alloc) __P((u_char *options, int opt_len));
|
||||
/* Free space used by a compressor */
|
||||
void (*comp_free) __P((void *state));
|
||||
/* Initialize a compressor */
|
||||
int (*comp_init) __P((void *state, u_char *options, int opt_len,
|
||||
int unit, int hdrlen, int debug));
|
||||
/* Reset a compressor */
|
||||
void (*comp_reset) __P((void *state));
|
||||
/* Compress a packet */
|
||||
int (*compress) __P((void *state, PACKETPTR *mret,
|
||||
PACKETPTR mp, int orig_len, int max_len));
|
||||
/* Return compression statistics */
|
||||
void (*comp_stat) __P((void *state, struct compstat *stats));
|
||||
|
||||
/* Allocate space for a decompressor (receive side) */
|
||||
void *(*decomp_alloc) __P((u_char *options, int opt_len));
|
||||
/* Free space used by a decompressor */
|
||||
void (*decomp_free) __P((void *state));
|
||||
/* Initialize a decompressor */
|
||||
int (*decomp_init) __P((void *state, u_char *options, int opt_len,
|
||||
int unit, int hdrlen, int mru, int debug));
|
||||
/* Reset a decompressor */
|
||||
void (*decomp_reset) __P((void *state));
|
||||
/* Decompress a packet. */
|
||||
int (*decompress) __P((void *state, PACKETPTR mp,
|
||||
PACKETPTR *dmpp));
|
||||
/* Update state for an incompressible packet received */
|
||||
void (*incomp) __P((void *state, PACKETPTR mp));
|
||||
/* Return decompression statistics */
|
||||
void (*decomp_stat) __P((void *state, struct compstat *stats));
|
||||
};
|
||||
#endif /* PACKETPTR */
|
||||
|
||||
/*
|
||||
* Return values for decompress routine.
|
||||
* We need to make these distinctions so that we can disable certain
|
||||
* useful functionality, namely sending a CCP reset-request as a result
|
||||
* of an error detected after decompression. This is to avoid infringing
|
||||
* a patent held by Motorola.
|
||||
* Don't you just lurve software patents.
|
||||
*/
|
||||
#define DECOMP_OK 0 /* everything went OK */
|
||||
#define DECOMP_ERROR 1 /* error detected before decomp. */
|
||||
#define DECOMP_FATALERROR 2 /* error detected after decomp. */
|
||||
|
||||
/*
|
||||
* CCP codes.
|
||||
*/
|
||||
#define CCP_CONFREQ 1
|
||||
#define CCP_CONFACK 2
|
||||
#define CCP_TERMREQ 5
|
||||
#define CCP_TERMACK 6
|
||||
#define CCP_RESETREQ 14
|
||||
#define CCP_RESETACK 15
|
||||
|
||||
/*
|
||||
* Max # bytes for a CCP option
|
||||
*/
|
||||
#define CCP_MAX_OPTION_LENGTH 32
|
||||
|
||||
/*
|
||||
* Parts of a CCP packet.
|
||||
*/
|
||||
#define CCP_CODE(dp) ((dp)[0])
|
||||
#define CCP_ID(dp) ((dp)[1])
|
||||
#define CCP_LENGTH(dp) (((dp)[2] << 8) + (dp)[3])
|
||||
#define CCP_HDRLEN 4
|
||||
|
||||
#define CCP_OPT_CODE(dp) ((dp)[0])
|
||||
#define CCP_OPT_LENGTH(dp) ((dp)[1])
|
||||
#define CCP_OPT_MINLEN 2
|
||||
|
||||
/*
|
||||
* Definitions for BSD-Compress.
|
||||
*/
|
||||
#define CI_BSD_COMPRESS 21 /* config. option for BSD-Compress */
|
||||
#define CILEN_BSD_COMPRESS 3 /* length of config. option */
|
||||
|
||||
/* Macros for handling the 3rd byte of the BSD-Compress config option. */
|
||||
#define BSD_NBITS(x) ((x) & 0x1F) /* number of bits requested */
|
||||
#define BSD_VERSION(x) ((x) >> 5) /* version of option format */
|
||||
#define BSD_CURRENT_VERSION 1 /* current version number */
|
||||
#define BSD_MAKE_OPT(v, n) (((v) << 5) | (n))
|
||||
|
||||
#define BSD_MIN_BITS 9 /* smallest code size supported */
|
||||
#define BSD_MAX_BITS 15 /* largest code size supported */
|
||||
|
||||
#endif /* _NET_PPP_COMP_H */
|
160
sys/net/ppp_defs.h
Normal file
160
sys/net/ppp_defs.h
Normal file
@ -0,0 +1,160 @@
|
||||
/* $Id: ppp_defs.h,v 1.7 1995/08/10 06:49:35 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 */
|
||||
|
||||
/*
|
||||
* 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])
|
||||
|
||||
/*
|
||||
* A 32-bit unsigned integral type.
|
||||
*/
|
||||
#if !defined(__BIT_TYPES_DEFINED__) && !defined(_BITYPES)
|
||||
#ifdef UINT32_T
|
||||
typedef UINT32_T u_int32_t;
|
||||
#else
|
||||
typedef unsigned int u_int32_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 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 {
|
||||
u_int ppp_ibytes; /* bytes received */
|
||||
u_int ppp_ipackets; /* packets received */
|
||||
u_int ppp_ierrors; /* receive errors */
|
||||
u_int ppp_obytes; /* bytes sent */
|
||||
u_int ppp_opackets; /* packets sent */
|
||||
u_int ppp_oerrors; /* transmit errors */
|
||||
};
|
||||
|
||||
struct vjstat {
|
||||
u_int vjs_packets; /* outbound packets */
|
||||
u_int vjs_compressed; /* outbound compressed packets */
|
||||
u_int vjs_searches; /* searches for connection state */
|
||||
u_int vjs_misses; /* times couldn't find conn. state */
|
||||
u_int vjs_uncompressedin; /* inbound uncompressed packets */
|
||||
u_int vjs_compressedin; /* inbound compressed packets */
|
||||
u_int vjs_errorin; /* inbound unknown type packets */
|
||||
u_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 {
|
||||
u_int unc_bytes; /* total uncompressed bytes */
|
||||
u_int unc_packets; /* total uncompressed packets */
|
||||
u_int comp_bytes; /* compressed bytes */
|
||||
u_int comp_packets; /* compressed packets */
|
||||
u_int inc_bytes; /* incompressible bytes */
|
||||
u_int inc_packets; /* incompressible packets */
|
||||
u_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_ */
|
1026
sys/net/ppp_tty.c
Normal file
1026
sys/net/ppp_tty.c
Normal file
File diff suppressed because it is too large
Load Diff
14
usr.sbin/pppd/Makefile
Normal file
14
usr.sbin/pppd/Makefile
Normal file
@ -0,0 +1,14 @@
|
||||
# From: Id: Makefile.bsd,v 1.4 1994/04/20 00:07:50 paulus Exp
|
||||
# $Id$
|
||||
|
||||
PROG= pppd
|
||||
SRCS= main.c magic.c fsm.c lcp.c ipcp.c upap.c chap.c md5.c \
|
||||
auth.c options.c lock.c sys-bsd.c
|
||||
MAN8= pppd.8
|
||||
BINMODE=4555
|
||||
BINOWN= root
|
||||
|
||||
LDADD= -lcrypt -lutil
|
||||
DPADD= ${LIBCRYPT} ${LIBUTIL}
|
||||
|
||||
.include <bsd.prog.mk>
|
Loading…
Reference in New Issue
Block a user