From: Paul Mackerras Date: Tue, 9 Aug 1994 06:29:14 +0000 (+0000) Subject: add support for CCP and BSD-Compress X-Git-Tag: RELEASE_2_3_6~908 X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=commitdiff_plain;h=829ce3a1b544753fc086c75b57d779839adfa545 add support for CCP and BSD-Compress --- diff --git a/pppd/auth.c b/pppd/auth.c index 950ef02..a8e5004 100644 --- a/pppd/auth.c +++ b/pppd/auth.c @@ -33,7 +33,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: auth.c,v 1.6 1994/05/25 06:25:05 paulus Exp $"; +static char rcsid[] = "$Id: auth.c,v 1.7 1994/08/09 06:29:14 paulus Exp $"; #endif #include @@ -55,6 +55,7 @@ static char rcsid[] = "$Id: auth.c,v 1.6 1994/05/25 06:25:05 paulus Exp $"; #include "upap.h" #include "chap.h" #include "ipcp.h" +#include "ccp.h" #include "pathnames.h" #ifdef sparc @@ -100,6 +101,7 @@ static struct wordlist *addresses[NPPP]; /* Prototypes */ void check_access __ARGS((FILE *, char *)); +static void network_phase __ARGS((int)); static int login __ARGS((char *, char *, char **, int *)); static void logout __ARGS((void)); static int null_login __ARGS((int)); @@ -130,6 +132,8 @@ void link_terminated(unit) int unit; { + if (phase == PHASE_DEAD) + return; if (logged_in) logout(); phase = PHASE_DEAD; @@ -143,6 +147,8 @@ void link_down(unit) int unit; { + ipcp_close(0); + ccp_close(0); phase = PHASE_TERMINATE; } @@ -191,10 +197,20 @@ link_established(unit) } auth_pending[unit] = auth; - if (!auth) { - phase = PHASE_NETWORK; - ipcp_open(unit); - } + if (!auth) + network_phase(unit); +} + +/* + * Proceed to the network phase. + */ +static void +network_phase(unit) + int unit; +{ + phase = PHASE_NETWORK; + ipcp_open(unit); + ccp_open(unit); } /* @@ -240,6 +256,7 @@ auth_peer_success(unit, protocol) if ((auth_pending[unit] &= ~bit) == 0) { phase = PHASE_NETWORK; ipcp_open(unit); + ccp_open(unit); } } @@ -283,10 +300,8 @@ auth_withpeer_success(unit, protocol) * If there is no more authentication still being done, * proceed to the network phase. */ - if ((auth_pending[unit] &= ~bit) == 0) { - phase = PHASE_NETWORK; - ipcp_open(unit); - } + if ((auth_pending[unit] &= ~bit) == 0) + network_phase(unit); } diff --git a/pppd/lcp.c b/pppd/lcp.c index 62c8064..cd29c09 100644 --- a/pppd/lcp.c +++ b/pppd/lcp.c @@ -18,7 +18,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: lcp.c,v 1.10 1994/08/09 06:24:59 paulus Exp $"; +static char rcsid[] = "$Id: lcp.c,v 1.11 1994/08/09 06:29:14 paulus Exp $"; #endif /* @@ -1286,6 +1286,7 @@ lcp_up(f) ChapLowerUp(f->unit); /* Enable CHAP */ upap_lowerup(f->unit); /* Enable UPAP */ ipcp_lowerup(f->unit); /* Enable IPCP */ + ccp_lowerup(f->unit); /* Enable CCP */ lcp_echo_lowerup(f->unit); /* Enable echo messages */ link_established(f->unit); @@ -1302,6 +1303,7 @@ lcp_down(f) fsm *f; { lcp_echo_lowerdown(f->unit); + ccp_lowerdown(f->unit); ipcp_lowerdown(f->unit); ChapLowerDown(f->unit); upap_lowerdown(f->unit); diff --git a/pppd/options.c b/pppd/options.c index ef1fc8a..d58c850 100644 --- a/pppd/options.c +++ b/pppd/options.c @@ -18,7 +18,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: options.c,v 1.10 1994/05/27 00:43:34 paulus Exp $"; +static char rcsid[] = "$Id: options.c,v 1.11 1994/08/09 06:29:14 paulus Exp $"; #endif #include @@ -44,6 +44,7 @@ static char rcsid[] = "$Id: options.c,v 1.10 1994/05/27 00:43:34 paulus Exp $"; #include "ipcp.h" #include "upap.h" #include "chap.h" +#include "ccp.h" #define FALSE 0 #define TRUE 1 @@ -121,6 +122,8 @@ static int setipcpaccl __ARGS((void)); static int setipcpaccr __ARGS((void)); static int setlcpechointv __ARGS((char **)); static int setlcpechofails __ARGS((char **)); +static int setbsdcomp __ARGS((char **)); +static int setnobsdcomp __ARGS((void)); static int number_option __ARGS((char *, long *, int)); static int readable __ARGS((int fd)); @@ -228,6 +231,8 @@ static struct cmd { {"chap-interval", 1, setchapintv}, /* Set interval for rechallenge */ {"ipcp-accept-local", 0, setipcpaccl}, /* Accept peer's address for us */ {"ipcp-accept-remote", 0, setipcpaccr}, /* Accept peer's address for it */ + {"bsdcomp", 1, setbsdcomp}, /* request BSD-Compress */ + {"-bsdcomp", 0, setnobsdcomp}, /* don't allow BSD-Compress */ {NULL, 0, NULL} }; @@ -1450,3 +1455,20 @@ static int setchapintv(argv) { return int_option(*argv, &chap[0].chal_interval); } + +static int setbsdcomp(argv) + char **argv; +{ + int bits; + + if (!int_option(*argv, &bits)) + return 0; + ccp_wantoptions[0].bsd_compress = 1; + ccp_wantoptions[0].bsd_bits = bits; + return 1; +} + +static int setnobsdcomp() +{ + ccp_allowoptions[0].bsd_compress = 0; +} diff --git a/pppd/ppp.h b/pppd/ppp.h deleted file mode 100644 index 3d8f870..0000000 --- a/pppd/ppp.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * ppp.h - PPP global declarations. - * - * 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. - * - * $Id: ppp.h,v 1.1 1993/11/11 03:54:25 paulus Exp $ - */ - -#ifndef __PPP_H__ -#define __PPP_H__ - -#define NPPP 1 /* One PPP interface supported (per process) */ - -/* - * Data Link Layer header = Address, Control, Protocol. - */ -#define ALLSTATIONS 0xff /* All-Stations Address */ -#define UI 0x03 /* Unnumbered Information */ -#define LCP 0xc021 /* Link Control Protocol */ -#define IPCP 0x8021 /* IP Control Protocol */ -#define UPAP 0xc023 /* User/Password Authentication Protocol */ -#define CHAP 0xc223 /* Crytpographic Handshake Protocol */ -#define LQR 0xc025 /* Link Quality Report protocol */ -#define IP_VJ_COMP 0x002d /* VJ TCP compressed IP packet */ -#define DLLHEADERLEN (sizeof (u_char) + sizeof (u_char) + sizeof (u_short)) -#define MTU 1500 /* Default MTU */ - -#endif /* __PPP_H__ */