From a3396b002507d72b3e1f1169bd02ae018539654b Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Wed, 21 Sep 1994 06:47:37 +0000 Subject: [PATCH] use ppp_defs.h instead of ppp.h, args.h; change some names --- pppd/auth.c | 47 +++++++------- pppd/ccp.c | 41 ++++++------- pppd/ccp.h | 45 ++++++++++---- pppd/chap.c | 57 +++++++++-------- pppd/chap.h | 20 +++--- pppd/fsm.c | 29 +++++---- pppd/fsm.h | 18 +++--- pppd/ipcp.c | 61 +++++++++--------- pppd/ipcp.h | 20 +++--- pppd/lcp.c | 135 ++++++++++++++++++++-------------------- pppd/lcp.h | 30 ++++----- pppd/magic.c | 18 +++--- pppd/magic.h | 7 +-- pppd/main.c | 80 ++++++++++++------------ pppd/options.c | 153 +++++++++++++++++++++++----------------------- pppd/patchlevel.h | 7 ++- pppd/pppd.h | 41 +++++-------- pppd/sys-bsd.c | 32 +++++----- pppd/sys-linux.c | 16 ++--- pppd/sys-str.c | 32 +++++----- pppd/sys-ultrix.c | 19 +++--- pppd/upap.c | 41 ++++++------- pppd/upap.h | 20 +++--- 23 files changed, 489 insertions(+), 480 deletions(-) diff --git a/pppd/auth.c b/pppd/auth.c index b9c28fc..85ea8db 100644 --- a/pppd/auth.c +++ b/pppd/auth.c @@ -33,7 +33,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: auth.c,v 1.9 1994/09/01 00:12:52 paulus Exp $"; +static char rcsid[] = "$Id: auth.c,v 1.10 1994/09/21 06:47:37 paulus Exp $"; #endif #include @@ -48,7 +48,6 @@ static char rcsid[] = "$Id: auth.c,v 1.9 1994/09/01 00:12:52 paulus Exp $"; #include #include -#include "ppp.h" #include "pppd.h" #include "fsm.h" #include "lcp.h" @@ -78,9 +77,9 @@ struct wordlist { #define TRUE 1 /* Records which authentication operations haven't completed yet. */ -static int auth_pending[NPPP]; +static int auth_pending[N_PPP]; static int logged_in; -static struct wordlist *addresses[NPPP]; +static struct wordlist *addresses[N_PPP]; /* Bits in auth_pending[] */ #define UPAP_WITHPEER 1 @@ -89,20 +88,20 @@ static struct wordlist *addresses[NPPP]; #define CHAP_PEER 8 /* 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)); -static int get_upap_passwd __ARGS((void)); -static int have_upap_secret __ARGS((void)); -static int have_chap_secret __ARGS((char *, char *)); -static int scan_authfile __ARGS((FILE *, char *, char *, char *, +void check_access __P((FILE *, char *)); + +static void network_phase __P((int)); +static int login __P((char *, char *, char **, int *)); +static void logout __P((void)); +static int null_login __P((int)); +static int get_upap_passwd __P((void)); +static int have_upap_secret __P((void)); +static int have_chap_secret __P((char *, char *)); +static int scan_authfile __P((FILE *, char *, char *, char *, struct wordlist **, char *)); -static void free_wordlist __ARGS((struct wordlist *)); +static void free_wordlist __P((struct wordlist *)); -extern char *crypt __ARGS((char *, char *)); +extern char *crypt __P((char *, char *)); /* * An Open on LCP has requested a change from Dead to Establish phase. @@ -227,10 +226,10 @@ auth_peer_success(unit, protocol) int bit; switch (protocol) { - case CHAP: + case PPP_CHAP: bit = CHAP_PEER; break; - case UPAP: + case PPP_PAP: bit = UPAP_PEER; break; default: @@ -274,10 +273,10 @@ auth_withpeer_success(unit, protocol) int bit; switch (protocol) { - case CHAP: + case PPP_CHAP: bit = CHAP_WITHPEER; break; - case UPAP: + case PPP_PAP: bit = UPAP_WITHPEER; break; default: @@ -693,9 +692,9 @@ get_secret(unit, client, server, secret, secret_len, save_addrs) int auth_ip_addr(unit, addr) int unit; - uint32 addr; + u_int32_t addr; { - uint32 a; + u_int32_t a; struct hostent *hp; struct wordlist *addrs; @@ -716,7 +715,7 @@ auth_ip_addr(unit, addr) addrs->word); continue; } else - a = *(uint32 *)hp->h_addr; + a = *(u_int32_t *)hp->h_addr; } if (addr == a) return 1; @@ -731,7 +730,7 @@ auth_ip_addr(unit, addr) */ int bad_ip_adrs(addr) - uint32 addr; + u_int32_t addr; { addr = ntohl(addr); return (addr >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET diff --git a/pppd/ccp.c b/pppd/ccp.c index bade39a..24bf6cc 100644 --- a/pppd/ccp.c +++ b/pppd/ccp.c @@ -26,37 +26,36 @@ */ #ifndef lint -static char rcsid[] = "$Id: ccp.c,v 1.4 1994/09/16 02:14:31 paulus Exp $"; +static char rcsid[] = "$Id: ccp.c,v 1.5 1994/09/21 06:47:37 paulus Exp $"; #endif #include #include #include "pppd.h" -#include "ppp.h" #include "fsm.h" #include "ccp.h" -fsm ccp_fsm[NPPP]; -ccp_options ccp_wantoptions[NPPP]; /* what to request the peer to use */ -ccp_options ccp_gotoptions[NPPP]; /* what the peer agreed to do */ -ccp_options ccp_allowoptions[NPPP]; /* what we'll agree to do */ -ccp_options ccp_hisoptions[NPPP]; /* what we agreed to do */ +fsm ccp_fsm[N_PPP]; +ccp_options ccp_wantoptions[N_PPP]; /* what to request the peer to use */ +ccp_options ccp_gotoptions[N_PPP]; /* what the peer agreed to do */ +ccp_options ccp_allowoptions[N_PPP]; /* what we'll agree to do */ +ccp_options ccp_hisoptions[N_PPP]; /* what we agreed to do */ /* * Callbacks for fsm code. */ -static void ccp_resetci __ARGS((fsm *)); -static int ccp_cilen __ARGS((fsm *)); -static void ccp_addci __ARGS((fsm *, u_char *, int *)); -static int ccp_ackci __ARGS((fsm *, u_char *, int)); -static int ccp_nakci __ARGS((fsm *, u_char *, int)); -static int ccp_rejci __ARGS((fsm *, u_char *, int)); -static int ccp_reqci __ARGS((fsm *, u_char *, int *, int)); -static void ccp_up __ARGS((fsm *)); -static void ccp_down __ARGS((fsm *)); -static int ccp_extcode __ARGS((fsm *, int, int, u_char *, int)); -static void ccp_rack_timeout __ARGS(()); +static void ccp_resetci __P((fsm *)); +static int ccp_cilen __P((fsm *)); +static void ccp_addci __P((fsm *, u_char *, int *)); +static int ccp_ackci __P((fsm *, u_char *, int)); +static int ccp_nakci __P((fsm *, u_char *, int)); +static int ccp_rejci __P((fsm *, u_char *, int)); +static int ccp_reqci __P((fsm *, u_char *, int *, int)); +static void ccp_up __P((fsm *)); +static void ccp_down __P((fsm *)); +static int ccp_extcode __P((fsm *, int, int, u_char *, int)); +static void ccp_rack_timeout __P(()); static fsm_callbacks ccp_callbacks = { ccp_resetci, @@ -103,7 +102,7 @@ static fsm_callbacks ccp_callbacks = { /* * Local state (mainly for handling reset-reqs and reset-acks */ -static int ccp_localstate[NPPP]; +static int ccp_localstate[N_PPP]; #define RACK_PENDING 1 /* waiting for reset-ack */ #define RREQ_REPEAT 2 /* send another reset-req if no reset-ack */ @@ -119,7 +118,7 @@ ccp_init(unit) fsm *f = &ccp_fsm[unit]; f->unit = unit; - f->protocol = CCP; + f->protocol = PPP_CCP; f->callbacks = &ccp_callbacks; fsm_init(f); @@ -531,7 +530,7 @@ int ccp_printpkt(p, plen, printer, arg) u_char *p; int plen; - void (*printer) __ARGS((void *, char *, ...)); + void (*printer) __P((void *, char *, ...)); void *arg; { u_char *p0, *optend; diff --git a/pppd/ccp.h b/pppd/ccp.h index 8c2cc6d..95a1b23 100644 --- a/pppd/ccp.h +++ b/pppd/ccp.h @@ -1,7 +1,30 @@ /* * ccp.h - Definitions for PPP Compression Control Protocol. * - * $Id: ccp.h,v 1.1 1994/08/11 01:44:32 paulus Exp $ + * 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: ccp.h,v 1.2 1994/09/21 06:47:37 paulus Exp $ */ /* @@ -29,14 +52,14 @@ extern ccp_options ccp_gotoptions[]; extern ccp_options ccp_allowoptions[]; extern ccp_options ccp_hisoptions[]; -void ccp_init __ARGS((int unit)); -void ccp_open __ARGS((int unit)); -void ccp_close __ARGS((int unit)); -void ccp_lowerup __ARGS((int unit)); -void ccp_lowerdown __ARGS((int)); -void ccp_input __ARGS((int unit, u_char *pkt, int len)); -void ccp_protrej __ARGS((int unit)); -int ccp_printpkt __ARGS((u_char *pkt, int len, - void (*printer) __ARGS((void *, char *, ...)), +void ccp_init __P((int unit)); +void ccp_open __P((int unit)); +void ccp_close __P((int unit)); +void ccp_lowerup __P((int unit)); +void ccp_lowerdown __P((int)); +void ccp_input __P((int unit, u_char *pkt, int len)); +void ccp_protrej __P((int unit)); +int ccp_printpkt __P((u_char *pkt, int len, + void (*printer) __P((void *, char *, ...)), void *arg)); -void ccp_datainput __ARGS((int unit, u_char *pkt, int len)); +void ccp_datainput __P((int unit, u_char *pkt, int len)); diff --git a/pppd/chap.c b/pppd/chap.c index 64f39bc..c11d541 100644 --- a/pppd/chap.c +++ b/pppd/chap.c @@ -19,7 +19,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: chap.c,v 1.3 1994/04/18 04:01:07 paulus Exp $"; +static char rcsid[] = "$Id: chap.c,v 1.4 1994/09/21 06:47:37 paulus Exp $"; #endif /* @@ -31,26 +31,25 @@ static char rcsid[] = "$Id: chap.c,v 1.3 1994/04/18 04:01:07 paulus Exp $"; #include #include -#include "ppp.h" #include "pppd.h" #include "chap.h" #include "md5.h" -chap_state chap[NPPP]; /* CHAP state; one for each unit */ +chap_state chap[N_PPP]; /* CHAP state; one for each unit */ -static void ChapChallengeTimeout __ARGS((caddr_t)); -static void ChapResponseTimeout __ARGS((caddr_t)); -static void ChapReceiveChallenge __ARGS((chap_state *, u_char *, int, int)); -static void ChapReceiveResponse __ARGS((chap_state *, u_char *, int, int)); -static void ChapReceiveSuccess __ARGS((chap_state *, u_char *, int, int)); -static void ChapReceiveFailure __ARGS((chap_state *, u_char *, int, int)); -static void ChapSendStatus __ARGS((chap_state *, int)); -static void ChapSendChallenge __ARGS((chap_state *)); -static void ChapSendResponse __ARGS((chap_state *)); -static void ChapGenChallenge __ARGS((chap_state *)); +static void ChapChallengeTimeout __P((caddr_t)); +static void ChapResponseTimeout __P((caddr_t)); +static void ChapReceiveChallenge __P((chap_state *, u_char *, int, int)); +static void ChapReceiveResponse __P((chap_state *, u_char *, int, int)); +static void ChapReceiveSuccess __P((chap_state *, u_char *, int, int)); +static void ChapReceiveFailure __P((chap_state *, u_char *, int, int)); +static void ChapSendStatus __P((chap_state *, int)); +static void ChapSendChallenge __P((chap_state *)); +static void ChapSendResponse __P((chap_state *)); +static void ChapGenChallenge __P((chap_state *)); -extern double drand48 __ARGS((void)); -extern void srand48 __ARGS((long)); +extern double drand48 __P((void)); +extern void srand48 __P((long)); /* * ChapInit - Initialize a CHAP unit. @@ -148,7 +147,7 @@ ChapChallengeTimeout(arg) /* give up on peer */ syslog(LOG_ERR, "Peer failed to respond to CHAP challenge"); cstate->serverstate = CHAPSS_BADAUTH; - auth_peer_fail(cstate->unit, CHAP); + auth_peer_fail(cstate->unit, PPP_CHAP); return; } @@ -258,10 +257,10 @@ ChapProtocolReject(unit) if (cstate->serverstate != CHAPSS_INITIAL && cstate->serverstate != CHAPSS_CLOSED) - auth_peer_fail(unit, CHAP); + auth_peer_fail(unit, PPP_CHAP); if (cstate->clientstate != CHAPCS_INITIAL && cstate->clientstate != CHAPCS_CLOSED) - auth_withpeer_fail(unit, CHAP); + auth_withpeer_fail(unit, PPP_CHAP); ChapLowerDown(unit); /* shutdown chap */ } @@ -521,7 +520,7 @@ ChapReceiveResponse(cstate, inp, id, len) old_state = cstate->serverstate; cstate->serverstate = CHAPSS_OPEN; if (old_state == CHAPSS_INITIAL_CHAL) { - auth_peer_success(cstate->unit, CHAP); + auth_peer_success(cstate->unit, PPP_CHAP); } if (cstate->chal_interval != 0) TIMEOUT(ChapRechallenge, (caddr_t) cstate, cstate->chal_interval); @@ -529,7 +528,7 @@ ChapReceiveResponse(cstate, inp, id, len) } else { syslog(LOG_ERR, "CHAP peer authentication failed"); cstate->serverstate = CHAPSS_BADAUTH; - auth_peer_fail(cstate->unit, CHAP); + auth_peer_fail(cstate->unit, PPP_CHAP); } } @@ -567,7 +566,7 @@ ChapReceiveSuccess(cstate, inp, id, len) cstate->clientstate = CHAPCS_OPEN; - auth_withpeer_success(cstate->unit, CHAP); + auth_withpeer_success(cstate->unit, PPP_CHAP); } @@ -602,7 +601,7 @@ ChapReceiveFailure(cstate, inp, id, len) PRINTMSG(inp, len); syslog(LOG_ERR, "CHAP authentication failed"); - auth_withpeer_fail(cstate->unit, CHAP); + auth_withpeer_fail(cstate->unit, PPP_CHAP); } @@ -622,7 +621,7 @@ ChapSendChallenge(cstate) outlen = CHAP_HEADERLEN + sizeof (u_char) + chal_len + name_len; outp = outpacket_buf; - MAKEHEADER(outp, CHAP); /* paste in a CHAP header */ + MAKEHEADER(outp, PPP_CHAP); /* paste in a CHAP header */ PUTCHAR(CHAP_CHALLENGE, outp); PUTCHAR(cstate->chal_id, outp); @@ -634,7 +633,7 @@ ChapSendChallenge(cstate) BCOPY(cstate->chal_name, outp, name_len); /* append hostname */ - output(cstate->unit, outpacket_buf, outlen + DLLHEADERLEN); + output(cstate->unit, outpacket_buf, outlen + PPP_HDRLEN); CHAPDEBUG((LOG_INFO, "ChapSendChallenge: Sent id %d.", cstate->chal_id)); @@ -664,13 +663,13 @@ ChapSendStatus(cstate, code) outlen = CHAP_HEADERLEN + msglen; outp = outpacket_buf; - MAKEHEADER(outp, CHAP); /* paste in a header */ + MAKEHEADER(outp, PPP_CHAP); /* paste in a header */ PUTCHAR(code, outp); PUTCHAR(cstate->chal_id, outp); PUTSHORT(outlen, outp); BCOPY(msg, outp, msglen); - output(cstate->unit, outpacket_buf, outlen + DLLHEADERLEN); + output(cstate->unit, outpacket_buf, outlen + PPP_HDRLEN); CHAPDEBUG((LOG_INFO, "ChapSendStatus: Sent code %d, id %d.", code, cstate->chal_id)); @@ -722,7 +721,7 @@ ChapSendResponse(cstate) outlen = CHAP_HEADERLEN + sizeof (u_char) + md_len + name_len; outp = outpacket_buf; - MAKEHEADER(outp, CHAP); + MAKEHEADER(outp, PPP_CHAP); PUTCHAR(CHAP_RESPONSE, outp); /* we are a response */ PUTCHAR(cstate->resp_id, outp); /* copy id from challenge packet */ @@ -735,7 +734,7 @@ ChapSendResponse(cstate) BCOPY(cstate->resp_name, outp, name_len); /* append our name */ /* send the packet */ - output(cstate->unit, outpacket_buf, outlen + DLLHEADERLEN); + output(cstate->unit, outpacket_buf, outlen + PPP_HDRLEN); cstate->clientstate = CHAPCS_RESPONSE; TIMEOUT(ChapResponseTimeout, (caddr_t) cstate, cstate->timeouttime); @@ -753,7 +752,7 @@ int ChapPrintPkt(p, plen, printer, arg) u_char *p; int plen; - void (*printer) __ARGS((void *, char *, ...)); + void (*printer) __P((void *, char *, ...)); void *arg; { int code, id, len; diff --git a/pppd/chap.h b/pppd/chap.h index 682ecb8..44b08f2 100644 --- a/pppd/chap.h +++ b/pppd/chap.h @@ -15,7 +15,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: chap.h,v 1.2 1994/04/11 07:13:44 paulus Exp $ + * $Id: chap.h,v 1.3 1994/09/21 06:47:37 paulus Exp $ */ #ifndef __CHAP_INCLUDE__ @@ -98,15 +98,15 @@ typedef struct chap_state { extern chap_state chap[]; -void ChapInit __ARGS((int)); -void ChapAuthWithPeer __ARGS((int, char *, int)); -void ChapAuthPeer __ARGS((int, char *, int)); -void ChapLowerUp __ARGS((int)); -void ChapLowerDown __ARGS((int)); -void ChapInput __ARGS((int, u_char *, int)); -void ChapProtocolReject __ARGS((int)); -int ChapPrintPkt __ARGS((u_char *, int, - void (*) __ARGS((void *, char *, ...)), void *)); +void ChapInit __P((int)); +void ChapAuthWithPeer __P((int, char *, int)); +void ChapAuthPeer __P((int, char *, int)); +void ChapLowerUp __P((int)); +void ChapLowerDown __P((int)); +void ChapInput __P((int, u_char *, int)); +void ChapProtocolReject __P((int)); +int ChapPrintPkt __P((u_char *, int, + void (*) __P((void *, char *, ...)), void *)); #define __CHAP_INCLUDE__ #endif /* __CHAP_INCLUDE__ */ diff --git a/pppd/fsm.c b/pppd/fsm.c index ea8de82..a11922a 100644 --- a/pppd/fsm.c +++ b/pppd/fsm.c @@ -18,7 +18,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: fsm.c,v 1.4 1994/09/01 00:14:03 paulus Exp $"; +static char rcsid[] = "$Id: fsm.c,v 1.5 1994/09/21 06:47:37 paulus Exp $"; #endif /* @@ -31,24 +31,23 @@ static char rcsid[] = "$Id: fsm.c,v 1.4 1994/09/01 00:14:03 paulus Exp $"; #include #include -#include "ppp.h" #include "pppd.h" #include "fsm.h" extern char *proto_name(); -static void fsm_timeout __ARGS((caddr_t)); -static void fsm_rconfreq __ARGS((fsm *, int, u_char *, int)); -static void fsm_rconfack __ARGS((fsm *, int, u_char *, int)); -static void fsm_rconfnakrej __ARGS((fsm *, int, int, u_char *, int)); -static void fsm_rtermreq __ARGS((fsm *, int)); -static void fsm_rtermack __ARGS((fsm *)); -static void fsm_rcoderej __ARGS((fsm *, u_char *, int)); -static void fsm_sconfreq __ARGS((fsm *, int)); +static void fsm_timeout __P((caddr_t)); +static void fsm_rconfreq __P((fsm *, int, u_char *, int)); +static void fsm_rconfack __P((fsm *, int, u_char *, int)); +static void fsm_rconfnakrej __P((fsm *, int, int, u_char *, int)); +static void fsm_rtermreq __P((fsm *, int)); +static void fsm_rtermack __P((fsm *)); +static void fsm_rcoderej __P((fsm *, u_char *, int)); +static void fsm_sconfreq __P((fsm *, int)); #define PROTO_NAME(f) ((f)->callbacks->proto_name) -int peer_mru[NPPP]; +int peer_mru[N_PPP]; /* @@ -721,7 +720,7 @@ fsm_sconfreq(f, retransmit) /* * Make up the request packet */ - outp = outpacket_buf + DLLHEADERLEN + HEADERLEN; + outp = outpacket_buf + PPP_HDRLEN + HEADERLEN; if( f->callbacks->cilen && f->callbacks->addci ){ cilen = (*f->callbacks->cilen)(f); if( cilen > peer_mru[f->unit] - HEADERLEN ) @@ -762,14 +761,14 @@ fsm_sdata(f, code, id, data, datalen) outp = outpacket_buf; if (datalen > peer_mru[f->unit] - HEADERLEN) datalen = peer_mru[f->unit] - HEADERLEN; - if (datalen && data != outp + DLLHEADERLEN + HEADERLEN) - BCOPY(data, outp + DLLHEADERLEN + HEADERLEN, datalen); + if (datalen && data != outp + PPP_HDRLEN + HEADERLEN) + BCOPY(data, outp + PPP_HDRLEN + HEADERLEN, datalen); outlen = datalen + HEADERLEN; MAKEHEADER(outp, f->protocol); PUTCHAR(code, outp); PUTCHAR(id, outp); PUTSHORT(outlen, outp); - output(f->unit, outpacket_buf, outlen + DLLHEADERLEN); + output(f->unit, outpacket_buf, outlen + PPP_HDRLEN); FSMDEBUG((LOG_INFO, "fsm_sdata(%s): Sent code %d, id %d.", PROTO_NAME(f), code, id)); diff --git a/pppd/fsm.h b/pppd/fsm.h index 22dbf65..dc1c179 100644 --- a/pppd/fsm.h +++ b/pppd/fsm.h @@ -16,7 +16,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: fsm.h,v 1.3 1994/09/01 00:14:03 paulus Exp $ + * $Id: fsm.h,v 1.4 1994/09/21 06:47:37 paulus Exp $ */ /* @@ -112,14 +112,14 @@ typedef struct fsm { /* * Prototypes */ -void fsm_init __ARGS((fsm *)); -void fsm_lowerup __ARGS((fsm *)); -void fsm_lowerdown __ARGS((fsm *)); -void fsm_open __ARGS((fsm *)); -void fsm_close __ARGS((fsm *)); -void fsm_input __ARGS((fsm *, u_char *, int)); -void fsm_protreject __ARGS((fsm *)); -void fsm_sdata __ARGS((fsm *, int, int, u_char *, int)); +void fsm_init __P((fsm *)); +void fsm_lowerup __P((fsm *)); +void fsm_lowerdown __P((fsm *)); +void fsm_open __P((fsm *)); +void fsm_close __P((fsm *)); +void fsm_input __P((fsm *, u_char *, int)); +void fsm_protreject __P((fsm *)); +void fsm_sdata __P((fsm *, int, int, u_char *, int)); /* diff --git a/pppd/ipcp.c b/pppd/ipcp.c index 334d892..37d62c6 100644 --- a/pppd/ipcp.c +++ b/pppd/ipcp.c @@ -18,7 +18,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: ipcp.c,v 1.10 1994/09/01 00:22:38 paulus Exp $"; +static char rcsid[] = "$Id: ipcp.c,v 1.11 1994/09/21 06:47:37 paulus Exp $"; #endif /* @@ -32,35 +32,34 @@ static char rcsid[] = "$Id: ipcp.c,v 1.10 1994/09/01 00:22:38 paulus Exp $"; #include #include "pppd.h" -#include "ppp.h" #include "fsm.h" #include "ipcp.h" #include "pathnames.h" /* global vars */ -ipcp_options ipcp_wantoptions[NPPP]; /* Options that we want to request */ -ipcp_options ipcp_gotoptions[NPPP]; /* Options that peer ack'd */ -ipcp_options ipcp_allowoptions[NPPP]; /* Options we allow peer to request */ -ipcp_options ipcp_hisoptions[NPPP]; /* Options that we ack'd */ +ipcp_options ipcp_wantoptions[N_PPP]; /* Options that we want to request */ +ipcp_options ipcp_gotoptions[N_PPP]; /* Options that peer ack'd */ +ipcp_options ipcp_allowoptions[N_PPP]; /* Options we allow peer to request */ +ipcp_options ipcp_hisoptions[N_PPP]; /* Options that we ack'd */ /* local vars */ -static int cis_received[NPPP]; /* # Conf-Reqs received */ +static int cis_received[N_PPP]; /* # Conf-Reqs received */ /* * Callbacks for fsm code. (CI = Configuration Information) */ -static void ipcp_resetci __ARGS((fsm *)); /* Reset our CI */ -static int ipcp_cilen __ARGS((fsm *)); /* Return length of our CI */ -static void ipcp_addci __ARGS((fsm *, u_char *, int *)); /* Add our CI */ -static int ipcp_ackci __ARGS((fsm *, u_char *, int)); /* Peer ack'd our CI */ -static int ipcp_nakci __ARGS((fsm *, u_char *, int)); /* Peer nak'd our CI */ -static int ipcp_rejci __ARGS((fsm *, u_char *, int)); /* Peer rej'd our CI */ -static int ipcp_reqci __ARGS((fsm *, u_char *, int *, int)); /* Rcv CI */ -static void ipcp_up __ARGS((fsm *)); /* We're UP */ -static void ipcp_down __ARGS((fsm *)); /* We're DOWN */ -static void ipcp_script __ARGS((fsm *, char *)); /* Run an up/down script */ - -fsm ipcp_fsm[NPPP]; /* IPCP fsm structure */ +static void ipcp_resetci __P((fsm *)); /* Reset our CI */ +static int ipcp_cilen __P((fsm *)); /* Return length of our CI */ +static void ipcp_addci __P((fsm *, u_char *, int *)); /* Add our CI */ +static int ipcp_ackci __P((fsm *, u_char *, int)); /* Peer ack'd our CI */ +static int ipcp_nakci __P((fsm *, u_char *, int)); /* Peer nak'd our CI */ +static int ipcp_rejci __P((fsm *, u_char *, int)); /* Peer rej'd our CI */ +static int ipcp_reqci __P((fsm *, u_char *, int *, int)); /* Rcv CI */ +static void ipcp_up __P((fsm *)); /* We're UP */ +static void ipcp_down __P((fsm *)); /* We're DOWN */ +static void ipcp_script __P((fsm *, char *)); /* Run an up/down script */ + +fsm ipcp_fsm[N_PPP]; /* IPCP fsm structure */ static fsm_callbacks ipcp_callbacks = { /* IPCP callback routines */ ipcp_resetci, /* Reset our Configuration Information */ @@ -99,7 +98,7 @@ static fsm_callbacks ipcp_callbacks = { /* IPCP callback routines */ */ char * ip_ntoa(ipaddr) -uint32 ipaddr; +u_int32_t ipaddr; { static char b[64]; @@ -126,7 +125,7 @@ ipcp_init(unit) ipcp_options *ao = &ipcp_allowoptions[unit]; f->unit = unit; - f->protocol = IPCP; + f->protocol = PPP_IPCP; f->callbacks = &ipcp_callbacks; fsm_init(&ipcp_fsm[unit]); @@ -292,7 +291,7 @@ ipcp_addci(f, ucp, lenp) if (neg) { \ int addrlen = (old? CILEN_ADDRS: CILEN_ADDR); \ if (len >= addrlen) { \ - uint32 l; \ + u_int32_t l; \ PUTCHAR(opt, ucp); \ PUTCHAR(addrlen, ucp); \ l = ntohl(val1); \ @@ -355,7 +354,7 @@ ipcp_ackci(f, p, len) { ipcp_options *go = &ipcp_gotoptions[f->unit]; u_short cilen, citype, cishort; - uint32 cilong; + u_int32_t cilong; u_char cimaxslotindex, cicflag; /* @@ -390,7 +389,7 @@ ipcp_ackci(f, p, len) #define ACKCIADDR(opt, neg, old, val1, val2) \ if (neg) { \ int addrlen = (old? CILEN_ADDRS: CILEN_ADDR); \ - uint32 l; \ + u_int32_t l; \ if ((len -= addrlen) < 0) \ goto bad; \ GETCHAR(citype, p); \ @@ -447,7 +446,7 @@ ipcp_nakci(f, p, len) u_char cimaxslotindex, cicflag; u_char citype, cilen, *next; u_short cishort; - uint32 ciaddr1, ciaddr2, l; + u_int32_t ciaddr1, ciaddr2, l; ipcp_options no; /* options we've seen Naks for */ ipcp_options try; /* options to request next time */ @@ -619,7 +618,7 @@ ipcp_rejci(f, p, len) ipcp_options *go = &ipcp_gotoptions[f->unit]; u_char cimaxslotindex, ciflag, cilen; u_short cishort; - uint32 cilong; + u_int32_t cilong; ipcp_options try; /* options to request next time */ try = *go; @@ -633,7 +632,7 @@ ipcp_rejci(f, p, len) len >= (cilen = old? CILEN_ADDRS: CILEN_ADDR) && \ p[1] == cilen && \ p[0] == opt) { \ - uint32 l; \ + u_int32_t l; \ len -= cilen; \ INCPTR(2, p); \ GETLONG(l, p); \ @@ -718,7 +717,7 @@ ipcp_reqci(f, inp, len, reject_if_disagree) u_char *cip, *next; /* Pointer to current and next CIs */ u_short cilen, citype; /* Parsed len, type */ u_short cishort; /* Parsed short value */ - uint32 tl, ciaddr1, ciaddr2;/* Parsed address values */ + u_int32_t tl, ciaddr1, ciaddr2;/* Parsed address values */ int rc = CONFACK; /* Final packet return code */ int orc; /* Individual option return code */ u_char *p; /* Pointer to next char to parse */ @@ -956,7 +955,7 @@ static void ipcp_up(f) fsm *f; { - uint32 mask; + u_int32_t mask; ipcp_options *ho = &ipcp_hisoptions[f->unit]; ipcp_options *go = &ipcp_gotoptions[f->unit]; @@ -1043,7 +1042,7 @@ static void ipcp_down(f) fsm *f; { - uint32 ouraddr, hisaddr; + u_int32_t ouraddr, hisaddr; IPCPDEBUG((LOG_INFO, "ipcp: down")); @@ -1105,7 +1104,7 @@ ipcp_printpkt(p, plen, printer, arg) int code, id, len, olen; u_char *pstart, *optend; u_short cishort; - uint32 cilong; + u_int32_t cilong; if (plen < HEADERLEN) return 0; diff --git a/pppd/ipcp.h b/pppd/ipcp.h index 7484872..b1f9b40 100644 --- a/pppd/ipcp.h +++ b/pppd/ipcp.h @@ -16,7 +16,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: ipcp.h,v 1.4 1994/09/01 00:23:12 paulus Exp $ + * $Id: ipcp.h,v 1.5 1994/09/21 06:47:37 paulus Exp $ */ /* @@ -49,7 +49,7 @@ typedef struct ipcp_options { int accept_remote : 1; /* accept peer's value for hisaddr */ u_short vj_protocol; /* protocol value to use in VJ option */ u_char maxslotindex, cflag; /* values for RFC1332 VJ compression neg. */ - uint32 ouraddr, hisaddr; /* Addresses in NETWORK BYTE ORDER */ + u_int32_t ouraddr, hisaddr; /* Addresses in NETWORK BYTE ORDER */ } ipcp_options; extern fsm ipcp_fsm[]; @@ -58,11 +58,11 @@ extern ipcp_options ipcp_gotoptions[]; extern ipcp_options ipcp_allowoptions[]; extern ipcp_options ipcp_hisoptions[]; -void ipcp_init __ARGS((int)); -void ipcp_open __ARGS((int)); -void ipcp_close __ARGS((int)); -void ipcp_lowerup __ARGS((int)); -void ipcp_lowerdown __ARGS((int)); -void ipcp_input __ARGS((int, u_char *, int)); -void ipcp_protrej __ARGS((int)); -int ipcp_printpkt __ARGS((u_char *, int, void (*)(), void *)); +void ipcp_init __P((int)); +void ipcp_open __P((int)); +void ipcp_close __P((int)); +void ipcp_lowerup __P((int)); +void ipcp_lowerdown __P((int)); +void ipcp_input __P((int, u_char *, int)); +void ipcp_protrej __P((int)); +int ipcp_printpkt __P((u_char *, int, void (*)(), void *)); diff --git a/pppd/lcp.c b/pppd/lcp.c index f215a76..ee9999b 100644 --- a/pppd/lcp.c +++ b/pppd/lcp.c @@ -18,7 +18,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: lcp.c,v 1.13 1994/09/16 02:15:37 paulus Exp $"; +static char rcsid[] = "$Id: lcp.c,v 1.14 1994/09/21 06:47:37 paulus Exp $"; #endif /* @@ -36,7 +36,6 @@ static char rcsid[] = "$Id: lcp.c,v 1.13 1994/09/16 02:15:37 paulus Exp $"; #include #include "pppd.h" -#include "ppp.h" #include "fsm.h" #include "lcp.h" #include "magic.h" @@ -49,44 +48,44 @@ static char rcsid[] = "$Id: lcp.c,v 1.13 1994/09/16 02:15:37 paulus Exp $"; #endif /* global vars */ -fsm lcp_fsm[NPPP]; /* LCP fsm structure (global)*/ -lcp_options lcp_wantoptions[NPPP]; /* Options that we want to request */ -lcp_options lcp_gotoptions[NPPP]; /* Options that peer ack'd */ -lcp_options lcp_allowoptions[NPPP]; /* Options we allow peer to request */ -lcp_options lcp_hisoptions[NPPP]; /* Options that we ack'd */ -uint32 xmit_accm[NPPP][8]; /* extended transmit ACCM */ +fsm lcp_fsm[N_PPP]; /* LCP fsm structure (global)*/ +lcp_options lcp_wantoptions[N_PPP]; /* Options that we want to request */ +lcp_options lcp_gotoptions[N_PPP]; /* Options that peer ack'd */ +lcp_options lcp_allowoptions[N_PPP]; /* Options we allow peer to request */ +lcp_options lcp_hisoptions[N_PPP]; /* Options that we ack'd */ +u_int32_t xmit_accm[N_PPP][8]; /* extended transmit ACCM */ -static uint32 lcp_echos_pending = 0; /* Number of outstanding echo msgs */ -static uint32 lcp_echo_number = 0; /* ID number of next echo frame */ -static uint32 lcp_echo_timer_running = 0; /* TRUE if a timer is running */ +static u_int32_t lcp_echos_pending = 0; /* Number of outstanding echo msgs */ +static u_int32_t lcp_echo_number = 0; /* ID number of next echo frame */ +static u_int32_t lcp_echo_timer_running = 0; /* TRUE if a timer is running */ /* * Callbacks for fsm code. (CI = Configuration Information) */ -static void lcp_resetci __ARGS((fsm *)); /* Reset our CI */ -static int lcp_cilen __ARGS((fsm *)); /* Return length of our CI */ -static void lcp_addci __ARGS((fsm *, u_char *, int *)); /* Add our CI to pkt */ -static int lcp_ackci __ARGS((fsm *, u_char *, int)); /* Peer ack'd our CI */ -static int lcp_nakci __ARGS((fsm *, u_char *, int)); /* Peer nak'd our CI */ -static int lcp_rejci __ARGS((fsm *, u_char *, int)); /* Peer rej'd our CI */ -static int lcp_reqci __ARGS((fsm *, u_char *, int *, int)); /* Rcv peer CI */ -static void lcp_up __ARGS((fsm *)); /* We're UP */ -static void lcp_down __ARGS((fsm *)); /* We're DOWN */ -static void lcp_starting __ARGS((fsm *)); /* We need lower layer up */ -static void lcp_finished __ARGS((fsm *)); /* We need lower layer down */ -static int lcp_extcode __ARGS((fsm *, int, int, u_char *, int)); -static void lcp_rprotrej __ARGS((fsm *, u_char *, int)); +static void lcp_resetci __P((fsm *)); /* Reset our CI */ +static int lcp_cilen __P((fsm *)); /* Return length of our CI */ +static void lcp_addci __P((fsm *, u_char *, int *)); /* Add our CI to pkt */ +static int lcp_ackci __P((fsm *, u_char *, int)); /* Peer ack'd our CI */ +static int lcp_nakci __P((fsm *, u_char *, int)); /* Peer nak'd our CI */ +static int lcp_rejci __P((fsm *, u_char *, int)); /* Peer rej'd our CI */ +static int lcp_reqci __P((fsm *, u_char *, int *, int)); /* Rcv peer CI */ +static void lcp_up __P((fsm *)); /* We're UP */ +static void lcp_down __P((fsm *)); /* We're DOWN */ +static void lcp_starting __P((fsm *)); /* We need lower layer up */ +static void lcp_finished __P((fsm *)); /* We need lower layer down */ +static int lcp_extcode __P((fsm *, int, int, u_char *, int)); +static void lcp_rprotrej __P((fsm *, u_char *, int)); /* * routines to send LCP echos to peer */ -static void lcp_echo_lowerup __ARGS((int)); -static void lcp_echo_lowerdown __ARGS((int)); -static void LcpEchoTimeout __ARGS((caddr_t)); -static void lcp_received_echo_reply __ARGS((fsm *, int, u_char *, int)); -static void LcpSendEchoRequest __ARGS((fsm *)); -static void LcpLinkFailure __ARGS((fsm *)); +static void lcp_echo_lowerup __P((int)); +static void lcp_echo_lowerdown __P((int)); +static void LcpEchoTimeout __P((caddr_t)); +static void lcp_received_echo_reply __P((fsm *, int, u_char *, int)); +static void LcpSendEchoRequest __P((fsm *)); +static void LcpLinkFailure __P((fsm *)); static fsm_callbacks lcp_callbacks = { /* LCP callback routines */ lcp_resetci, /* Reset our Configuration Information */ @@ -133,7 +132,7 @@ lcp_init(unit) lcp_options *ao = &lcp_allowoptions[unit]; f->unit = unit; - f->protocol = LCP; + f->protocol = PPP_LCP; f->callbacks = &lcp_callbacks; fsm_init(f); @@ -223,9 +222,9 @@ lcp_lowerup(unit) { sifdown(unit); ppp_set_xaccm(unit, xmit_accm[unit]); - ppp_send_config(unit, MTU, 0xffffffff, 0, 0); - ppp_recv_config(unit, MTU, 0x00000000, 0, 0); - peer_mru[unit] = MTU; + ppp_send_config(unit, PPP_MRU, 0xffffffff, 0, 0); + ppp_recv_config(unit, PPP_MRU, 0x00000000, 0, 0); + peer_mru[unit] = PPP_MRU; lcp_allowoptions[unit].asyncmap = xmit_accm[unit][0]; fsm_lowerup(&lcp_fsm[unit]); @@ -265,7 +264,7 @@ lcp_input(unit, p, len) * options. So as to be ready when that happens, we set * our receive side to accept packets as negotiated now. */ - ppp_recv_config(f->unit, MTU, + ppp_recv_config(f->unit, PPP_MRU, go->neg_asyncmap? go->asyncmap: 0x00000000, go->neg_pcompression, go->neg_accompression); } @@ -401,7 +400,7 @@ fsm *f; lcp_wantoptions[f->unit].magicnumber = magic(); lcp_wantoptions[f->unit].numloops = 0; lcp_gotoptions[f->unit] = lcp_wantoptions[f->unit]; - peer_mru[f->unit] = MTU; + peer_mru[f->unit] = PPP_MRU; } @@ -474,14 +473,14 @@ lcp_addci(f, ucp, lenp) if (neg) { \ PUTCHAR(opt, ucp); \ PUTCHAR(CILEN_LQR, ucp); \ - PUTSHORT(LQR, ucp); \ + PUTSHORT(PPP_LQR, ucp); \ PUTLONG(val, ucp); \ } ADDCISHORT(CI_MRU, go->neg_mru, go->mru); ADDCILONG(CI_ASYNCMAP, go->neg_asyncmap, go->asyncmap); - ADDCICHAP(CI_AUTHTYPE, go->neg_chap, CHAP, go->chap_mdtype); - ADDCISHORT(CI_AUTHTYPE, !go->neg_chap && go->neg_upap, UPAP); + ADDCICHAP(CI_AUTHTYPE, go->neg_chap, PPP_CHAP, go->chap_mdtype); + ADDCISHORT(CI_AUTHTYPE, !go->neg_chap && go->neg_upap, PPP_PAP); ADDCILQR(CI_QUALITY, go->neg_lqr, go->lqr_period); ADDCILONG(CI_MAGICNUMBER, go->neg_magicnumber, go->magicnumber); ADDCIVOID(CI_PCOMPRESSION, go->neg_pcompression); @@ -511,7 +510,7 @@ lcp_ackci(f, p, len) lcp_options *go = &lcp_gotoptions[f->unit]; u_char cilen, citype, cichar; u_short cishort; - uint32 cilong; + u_int32_t cilong; /* * CIs must be in exactly the same order that we sent. @@ -580,7 +579,7 @@ lcp_ackci(f, p, len) citype != opt) \ goto bad; \ GETSHORT(cishort, p); \ - if (cishort != LQR) \ + if (cishort != PPP_LQR) \ goto bad; \ GETLONG(cilong, p); \ if (cilong != val) \ @@ -589,8 +588,8 @@ lcp_ackci(f, p, len) ACKCISHORT(CI_MRU, go->neg_mru, go->mru); ACKCILONG(CI_ASYNCMAP, go->neg_asyncmap, go->asyncmap); - ACKCICHAP(CI_AUTHTYPE, go->neg_chap, CHAP, go->chap_mdtype); - ACKCISHORT(CI_AUTHTYPE, !go->neg_chap && go->neg_upap, UPAP); + ACKCICHAP(CI_AUTHTYPE, go->neg_chap, PPP_CHAP, go->chap_mdtype); + ACKCISHORT(CI_AUTHTYPE, !go->neg_chap && go->neg_upap, PPP_PAP); ACKCILQR(CI_QUALITY, go->neg_lqr, go->lqr_period); ACKCILONG(CI_MAGICNUMBER, go->neg_magicnumber, go->magicnumber); ACKCIVOID(CI_PCOMPRESSION, go->neg_pcompression); @@ -627,7 +626,7 @@ lcp_nakci(f, p, len) lcp_options *wo = &lcp_wantoptions[f->unit]; u_char cilen, citype, cichar, *next; u_short cishort; - uint32 cilong; + u_int32_t cilong; lcp_options no; /* options we've seen Naks for */ lcp_options try; /* options to request next time */ int looped_back = 0; @@ -737,7 +736,7 @@ lcp_nakci(f, p, len) * If they Nak the reporting period, take their value XXX ? */ NAKCILQR(CI_QUALITY, neg_lqr, - if (cishort != LQR) + if (cishort != PPP_LQR) try.neg_lqr = 0; else try.lqr_period = cilong; @@ -856,7 +855,7 @@ lcp_rejci(f, p, len) lcp_options *go = &lcp_gotoptions[f->unit]; u_char cichar; u_short cishort; - uint32 cilong; + u_int32_t cilong; u_char *start = p; int plen = len; lcp_options try; /* options to request next time */ @@ -931,7 +930,7 @@ lcp_rejci(f, p, len) GETSHORT(cishort, p); \ GETLONG(cilong, p); \ /* Check rejected value. */ \ - if (cishort != LQR || cilong != val) \ + if (cishort != PPP_LQR || cilong != val) \ goto bad; \ try.neg = 0; \ LCPDEBUG((LOG_INFO,"lcp_rejci rejected LQR opt %d", opt)); \ @@ -939,9 +938,9 @@ lcp_rejci(f, p, len) REJCISHORT(CI_MRU, neg_mru, go->mru); REJCILONG(CI_ASYNCMAP, neg_asyncmap, go->asyncmap); - REJCICHAP(CI_AUTHTYPE, neg_chap, CHAP, go->chap_mdtype); + REJCICHAP(CI_AUTHTYPE, neg_chap, PPP_CHAP, go->chap_mdtype); if (!go->neg_chap) { - REJCISHORT(CI_AUTHTYPE, neg_upap, UPAP); + REJCISHORT(CI_AUTHTYPE, neg_upap, PPP_PAP); } REJCILQR(CI_QUALITY, neg_lqr, go->lqr_period); REJCILONG(CI_MAGICNUMBER, neg_magicnumber, go->magicnumber); @@ -988,7 +987,7 @@ lcp_reqci(f, inp, lenp, reject_if_disagree) u_char *cip, *next; /* Pointer to current and next CIs */ u_char cilen, citype, cichar;/* Parsed len, type, char value */ u_short cishort; /* Parsed short value */ - uint32 cilong; /* Parse long value */ + u_int32_t cilong; /* Parse long value */ int rc = CONFACK; /* Final packet return code */ int orc; /* Individual option return code */ u_char *p; /* Pointer to next char to parse */ @@ -1096,7 +1095,7 @@ lcp_reqci(f, inp, lenp, reject_if_disagree) * the ordering of the CIs in the peer's Configure-Request. */ - if (cishort == UPAP) { + if (cishort == PPP_PAP) { if (!ao->neg_upap || /* we don't want to do PAP */ ho->neg_chap || /* or we've already accepted CHAP */ cilen != CILEN_SHORT) { @@ -1108,7 +1107,7 @@ lcp_reqci(f, inp, lenp, reject_if_disagree) ho->neg_upap = 1; break; } - if (cishort == CHAP) { + if (cishort == PPP_CHAP) { if (!ao->neg_chap || /* we don't want to do CHAP */ ho->neg_upap || /* or we've already accepted UPAP */ cilen != CILEN_CHAP) { @@ -1149,7 +1148,7 @@ lcp_reqci(f, inp, lenp, reject_if_disagree) GETSHORT(cishort, p); GETLONG(cilong, p); LCPDEBUG((LOG_INFO, "(%x %lx)", cishort, cilong)); - if (cishort != LQR) { + if (cishort != PPP_LQR) { orc = CONFREJ; break; } @@ -1279,7 +1278,7 @@ lcp_up(f) * set our MRU to the larger of value we wanted and * the value we got in the negotiation. */ - ppp_send_config(f->unit, MIN(ao->mru, (ho->neg_mru? ho->mru: MTU)), + ppp_send_config(f->unit, MIN(ao->mru, (ho->neg_mru? ho->mru: PPP_MRU)), (ho->neg_asyncmap? ho->asyncmap: 0xffffffff), ho->neg_pcompression, ho->neg_accompression); /* @@ -1287,7 +1286,7 @@ lcp_up(f) * set the receive asyncmap to ffffffff, but we set it to 0 * for backwards contemptibility. */ - ppp_recv_config(f->unit, (go->neg_mru? MAX(wo->mru, go->mru): MTU), + ppp_recv_config(f->unit, (go->neg_mru? MAX(wo->mru, go->mru): PPP_MRU), (go->neg_asyncmap? go->asyncmap: 0x00000000), go->neg_pcompression, go->neg_accompression); @@ -1320,9 +1319,9 @@ lcp_down(f) upap_lowerdown(f->unit); sifdown(f->unit); - ppp_send_config(f->unit, MTU, 0xffffffff, 0, 0); - ppp_recv_config(f->unit, MTU, 0x00000000, 0, 0); - peer_mru[f->unit] = MTU; + ppp_send_config(f->unit, PPP_MRU, 0xffffffff, 0, 0); + ppp_recv_config(f->unit, PPP_MRU, 0x00000000, 0, 0); + peer_mru[f->unit] = PPP_MRU; link_down(f->unit); } @@ -1363,13 +1362,13 @@ int lcp_printpkt(p, plen, printer, arg) u_char *p; int plen; - void (*printer) __ARGS((void *, char *, ...)); + void (*printer) __P((void *, char *, ...)); void *arg; { int code, id, len, olen; u_char *pstart, *optend; u_short cishort; - uint32 cilong; + u_int32_t cilong; if (plen < HEADERLEN) return 0; @@ -1423,10 +1422,10 @@ lcp_printpkt(p, plen, printer, arg) printer(arg, "auth "); GETSHORT(cishort, p); switch (cishort) { - case UPAP: + case PPP_PAP: printer(arg, "upap"); break; - case CHAP: + case PPP_CHAP: printer(arg, "chap"); break; default: @@ -1440,7 +1439,7 @@ lcp_printpkt(p, plen, printer, arg) printer(arg, "quality "); GETSHORT(cishort, p); switch (cishort) { - case LQR: + case PPP_LQR: printer(arg, "lqr"); break; default: @@ -1508,10 +1507,10 @@ static void LcpEchoCheck (f) fsm *f; { - uint32 delta; + u_int32_t delta; #ifdef __linux__ - struct ppp_ddinfo ddinfo; - uint32 latest; + struct ppp_ddinfo ddinfo; + u_int32_t latest; /* * Read the time since the last packet was received. */ @@ -1571,7 +1570,7 @@ lcp_received_echo_reply (f, id, inp, len) fsm *f; int id; u_char *inp; int len; { - uint32 magic; + u_int32_t magic; /* Check the magic number - don't count replies from ourselves. */ if (len < 4) { @@ -1597,7 +1596,7 @@ static void LcpSendEchoRequest (f) fsm *f; { - uint32 lcp_magic; + u_int32_t lcp_magic; u_char pkt[4], *pktp; /* diff --git a/pppd/lcp.h b/pppd/lcp.h index 8593fb8..3712073 100644 --- a/pppd/lcp.h +++ b/pppd/lcp.h @@ -16,7 +16,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: lcp.h,v 1.5 1994/09/01 00:24:45 paulus Exp $ + * $Id: lcp.h,v 1.6 1994/09/21 06:47:37 paulus Exp $ */ /* @@ -55,10 +55,10 @@ typedef struct lcp_options { int neg_lqr : 1; /* Negotiate use of Link Quality Reports */ u_short mru; /* Value of MRU */ u_char chap_mdtype; /* which MD type (hashing algorithm) */ - uint32 asyncmap; /* Value of async map */ - uint32 magicnumber; + u_int32_t asyncmap; /* Value of async map */ + u_int32_t magicnumber; int numloops; /* Number of loops during magic number neg. */ - uint32 lqr_period; /* Reporting period for link quality */ + u_int32_t lqr_period; /* Reporting period for link quality */ } lcp_options; extern fsm lcp_fsm[]; @@ -66,22 +66,22 @@ extern lcp_options lcp_wantoptions[]; extern lcp_options lcp_gotoptions[]; extern lcp_options lcp_allowoptions[]; extern lcp_options lcp_hisoptions[]; -extern uint32 xmit_accm[][8]; +extern u_int32_t xmit_accm[][8]; #define DEFMRU 1500 /* Try for this */ #define MINMRU 128 /* No MRUs below this */ #define MAXMRU 16384 /* Normally limit MRU to this */ -void lcp_init __ARGS((int)); -void lcp_open __ARGS((int)); -void lcp_close __ARGS((int)); -void lcp_lowerup __ARGS((int)); -void lcp_lowerdown __ARGS((int)); -void lcp_input __ARGS((int, u_char *, int)); -void lcp_protrej __ARGS((int)); -void lcp_sprotrej __ARGS((int, u_char *, int)); -int lcp_printpkt __ARGS((u_char *, int, - void (*) __ARGS((void *, char *, ...)), void *)); +void lcp_init __P((int)); +void lcp_open __P((int)); +void lcp_close __P((int)); +void lcp_lowerup __P((int)); +void lcp_lowerdown __P((int)); +void lcp_input __P((int, u_char *, int)); +void lcp_protrej __P((int)); +void lcp_sprotrej __P((int, u_char *, int)); +int lcp_printpkt __P((u_char *, int, + void (*) __P((void *, char *, ...)), void *)); extern int lcp_warnloops; /* Warn about a loopback this often */ #define DEFWARNLOOPS 10 /* Default value for above */ diff --git a/pppd/magic.c b/pppd/magic.c index 18c00bb..7164763 100644 --- a/pppd/magic.c +++ b/pppd/magic.c @@ -18,7 +18,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: magic.c,v 1.2 1994/09/01 00:25:19 paulus Exp $"; +static char rcsid[] = "$Id: magic.c,v 1.3 1994/09/21 06:47:37 paulus Exp $"; #endif #include @@ -28,11 +28,11 @@ static char rcsid[] = "$Id: magic.c,v 1.2 1994/09/01 00:25:19 paulus Exp $"; #include "pppd.h" #include "magic.h" -static uint32 next; /* Next value to return */ +static u_int32_t next; /* Next value to return */ -extern uint32 gethostid __ARGS((void)); -extern long random __ARGS((void)); -extern void srandom __ARGS((int)); +extern u_int32_t gethostid __P((void)); +extern long random __P((void)); +extern void srandom __P((int)); /* @@ -51,7 +51,7 @@ void magic_init() perror("gettimeofday"); exit(1); } - next ^= (uint32) tv.tv_sec ^ (uint32) tv.tv_usec; + next ^= (u_int32_t) tv.tv_sec ^ (u_int32_t) tv.tv_usec; srandom((int) next); } @@ -60,11 +60,11 @@ void magic_init() /* * magic - Returns the next magic number. */ -uint32 magic() +u_int32_t magic() { - uint32 m; + u_int32_t m; m = next; - next = (uint32) random(); + next = (u_int32_t) random(); return (m); } diff --git a/pppd/magic.h b/pppd/magic.h index 4cfa905..a118ca1 100644 --- a/pppd/magic.h +++ b/pppd/magic.h @@ -16,9 +16,8 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: magic.h,v 1.2 1994/09/01 00:25:35 paulus Exp $ + * $Id: magic.h,v 1.3 1994/09/21 06:47:37 paulus Exp $ */ -#include "args.h" -void magic_init __ARGS((void)); /* Initialize the magic number generator */ -uint32 magic __ARGS((void)); /* Returns the next magic number */ +void magic_init __P((void)); /* Initialize the magic number generator */ +u_int32_t magic __P((void)); /* Returns the next magic number */ diff --git a/pppd/main.c b/pppd/main.c index 4d16573..c580f7c 100644 --- a/pppd/main.c +++ b/pppd/main.c @@ -18,7 +18,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: main.c,v 1.18 1994/09/01 00:32:24 paulus Exp $"; +static char rcsid[] = "$Id: main.c,v 1.19 1994/09/21 06:47:37 paulus Exp $"; #endif #include @@ -39,7 +39,6 @@ static char rcsid[] = "$Id: main.c,v 1.18 1994/09/01 00:32:24 paulus Exp $"; #include #include -#include "ppp.h" #include "pppd.h" #include "magic.h" #include "fsm.h" @@ -80,8 +79,8 @@ int open_ccp_flag; static int initfdflags = -1; /* Initial file descriptor flags */ -u_char outpacket_buf[MTU+DLLHEADERLEN]; /* buffer for outgoing packet */ -static u_char inpacket_buf[MTU+DLLHEADERLEN]; /* buffer for incoming packet */ +u_char outpacket_buf[PPP_MRU+PPP_HDRLEN]; /* buffer for outgoing packet */ +static u_char inpacket_buf[PPP_MRU+PPP_HDRLEN]; /* buffer for incoming packet */ int hungup; /* terminal has been hung up */ static int n_children; /* # child processes still running */ @@ -89,29 +88,29 @@ static int n_children; /* # child processes still running */ int baud_rate; /* prototypes */ -static void hup __ARGS((int)); -static void term __ARGS((int)); -static void chld __ARGS((int)); -static void toggle_debug __ARGS((int)); -static void open_ccp __ARGS((int)); - -static void get_input __ARGS((void)); -void establish_ppp __ARGS((void)); -void calltimeout __ARGS((void)); -struct timeval *timeleft __ARGS((struct timeval *)); -void reap_kids __ARGS((void)); -void cleanup __ARGS((int, caddr_t)); -void close_fd __ARGS((void)); -void die __ARGS((int)); -void novm __ARGS((char *)); - -void log_packet __ARGS((u_char *, int, char *)); -void format_packet __ARGS((u_char *, int, +static void hup __P((int)); +static void term __P((int)); +static void chld __P((int)); +static void toggle_debug __P((int)); +static void open_ccp __P((int)); + +static void get_input __P((void)); +void establish_ppp __P((void)); +void calltimeout __P((void)); +struct timeval *timeleft __P((struct timeval *)); +void reap_kids __P((void)); +void cleanup __P((int, caddr_t)); +void close_fd __P((void)); +void die __P((int)); +void novm __P((char *)); + +void log_packet __P((u_char *, int, char *)); +void format_packet __P((u_char *, int, void (*) (void *, char *, ...), void *)); -void pr_log __ARGS((void *, char *, ...)); +void pr_log __P((void *, char *, ...)); -extern char *ttyname __ARGS((int)); -extern char *getlogin __ARGS((void)); +extern char *ttyname __P((int)); +extern char *getlogin __P((void)); /* * PPP Data Link Layer "protocol" table. @@ -126,11 +125,16 @@ static struct protent { void (*datainput)(); char *name; } prottbl[] = { - { LCP, lcp_init, lcp_input, lcp_protrej, lcp_printpkt, NULL, "LCP" }, - { IPCP, ipcp_init, ipcp_input, ipcp_protrej, ipcp_printpkt, NULL, "IPCP" }, - { UPAP, upap_init, upap_input, upap_protrej, upap_printpkt, NULL, "PAP" }, - { CHAP, ChapInit, ChapInput, ChapProtocolReject, ChapPrintPkt, NULL, "CHAP" }, - { CCP, ccp_init, ccp_input, ccp_protrej, ccp_printpkt, ccp_datainput, "CCP" }, + { PPP_LCP, lcp_init, lcp_input, lcp_protrej, + lcp_printpkt, NULL, "LCP" }, + { PPP_IPCP, ipcp_init, ipcp_input, ipcp_protrej, + ipcp_printpkt, NULL, "IPCP" }, + { PPP_PAP, upap_init, upap_input, upap_protrej, + upap_printpkt, NULL, "PAP" }, + { PPP_CHAP, ChapInit, ChapInput, ChapProtocolReject, + ChapPrintPkt, NULL, "CHAP" }, + { PPP_CCP, ccp_init, ccp_input, ccp_protrej, + ccp_printpkt, ccp_datainput, "CCP" }, }; #define N_PROTO (sizeof(prottbl) / sizeof(prottbl[0])) @@ -405,19 +409,19 @@ get_input() if (debug /*&& (debugflags & DBG_INPACKET)*/) log_packet(p, len, "rcvd "); - if (len < DLLHEADERLEN) { + if (len < PPP_HDRLEN) { MAINDEBUG((LOG_INFO, "io(): Received short packet.")); return; } p += 2; /* Skip address and control */ GETSHORT(protocol, p); - len -= DLLHEADERLEN; + len -= PPP_HDRLEN; /* * Toss all non-LCP packets unless LCP is OPEN. */ - if (protocol != LCP && lcp_fsm[0].state != OPENED) { + if (protocol != PPP_LCP && lcp_fsm[0].state != OPENED) { MAINDEBUG((LOG_INFO, "io(): Received non-LCP packet when LCP not open.")); return; @@ -440,7 +444,7 @@ get_input() if (debug) syslog(LOG_WARNING, "Unknown protocol (0x%x) received", protocol); - lcp_sprotrej(0, p - DLLHEADERLEN, len + DLLHEADERLEN); + lcp_sprotrej(0, p - PPP_HDRLEN, len + PPP_HDRLEN); } } } @@ -905,17 +909,17 @@ void format_packet(p, len, printer, arg) u_char *p; int len; - void (*printer) __ARGS((void *, char *, ...)); + void (*printer) __P((void *, char *, ...)); void *arg; { int i, n; u_short proto; u_char x; - if (len >= DLLHEADERLEN && p[0] == ALLSTATIONS && p[1] == UI) { + if (len >= PPP_HDRLEN && p[0] == PPP_ALLSTATIONS && p[1] == PPP_UI) { p += 2; GETSHORT(proto, p); - len -= DLLHEADERLEN; + len -= PPP_HDRLEN; for (i = 0; i < N_PROTO; ++i) if (proto == prottbl[i].protocol) break; @@ -994,7 +998,7 @@ void print_string(p, len, printer, arg) char *p; int len; - void (*printer) __ARGS((void *, char *, ...)); + void (*printer) __P((void *, char *, ...)); void *arg; { int c; diff --git a/pppd/options.c b/pppd/options.c index 6c146a0..909b6d2 100644 --- a/pppd/options.c +++ b/pppd/options.c @@ -18,7 +18,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: options.c,v 1.15 1994/09/16 02:34:52 paulus Exp $"; +static char rcsid[] = "$Id: options.c,v 1.16 1994/09/21 06:47:37 paulus Exp $"; #endif #include @@ -35,7 +35,6 @@ static char rcsid[] = "$Id: options.c,v 1.15 1994/09/16 02:34:52 paulus Exp $"; #include #include -#include "ppp.h" #include "pppd.h" #include "pathnames.h" #include "patchlevel.h" @@ -50,7 +49,7 @@ static char rcsid[] = "$Id: options.c,v 1.15 1994/09/16 02:34:52 paulus Exp $"; #define TRUE 1 #ifdef ultrix -char *strdup __ARGS((char *)); +char *strdup __P((char *)); #endif #ifndef GIDSET_TYPE @@ -67,7 +66,7 @@ char devnam[MAXPATHLEN] = "/dev/tty"; /* Device name */ int crtscts = 0; /* Use hardware flow control */ int modem = 1; /* Use modem control lines */ int inspeed = 0; /* Input/Output speed requested */ -uint32 netmask = 0; /* IP netmask to set on interface */ +u_int32_t netmask = 0; /* IP netmask to set on interface */ int lockflag = 0; /* Create lock file to lock the serial dev */ int nodetach = 0; /* Don't detach from controlling tty */ char *connector = NULL; /* Script to establish physical link */ @@ -89,74 +88,74 @@ int disable_defaultip = 0; /* Don't use hostname for default IP adrs */ /* * Prototypes */ -static int setdebug __ARGS((void)); -static int setkdebug __ARGS((char **)); -static int setpassive __ARGS((void)); -static int setsilent __ARGS((void)); -static int noopt __ARGS((void)); -static int setnovj __ARGS((void)); -static int setnovjccomp __ARGS((void)); -static int setvjslots __ARGS((char **)); -static int reqpap __ARGS((void)); -static int nopap __ARGS((void)); -static int setupapfile __ARGS((char **)); -static int nochap __ARGS((void)); -static int reqchap __ARGS((void)); -static int setspeed __ARGS((char *)); -static int noaccomp __ARGS((void)); -static int noasyncmap __ARGS((void)); -static int noipaddr __ARGS((void)); -static int nomagicnumber __ARGS((void)); -static int setasyncmap __ARGS((char **)); -static int setescape __ARGS((char **)); -static int setmru __ARGS((char **)); -static int setmtu __ARGS((char **)); -static int nomru __ARGS((void)); -static int nopcomp __ARGS((void)); -static int setconnector __ARGS((char **)); -static int setdisconnector __ARGS((char **)); -static int setdomain __ARGS((char **)); -static int setnetmask __ARGS((char **)); -static int setcrtscts __ARGS((void)); -static int setnocrtscts __ARGS((void)); -static int setxonxoff __ARGS((void)); -static int setnodetach __ARGS((void)); -static int setmodem __ARGS((void)); -static int setlocal __ARGS((void)); -static int setlock __ARGS((void)); -static int setname __ARGS((char **)); -static int setuser __ARGS((char **)); -static int setremote __ARGS((char **)); -static int setauth __ARGS((void)); -static int readfile __ARGS((char **)); -static int setdefaultroute __ARGS((void)); -static int setproxyarp __ARGS((void)); -static int setpersist __ARGS((void)); -static int setdologin __ARGS((void)); -static int setusehostname __ARGS((void)); -static int setnoipdflt __ARGS((void)); -static int setlcptimeout __ARGS((char **)); -static int setlcpterm __ARGS((char **)); -static int setlcpconf __ARGS((char **)); -static int setlcpfails __ARGS((char **)); -static int setipcptimeout __ARGS((char **)); -static int setipcpterm __ARGS((char **)); -static int setipcpconf __ARGS((char **)); -static int setipcpfails __ARGS((char **)); -static int setpaptimeout __ARGS((char **)); -static int setpapreqs __ARGS((char **)); -static int setchaptimeout __ARGS((char **)); -static int setchapchal __ARGS((char **)); -static int setchapintv __ARGS((char **)); -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)); +static int setdebug __P((void)); +static int setkdebug __P((char **)); +static int setpassive __P((void)); +static int setsilent __P((void)); +static int noopt __P((void)); +static int setnovj __P((void)); +static int setnovjccomp __P((void)); +static int setvjslots __P((char **)); +static int reqpap __P((void)); +static int nopap __P((void)); +static int setupapfile __P((char **)); +static int nochap __P((void)); +static int reqchap __P((void)); +static int setspeed __P((char *)); +static int noaccomp __P((void)); +static int noasyncmap __P((void)); +static int noipaddr __P((void)); +static int nomagicnumber __P((void)); +static int setasyncmap __P((char **)); +static int setescape __P((char **)); +static int setmru __P((char **)); +static int setmtu __P((char **)); +static int nomru __P((void)); +static int nopcomp __P((void)); +static int setconnector __P((char **)); +static int setdisconnector __P((char **)); +static int setdomain __P((char **)); +static int setnetmask __P((char **)); +static int setcrtscts __P((void)); +static int setnocrtscts __P((void)); +static int setxonxoff __P((void)); +static int setnodetach __P((void)); +static int setmodem __P((void)); +static int setlocal __P((void)); +static int setlock __P((void)); +static int setname __P((char **)); +static int setuser __P((char **)); +static int setremote __P((char **)); +static int setauth __P((void)); +static int readfile __P((char **)); +static int setdefaultroute __P((void)); +static int setproxyarp __P((void)); +static int setpersist __P((void)); +static int setdologin __P((void)); +static int setusehostname __P((void)); +static int setnoipdflt __P((void)); +static int setlcptimeout __P((char **)); +static int setlcpterm __P((char **)); +static int setlcpconf __P((char **)); +static int setlcpfails __P((char **)); +static int setipcptimeout __P((char **)); +static int setipcpterm __P((char **)); +static int setipcpconf __P((char **)); +static int setipcpfails __P((char **)); +static int setpaptimeout __P((char **)); +static int setpapreqs __P((char **)); +static int setchaptimeout __P((char **)); +static int setchapchal __P((char **)); +static int setchapintv __P((char **)); +static int setipcpaccl __P((void)); +static int setipcpaccr __P((void)); +static int setlcpechointv __P((char **)); +static int setlcpechofails __P((char **)); +static int setbsdcomp __P((char **)); +static int setnobsdcomp __P((void)); + +static int number_option __P((char *, long *, int)); +static int readable __P((int fd)); /* * Valid arguments. @@ -1086,7 +1085,7 @@ setipaddr(arg) { struct hostent *hp; char *colon, *index(); - uint32 local, remote; + u_int32_t local, remote; ipcp_options *wo = &ipcp_wantoptions[0]; /* @@ -1189,7 +1188,7 @@ void setipdefault() { struct hostent *hp; - uint32 local; + u_int32_t local; ipcp_options *wo = &ipcp_wantoptions[0]; /* @@ -1219,7 +1218,7 @@ static int setnetmask(argv) char **argv; { - uint32 mask; + u_int32_t mask; if ((mask = inet_addr(*argv)) == -1 || (netmask & ~mask) != 0) { fprintf(stderr, "Invalid netmask %s\n", *argv); @@ -1235,9 +1234,9 @@ setnetmask(argv) * been set. */ /* ARGSUSED */ -uint32 +u_int32_t GetMask(addr) - uint32 addr; + u_int32_t addr; { return(netmask); } diff --git a/pppd/patchlevel.h b/pppd/patchlevel.h index 311d277..fec2c94 100644 --- a/pppd/patchlevel.h +++ b/pppd/patchlevel.h @@ -1,5 +1,6 @@ -/* $Id: patchlevel.h,v 1.11 1994/08/09 06:29:42 paulus Exp $ */ +/* $Id: patchlevel.h,v 1.12 1994/09/21 06:47:37 paulus Exp $ */ #define PATCHLEVEL 0 -#define VERSION "2.2" -#define DATE "9 Aug 94" +#define VERSION "2.2" +#define IMPLEMENTATION "alpha" +#define DATE "20 Sep 94" diff --git a/pppd/pppd.h b/pppd/pppd.h index 4973e14..c2ed667 100644 --- a/pppd/pppd.h +++ b/pppd/pppd.h @@ -16,7 +16,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: pppd.h,v 1.4 1994/09/01 00:36:05 paulus Exp $ + * $Id: pppd.h,v 1.5 1994/09/21 06:47:37 paulus Exp $ */ /* @@ -25,21 +25,12 @@ #ifndef __PPPD_H__ #define __PPPD_H__ -#include "args.h" #include /* for MAXPATHLEN and BSD4_4, if defined */ +#include /* for u_int32_t, if defined */ +#include -#define NPPP 1 /* One PPP interface supported (per process) */ - -/* - * A 32-bit unsigned integral type. - */ - -#ifdef UINT32 -typedef UINT32 uint32; -#else -typedef unsigned long uint32; -#endif +#define N_PPP 1 /* One PPP interface supported (per process) */ /* * Limits. @@ -76,7 +67,7 @@ extern char devnam[]; /* Device name */ extern int crtscts; /* Use hardware flow control */ extern int modem; /* Use modem control lines */ extern int inspeed; /* Input/Output speed requested */ -extern uint32 netmask; /* IP netmask to set on interface */ +extern u_int32_t netmask; /* IP netmask to set on interface */ extern int lockflag; /* Create lock file to lock the serial dev */ extern int nodetach; /* Don't detach from controlling tty */ extern char *connector; /* Script to establish physical link */ @@ -106,21 +97,21 @@ extern int disable_defaultip; /* Don't use hostname for default IP adrs */ /* * Prototypes. */ -void quit __ARGS((void)); /* Cleanup and exit */ -void timeout __ARGS((void (*)(), caddr_t, int)); +void quit __P((void)); /* Cleanup and exit */ +void timeout __P((void (*)(), caddr_t, int)); /* Look-alike of kernel's timeout() */ -void untimeout __ARGS((void (*)(), caddr_t)); +void untimeout __P((void (*)(), caddr_t)); /* Look-alike of kernel's untimeout() */ -void output __ARGS((int, u_char *, int)); +void output __P((int, u_char *, int)); /* Output a PPP packet */ -void demuxprotrej __ARGS((int, int)); +void demuxprotrej __P((int, int)); /* Demultiplex a Protocol-Reject */ -int check_passwd __ARGS((int, char *, int, char *, int, char **, int *)); +int check_passwd __P((int, char *, int, char *, int, char **, int *)); /* Check peer-supplied username/password */ -int get_secret __ARGS((int, char *, char *, char *, int *, int)); +int get_secret __P((int, char *, char *, char *, int *, int)); /* get "secret" for chap */ -uint32 GetMask __ARGS((uint32)); /* get netmask for address */ -void die __ARGS((int)); +u_int32_t GetMask __P((u_int32_t)); /* get netmask for address */ +void die __P((int)); /* * Inline versions of get/put char/short/long. @@ -183,8 +174,8 @@ void die __ARGS((int)); * MAKEHEADER - Add Header fields to a packet. */ #define MAKEHEADER(p, t) { \ - PUTCHAR(ALLSTATIONS, p); \ - PUTCHAR(UI, p); \ + PUTCHAR(PPP_ALLSTATIONS, p); \ + PUTCHAR(PPP_UI, p); \ PUTSHORT(t, p); } diff --git a/pppd/sys-bsd.c b/pppd/sys-bsd.c index df9dfba..872986a 100644 --- a/pppd/sys-bsd.c +++ b/pppd/sys-bsd.c @@ -19,7 +19,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: sys-bsd.c,v 1.12 1994/09/16 02:35:27 paulus Exp $"; +static char rcsid[] = "$Id: sys-bsd.c,v 1.13 1994/09/21 06:47:37 paulus Exp $"; #endif /* @@ -35,6 +35,7 @@ static char rcsid[] = "$Id: sys-bsd.c,v 1.12 1994/09/16 02:35:27 paulus Exp $"; #include #include +#include #include #include #include @@ -45,7 +46,6 @@ static char rcsid[] = "$Id: sys-bsd.c,v 1.12 1994/09/16 02:35:27 paulus Exp $"; #endif #include "pppd.h" -#include "ppp.h" static int initdisc = -1; /* Initial TTY discipline */ static int rtm_seq; @@ -325,7 +325,7 @@ read_packet(buf) { int len; - if ((len = read(fd, buf, MTU + DLLHEADERLEN)) < 0) { + if ((len = read(fd, buf, PPP_MTU + PPP_HDRLEN)) < 0) { if (errno == EWOULDBLOCK) { MAINDEBUG((LOG_DEBUG, "read(fd): EWOULDBLOCK")); return -1; @@ -344,7 +344,7 @@ read_packet(buf) void ppp_send_config(unit, mtu, asyncmap, pcomp, accomp) int unit, mtu; - uint32 asyncmap; + u_int32_t asyncmap; int pcomp, accomp; { u_int x; @@ -395,7 +395,7 @@ ppp_set_xaccm(unit, accm) void ppp_recv_config(unit, mru, asyncmap, pcomp, accomp) int unit, mru; - uint32 asyncmap; + u_int32_t asyncmap; int pcomp, accomp; { int x; @@ -603,7 +603,7 @@ sifdown(u) int sifaddr(u, o, h, m) int u; - uint32 o, h, m; + u_int32_t o, h, m; { struct ifaliasreq ifra; @@ -634,7 +634,7 @@ sifaddr(u, o, h, m) int cifaddr(u, o, h) int u; - uint32 o, h; + u_int32_t o, h; { struct ifaliasreq ifra; @@ -657,7 +657,7 @@ cifaddr(u, o, h) int sifdefaultroute(u, g) int u; - uint32 g; + u_int32_t g; { return dodefaultroute(g, 's'); } @@ -668,7 +668,7 @@ sifdefaultroute(u, g) int cifdefaultroute(u, g) int u; - uint32 g; + u_int32_t g; { return dodefaultroute(g, 'c'); } @@ -678,7 +678,7 @@ cifdefaultroute(u, g) */ int dodefaultroute(g, cmd) - uint32 g; + u_int32_t g; int cmd; { int routes; @@ -736,7 +736,7 @@ static int arpmsg_valid; int sifproxyarp(unit, hisaddr) int unit; - uint32 hisaddr; + u_int32_t hisaddr; { int routes; int l; @@ -786,7 +786,7 @@ sifproxyarp(unit, hisaddr) int cifproxyarp(unit, hisaddr) int unit; - uint32 hisaddr; + u_int32_t hisaddr; { int routes; @@ -820,7 +820,7 @@ cifproxyarp(unit, hisaddr) int sifproxyarp(unit, hisaddr) int unit; - uint32 hisaddr; + u_int32_t hisaddr; { struct arpreq arpreq; struct { @@ -859,7 +859,7 @@ sifproxyarp(unit, hisaddr) int cifproxyarp(unit, hisaddr) int unit; - uint32 hisaddr; + u_int32_t hisaddr; { struct arpreq arpreq; @@ -883,11 +883,11 @@ cifproxyarp(unit, hisaddr) int get_ether_addr(ipaddr, hwaddr) - uint32 ipaddr; + u_int32_t ipaddr; struct sockaddr_dl *hwaddr; { struct ifreq *ifr, *ifend, *ifp; - uint32 ina, mask; + u_int32_t ina, mask; struct sockaddr_dl *dla; struct ifreq ifreq; struct ifconf ifc; diff --git a/pppd/sys-linux.c b/pppd/sys-linux.c index 4d6c171..8251f48 100644 --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c @@ -36,6 +36,7 @@ #include #include +#include #include #include #include @@ -44,7 +45,6 @@ #include #include "pppd.h" -#include "ppp.h" #include "fsm.h" #include "ipcp.h" @@ -457,7 +457,7 @@ int read_packet (unsigned char *buf) { int len; - len = read(fd, buf, MTU + DLLHEADERLEN); + len = read(fd, buf, PPP_MTU + PPP_HDRLEN); if (len < 0) { if (errno == EWOULDBLOCK) { #if 0 @@ -475,7 +475,7 @@ int read_packet (unsigned char *buf) * ppp_send_config - configure the transmit characteristics of * the ppp interface. */ -void ppp_send_config (int unit,int mtu,uint32 asyncmap,int pcomp,int accomp) +void ppp_send_config (int unit,int mtu,u_int32_t asyncmap,int pcomp,int accomp) { u_int x; struct ifreq ifr; @@ -527,7 +527,7 @@ ppp_set_xaccm(unit, accm) * ppp_recv_config - configure the receive-side characteristics of * the ppp interface. */ -void ppp_recv_config (int unit,int mru,uint32 asyncmap,int pcomp,int accomp) +void ppp_recv_config (int unit,int mru,u_int32_t asyncmap,int pcomp,int accomp) { u_int x; @@ -957,7 +957,7 @@ int cifdefaultroute (int unit, int gateway) * sifproxyarp - Make a proxy ARP entry for the peer. */ -int sifproxyarp (int unit, uint32 his_adr) +int sifproxyarp (int unit, u_int32_t his_adr) { struct arpreq arpreq; @@ -986,7 +986,7 @@ int sifproxyarp (int unit, uint32 his_adr) * cifproxyarp - Delete the proxy ARP entry for the peer. */ -int cifproxyarp (int unit, uint32 his_adr) +int cifproxyarp (int unit, u_int32_t his_adr) { struct arpreq arpreq; @@ -1006,11 +1006,11 @@ int cifproxyarp (int unit, uint32 his_adr) * the same subnet as ipaddr. */ -int get_ether_addr (uint32 ipaddr, struct sockaddr *hwaddr) +int get_ether_addr (u_int32_t ipaddr, struct sockaddr *hwaddr) { struct ifreq *ifr, *ifend, *ifp; int i; - uint32 ina, mask; + u_int32_t ina, mask; struct sockaddr_dl *dla; struct ifreq ifreq; struct ifconf ifc; diff --git a/pppd/sys-str.c b/pppd/sys-str.c index 2dc7e96..04a8816 100644 --- a/pppd/sys-str.c +++ b/pppd/sys-str.c @@ -19,7 +19,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: sys-str.c,v 1.13 1994/09/16 02:35:42 paulus Exp $"; +static char rcsid[] = "$Id: sys-str.c,v 1.14 1994/09/21 06:47:37 paulus Exp $"; #endif /* @@ -43,13 +43,13 @@ static char rcsid[] = "$Id: sys-str.c,v 1.13 1994/09/16 02:35:42 paulus Exp $"; #include #include +#include +#include #include #include #include #include "pppd.h" -#include "ppp.h" -#include #ifndef ifr_mtu #define ifr_mtu ifr_metric @@ -516,7 +516,7 @@ read_packet(buf) int len, i; unsigned char ctlbuf[16]; - str.maxlen = MTU+DLLHEADERLEN; + str.maxlen = PPP_MTU + PPP_HDRLEN; str.buf = (caddr_t) buf; ctl.maxlen = sizeof(ctlbuf); ctl.buf = (caddr_t) ctlbuf; @@ -551,7 +551,7 @@ read_packet(buf) void ppp_send_config(unit, mtu, asyncmap, pcomp, accomp) int unit, mtu; - uint32 asyncmap; + u_int32_t asyncmap; int pcomp, accomp; { char c; @@ -603,7 +603,7 @@ ppp_set_xaccm(unit, accm) void ppp_recv_config(unit, mru, asyncmap, pcomp, accomp) int unit, mru; - uint32 asyncmap; + u_int32_t asyncmap; int pcomp, accomp; { char c; @@ -750,7 +750,7 @@ sifdown(u) int sifaddr(u, o, h, m) int u; - uint32 o, h, m; + u_int32_t o, h, m; { int ret; struct ifreq ifr; @@ -786,7 +786,7 @@ sifaddr(u, o, h, m) int cifaddr(u, o, h) int u; - uint32 o, h; + u_int32_t o, h; { struct rtentry rt; @@ -808,7 +808,7 @@ cifaddr(u, o, h) int sifdefaultroute(u, g) int u; - uint32 g; + u_int32_t g; { struct rtentry rt; @@ -829,7 +829,7 @@ sifdefaultroute(u, g) int cifdefaultroute(u, g) int u; - uint32 g; + u_int32_t g; { struct rtentry rt; @@ -850,7 +850,7 @@ cifdefaultroute(u, g) int sifproxyarp(unit, hisaddr) int unit; - uint32 hisaddr; + u_int32_t hisaddr; { struct arpreq arpreq; @@ -882,7 +882,7 @@ sifproxyarp(unit, hisaddr) int cifproxyarp(unit, hisaddr) int unit; - uint32 hisaddr; + u_int32_t hisaddr; { struct arpreq arpreq; @@ -953,7 +953,7 @@ static void kread(); int get_ether_addr(ipaddr, hwaddr) - uint32 ipaddr; + u_int32_t ipaddr; struct sockaddr *hwaddr; { register kvm_t *kd; @@ -969,7 +969,7 @@ get_ether_addr(ipaddr, hwaddr) struct in_ifaddr in; } ifaddr; #endif - uint32 addr, mask; + u_int32_t addr, mask; /* Open kernel memory for reading */ kd = kvm_open(0, 0, 0, O_RDONLY, NULL); @@ -996,7 +996,7 @@ get_ether_addr(ipaddr, hwaddr) syslog(LOG_ERR, "error reading ifnet addr"); return 0; } - for ( ; addr; addr = (uint32)ifp->if_next) { + for ( ; addr; addr = (u_int32_t)ifp->if_next) { if (kvm_read(kd, addr, (char *)ac, sizeof(*ac)) != sizeof(*ac)) { syslog(LOG_ERR, "error reading ifnet"); return 0; @@ -1013,7 +1013,7 @@ get_ether_addr(ipaddr, hwaddr) /* Get interface ip address */ #ifdef SUNOS4 - if (kvm_read(kd, (uint32)ifp->if_addrlist, (char *)&ifaddr, + if (kvm_read(kd, (u_int32_t)ifp->if_addrlist, (char *)&ifaddr, sizeof(ifaddr)) != sizeof(ifaddr)) { syslog(LOG_ERR, "error reading ifaddr"); return 0; diff --git a/pppd/sys-ultrix.c b/pppd/sys-ultrix.c index cad794b..dd84961 100644 --- a/pppd/sys-ultrix.c +++ b/pppd/sys-ultrix.c @@ -19,7 +19,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: sys-ultrix.c,v 1.5 1994/09/01 00:39:09 paulus Exp $"; +static char rcsid[] = "$Id: sys-ultrix.c,v 1.6 1994/09/21 06:47:37 paulus Exp $"; #endif /* @@ -39,13 +39,12 @@ static char rcsid[] = "$Id: sys-ultrix.c,v 1.5 1994/09/01 00:39:09 paulus Exp $" #include #include - +#include #include #include #include #include "pppd.h" -#include "ppp.h" static int initdisc = -1; /* Initial TTY discipline */ @@ -409,7 +408,7 @@ read_packet(buf) { int len; - if ((len = read(fd, buf, MTU + DLLHEADERLEN)) < 0) { + if ((len = read(fd, buf, PPP_MTU + PPP_HDRLEN)) < 0) { if (errno == EWOULDBLOCK) { MAINDEBUG((LOG_DEBUG, "read(fd): EWOULDBLOCK")); return -1; @@ -428,7 +427,7 @@ read_packet(buf) void ppp_send_config(unit, mtu, asyncmap, pcomp, accomp) int unit, mtu; - uint32 asyncmap; + u_int32_t asyncmap; int pcomp, accomp; { u_int x; @@ -479,7 +478,7 @@ ppp_set_xaccm(unit, accm) void ppp_recv_config(unit, mru, asyncmap, pcomp, accomp) int unit, mru; - uint32 asyncmap; + u_int32_t asyncmap; int pcomp, accomp; { int x; @@ -717,7 +716,7 @@ cifdefaultroute(u, g) int sifproxyarp(unit, hisaddr) int unit; - uint32 hisaddr; + u_int32_t hisaddr; { struct arpreq arpreq; @@ -749,7 +748,7 @@ sifproxyarp(unit, hisaddr) int cifproxyarp(unit, hisaddr) int unit; - uint32 hisaddr; + u_int32_t hisaddr; { struct arpreq arpreq; @@ -771,11 +770,11 @@ cifproxyarp(unit, hisaddr) int get_ether_addr(ipaddr, hwaddr) - uint32 ipaddr; + u_int32_t ipaddr; struct sockaddr *hwaddr; { struct ifreq *ifr, *ifend, *ifp; - uint32 ina, mask; + u_int32_t ina, mask; struct sockaddr_dl *dla; struct ifreq ifreq; struct ifconf ifc; diff --git a/pppd/upap.c b/pppd/upap.c index 61d22ac..4128866 100644 --- a/pppd/upap.c +++ b/pppd/upap.c @@ -18,7 +18,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: upap.c,v 1.2 1994/04/11 07:13:44 paulus Exp $"; +static char rcsid[] = "$Id: upap.c,v 1.3 1994/09/21 06:47:37 paulus Exp $"; #endif /* @@ -30,20 +30,19 @@ static char rcsid[] = "$Id: upap.c,v 1.2 1994/04/11 07:13:44 paulus Exp $"; #include #include -#include "ppp.h" #include "pppd.h" #include "upap.h" -upap_state upap[NPPP]; /* UPAP state; one for each unit */ +upap_state upap[N_PPP]; /* UPAP state; one for each unit */ -static void upap_timeout __ARGS((caddr_t)); -static void upap_rauthreq __ARGS((upap_state *, u_char *, int, int)); -static void upap_rauthack __ARGS((upap_state *, u_char *, int, int)); -static void upap_rauthnak __ARGS((upap_state *, u_char *, int, int)); -static void upap_sauthreq __ARGS((upap_state *)); -static void upap_sresp __ARGS((upap_state *, int, int, char *, int)); +static void upap_timeout __P((caddr_t)); +static void upap_rauthreq __P((upap_state *, u_char *, int, int)); +static void upap_rauthack __P((upap_state *, u_char *, int, int)); +static void upap_rauthnak __P((upap_state *, u_char *, int, int)); +static void upap_sauthreq __P((upap_state *)); +static void upap_sresp __P((upap_state *, int, int, char *, int)); /* @@ -136,7 +135,7 @@ upap_timeout(arg) /* give up in disgust */ syslog(LOG_ERR, "No response to PAP authenticate-requests"); u->us_clientstate = UPAPCS_BADAUTH; - auth_withpeer_fail(u->us_unit, UPAP); + auth_withpeer_fail(u->us_unit, PPP_PAP); return; } @@ -200,11 +199,11 @@ upap_protrej(unit) if (u->us_clientstate == UPAPCS_AUTHREQ) { syslog(LOG_ERR, "PAP authentication failed due to protocol-reject"); - auth_withpeer_fail(unit, UPAP); + auth_withpeer_fail(unit, PPP_PAP); } if (u->us_serverstate == UPAPSS_LISTEN) { syslog(LOG_ERR, "PAP authentication of peer failed (protocol-reject)"); - auth_peer_fail(unit, UPAP); + auth_peer_fail(unit, PPP_PAP); } upap_lowerdown(unit); } @@ -334,10 +333,10 @@ upap_rauthreq(u, inp, id, len) if (retcode == UPAP_AUTHACK) { u->us_serverstate = UPAPSS_OPEN; - auth_peer_success(u->us_unit, UPAP); + auth_peer_success(u->us_unit, PPP_PAP); } else { u->us_serverstate = UPAPSS_BADAUTH; - auth_peer_fail(u->us_unit, UPAP); + auth_peer_fail(u->us_unit, PPP_PAP); } } @@ -377,7 +376,7 @@ upap_rauthack(u, inp, id, len) u->us_clientstate = UPAPCS_OPEN; - auth_withpeer_success(u->us_unit, UPAP); + auth_withpeer_success(u->us_unit, PPP_PAP); } @@ -417,7 +416,7 @@ upap_rauthnak(u, inp, id, len) u->us_clientstate = UPAPCS_BADAUTH; syslog(LOG_ERR, "PAP authentication failed"); - auth_withpeer_fail(u->us_unit, UPAP); + auth_withpeer_fail(u->us_unit, PPP_PAP); } @@ -435,7 +434,7 @@ upap_sauthreq(u) u->us_userlen + u->us_passwdlen; outp = outpacket_buf; - MAKEHEADER(outp, UPAP); + MAKEHEADER(outp, PPP_PAP); PUTCHAR(UPAP_AUTHREQ, outp); PUTCHAR(++u->us_id, outp); @@ -446,7 +445,7 @@ upap_sauthreq(u) PUTCHAR(u->us_passwdlen, outp); BCOPY(u->us_passwd, outp, u->us_passwdlen); - output(u->us_unit, outpacket_buf, outlen + DLLHEADERLEN); + output(u->us_unit, outpacket_buf, outlen + PPP_HDRLEN); UPAPDEBUG((LOG_INFO, "upap_sauth: Sent id %d.", u->us_id)); @@ -471,14 +470,14 @@ upap_sresp(u, code, id, msg, msglen) outlen = UPAP_HEADERLEN + sizeof (u_char) + msglen; outp = outpacket_buf; - MAKEHEADER(outp, UPAP); + MAKEHEADER(outp, PPP_PAP); PUTCHAR(code, outp); PUTCHAR(id, outp); PUTSHORT(outlen, outp); PUTCHAR(msglen, outp); BCOPY(msg, outp, msglen); - output(u->us_unit, outpacket_buf, outlen + DLLHEADERLEN); + output(u->us_unit, outpacket_buf, outlen + PPP_HDRLEN); UPAPDEBUG((LOG_INFO, "upap_sresp: Sent code %d, id %d.", code, id)); } @@ -494,7 +493,7 @@ int upap_printpkt(p, plen, printer, arg) u_char *p; int plen; - void (*printer) __ARGS((void *, char *, ...)); + void (*printer) __P((void *, char *, ...)); void *arg; { int code, id, len; diff --git a/pppd/upap.h b/pppd/upap.h index 10c3414..4dfdeaf 100644 --- a/pppd/upap.h +++ b/pppd/upap.h @@ -16,7 +16,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: upap.h,v 1.2 1994/04/11 07:13:44 paulus Exp $ + * $Id: upap.h,v 1.3 1994/09/21 06:47:37 paulus Exp $ */ /* @@ -80,12 +80,12 @@ typedef struct upap_state { extern upap_state upap[]; -void upap_init __ARGS((int)); -void upap_authwithpeer __ARGS((int, char *, char *)); -void upap_authpeer __ARGS((int)); -void upap_lowerup __ARGS((int)); -void upap_lowerdown __ARGS((int)); -void upap_input __ARGS((int, u_char *, int)); -void upap_protrej __ARGS((int)); -int upap_printpkt __ARGS((u_char *, int, - void (*) __ARGS((void *, char *, ...)), void *)); +void upap_init __P((int)); +void upap_authwithpeer __P((int, char *, char *)); +void upap_authpeer __P((int)); +void upap_lowerup __P((int)); +void upap_lowerdown __P((int)); +void upap_input __P((int, u_char *, int)); +void upap_protrej __P((int)); +int upap_printpkt __P((u_char *, int, + void (*) __P((void *, char *, ...)), void *)); -- 2.39.2