*/
#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 <stdio.h>
#include <netinet/in.h>
#include <arpa/inet.h>
-#include "ppp.h"
#include "pppd.h"
#include "fsm.h"
#include "lcp.h"
#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
#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.
int bit;
switch (protocol) {
- case CHAP:
+ case PPP_CHAP:
bit = CHAP_PEER;
break;
- case UPAP:
+ case PPP_PAP:
bit = UPAP_PEER;
break;
default:
int bit;
switch (protocol) {
- case CHAP:
+ case PPP_CHAP:
bit = CHAP_WITHPEER;
break;
- case UPAP:
+ case PPP_PAP:
bit = UPAP_WITHPEER;
break;
default:
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;
addrs->word);
continue;
} else
- a = *(uint32 *)hp->h_addr;
+ a = *(u_int32_t *)hp->h_addr;
}
if (addr == a)
return 1;
*/
int
bad_ip_adrs(addr)
- uint32 addr;
+ u_int32_t addr;
{
addr = ntohl(addr);
return (addr >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET
*/
#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 <syslog.h>
#include <sys/ioctl.h>
#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,
/*
* 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 */
fsm *f = &ccp_fsm[unit];
f->unit = unit;
- f->protocol = CCP;
+ f->protocol = PPP_CCP;
f->callbacks = &ccp_callbacks;
fsm_init(f);
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;
/*
* 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 $
*/
/*
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));
*/
#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
/*
#include <sys/time.h>
#include <syslog.h>
-#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.
/* 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;
}
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 */
}
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);
} 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);
}
}
cstate->clientstate = CHAPCS_OPEN;
- auth_withpeer_success(cstate->unit, CHAP);
+ auth_withpeer_success(cstate->unit, PPP_CHAP);
}
PRINTMSG(inp, len);
syslog(LOG_ERR, "CHAP authentication failed");
- auth_withpeer_fail(cstate->unit, CHAP);
+ auth_withpeer_fail(cstate->unit, PPP_CHAP);
}
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);
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));
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));
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 */
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);
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;
* 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__
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__ */
*/
#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
/*
#include <sys/types.h>
#include <syslog.h>
-#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];
/*
/*
* 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 )
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));
* 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 $
*/
/*
/*
* 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));
/*
*/
#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
/*
#include <sys/socket.h>
#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 */
*/
char *
ip_ntoa(ipaddr)
-uint32 ipaddr;
+u_int32_t ipaddr;
{
static char b[64];
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]);
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); \
{
ipcp_options *go = &ipcp_gotoptions[f->unit];
u_short cilen, citype, cishort;
- uint32 cilong;
+ u_int32_t cilong;
u_char cimaxslotindex, cicflag;
/*
#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); \
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 */
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;
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); \
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 */
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];
ipcp_down(f)
fsm *f;
{
- uint32 ouraddr, hisaddr;
+ u_int32_t ouraddr, hisaddr;
IPCPDEBUG((LOG_INFO, "ipcp: down"));
int code, id, len, olen;
u_char *pstart, *optend;
u_short cishort;
- uint32 cilong;
+ u_int32_t cilong;
if (plen < HEADERLEN)
return 0;
* 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 $
*/
/*
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[];
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 *));
*/
#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
/*
#include <netinet/in.h>
#include "pppd.h"
-#include "ppp.h"
#include "fsm.h"
#include "lcp.h"
#include "magic.h"
#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 */
lcp_options *ao = &lcp_allowoptions[unit];
f->unit = unit;
- f->protocol = LCP;
+ f->protocol = PPP_LCP;
f->callbacks = &lcp_callbacks;
fsm_init(f);
{
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]);
* 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);
}
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;
}
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);
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.
citype != opt) \
goto bad; \
GETSHORT(cishort, p); \
- if (cishort != LQR) \
+ if (cishort != PPP_LQR) \
goto bad; \
GETLONG(cilong, p); \
if (cilong != val) \
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);
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;
* 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;
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 */
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)); \
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);
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 */
* 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) {
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) {
GETSHORT(cishort, p);
GETLONG(cilong, p);
LCPDEBUG((LOG_INFO, "(%x %lx)", cishort, cilong));
- if (cishort != LQR) {
+ if (cishort != PPP_LQR) {
orc = CONFREJ;
break;
}
* 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);
/*
* 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);
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);
}
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;
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:
printer(arg, "quality ");
GETSHORT(cishort, p);
switch (cishort) {
- case LQR:
+ case PPP_LQR:
printer(arg, "lqr");
break;
default:
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.
*/
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) {
LcpSendEchoRequest (f)
fsm *f;
{
- uint32 lcp_magic;
+ u_int32_t lcp_magic;
u_char pkt[4], *pktp;
/*
* 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 $
*/
/*
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[];
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 */
*/
#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 <stdio.h>
#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));
/*
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);
}
/*
* 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);
}
* 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 */
*/
#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 <stdio.h>
#include <sys/socket.h>
#include <net/if.h>
-#include "ppp.h"
#include "pppd.h"
#include "magic.h"
#include "fsm.h"
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 */
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.
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]))
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;
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);
}
}
}
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;
print_string(p, len, printer, arg)
char *p;
int len;
- void (*printer) __ARGS((void *, char *, ...));
+ void (*printer) __P((void *, char *, ...));
void *arg;
{
int c;
*/
#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 <stdio.h>
#include <sys/stat.h>
#include <netinet/in.h>
-#include "ppp.h"
#include "pppd.h"
#include "pathnames.h"
#include "patchlevel.h"
#define TRUE 1
#ifdef ultrix
-char *strdup __ARGS((char *));
+char *strdup __P((char *));
#endif
#ifndef GIDSET_TYPE
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 */
/*
* 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.
{
struct hostent *hp;
char *colon, *index();
- uint32 local, remote;
+ u_int32_t local, remote;
ipcp_options *wo = &ipcp_wantoptions[0];
/*
setipdefault()
{
struct hostent *hp;
- uint32 local;
+ u_int32_t local;
ipcp_options *wo = &ipcp_wantoptions[0];
/*
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);
* been set.
*/
/* ARGSUSED */
-uint32
+u_int32_t
GetMask(addr)
- uint32 addr;
+ u_int32_t addr;
{
return(netmask);
}
-/* $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"
* 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 $
*/
/*
#ifndef __PPPD_H__
#define __PPPD_H__
-#include "args.h"
#include <sys/param.h> /* for MAXPATHLEN and BSD4_4, if defined */
+#include <sys/types.h> /* for u_int32_t, if defined */
+#include <net/ppp_defs.h>
-#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.
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 */
/*
* 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.
* 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); }
*/
#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
/*
#include <sys/errno.h>
#include <net/if.h>
+#include <net/ppp_defs.h>
#include <net/if_ppp.h>
#include <net/route.h>
#include <net/if_dl.h>
#endif
#include "pppd.h"
-#include "ppp.h"
static int initdisc = -1; /* Initial TTY discipline */
static int rtm_seq;
{
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;
void
ppp_send_config(unit, mtu, asyncmap, pcomp, accomp)
int unit, mtu;
- uint32 asyncmap;
+ u_int32_t asyncmap;
int pcomp, accomp;
{
u_int x;
void
ppp_recv_config(unit, mru, asyncmap, pcomp, accomp)
int unit, mru;
- uint32 asyncmap;
+ u_int32_t asyncmap;
int pcomp, accomp;
{
int x;
int
sifaddr(u, o, h, m)
int u;
- uint32 o, h, m;
+ u_int32_t o, h, m;
{
struct ifaliasreq ifra;
int
cifaddr(u, o, h)
int u;
- uint32 o, h;
+ u_int32_t o, h;
{
struct ifaliasreq ifra;
int
sifdefaultroute(u, g)
int u;
- uint32 g;
+ u_int32_t g;
{
return dodefaultroute(g, 's');
}
int
cifdefaultroute(u, g)
int u;
- uint32 g;
+ u_int32_t g;
{
return dodefaultroute(g, 'c');
}
*/
int
dodefaultroute(g, cmd)
- uint32 g;
+ u_int32_t g;
int cmd;
{
int routes;
int
sifproxyarp(unit, hisaddr)
int unit;
- uint32 hisaddr;
+ u_int32_t hisaddr;
{
int routes;
int l;
int
cifproxyarp(unit, hisaddr)
int unit;
- uint32 hisaddr;
+ u_int32_t hisaddr;
{
int routes;
int
sifproxyarp(unit, hisaddr)
int unit;
- uint32 hisaddr;
+ u_int32_t hisaddr;
{
struct arpreq arpreq;
struct {
int
cifproxyarp(unit, hisaddr)
int unit;
- uint32 hisaddr;
+ u_int32_t hisaddr;
{
struct arpreq arpreq;
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;
#include <mntent.h>
#include <net/if.h>
+#include <net/ppp_defs.h>
#include <net/if_arp.h>
#include <linux/ppp.h>
#include <linux/route.h>
#include <signal.h>
#include "pppd.h"
-#include "ppp.h"
#include "fsm.h"
#include "ipcp.h"
{
int len;
- len = read(fd, buf, MTU + DLLHEADERLEN);
+ len = read(fd, buf, PPP_MTU + PPP_HDRLEN);
if (len < 0) {
if (errno == EWOULDBLOCK) {
#if 0
* 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;
* 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;
* 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;
* 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;
* 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;
*/
#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
/*
#include <sys/stropts.h>
#include <net/if.h>
+#include <net/ppp_defs.h>
+#include <net/ppp_str.h>
#include <net/route.h>
#include <net/if_arp.h>
#include <netinet/in.h>
#include "pppd.h"
-#include "ppp.h"
-#include <net/ppp_str.h>
#ifndef ifr_mtu
#define ifr_mtu ifr_metric
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;
void
ppp_send_config(unit, mtu, asyncmap, pcomp, accomp)
int unit, mtu;
- uint32 asyncmap;
+ u_int32_t asyncmap;
int pcomp, accomp;
{
char c;
void
ppp_recv_config(unit, mru, asyncmap, pcomp, accomp)
int unit, mru;
- uint32 asyncmap;
+ u_int32_t asyncmap;
int pcomp, accomp;
{
char c;
int
sifaddr(u, o, h, m)
int u;
- uint32 o, h, m;
+ u_int32_t o, h, m;
{
int ret;
struct ifreq ifr;
int
cifaddr(u, o, h)
int u;
- uint32 o, h;
+ u_int32_t o, h;
{
struct rtentry rt;
int
sifdefaultroute(u, g)
int u;
- uint32 g;
+ u_int32_t g;
{
struct rtentry rt;
int
cifdefaultroute(u, g)
int u;
- uint32 g;
+ u_int32_t g;
{
struct rtentry rt;
int
sifproxyarp(unit, hisaddr)
int unit;
- uint32 hisaddr;
+ u_int32_t hisaddr;
{
struct arpreq arpreq;
int
cifproxyarp(unit, hisaddr)
int unit;
- uint32 hisaddr;
+ u_int32_t hisaddr;
{
struct arpreq arpreq;
int
get_ether_addr(ipaddr, hwaddr)
- uint32 ipaddr;
+ u_int32_t ipaddr;
struct sockaddr *hwaddr;
{
register kvm_t *kd;
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);
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;
/* 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;
*/
#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
/*
#include <sys/stat.h>
#include <net/if.h>
-
+#include <net/ppp_defs.h>
#include <net/if_ppp.h>
#include <net/route.h>
#include <netinet/in.h>
#include "pppd.h"
-#include "ppp.h"
static int initdisc = -1; /* Initial TTY discipline */
{
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;
void
ppp_send_config(unit, mtu, asyncmap, pcomp, accomp)
int unit, mtu;
- uint32 asyncmap;
+ u_int32_t asyncmap;
int pcomp, accomp;
{
u_int x;
void
ppp_recv_config(unit, mru, asyncmap, pcomp, accomp)
int unit, mru;
- uint32 asyncmap;
+ u_int32_t asyncmap;
int pcomp, accomp;
{
int x;
int
sifproxyarp(unit, hisaddr)
int unit;
- uint32 hisaddr;
+ u_int32_t hisaddr;
{
struct arpreq arpreq;
int
cifproxyarp(unit, hisaddr)
int unit;
- uint32 hisaddr;
+ u_int32_t hisaddr;
{
struct arpreq arpreq;
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;
*/
#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
/*
#include <sys/time.h>
#include <syslog.h>
-#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));
/*
/* 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;
}
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);
}
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);
}
}
u->us_clientstate = UPAPCS_OPEN;
- auth_withpeer_success(u->us_unit, UPAP);
+ auth_withpeer_success(u->us_unit, PPP_PAP);
}
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);
}
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);
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));
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));
}
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;
* 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 $
*/
/*
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 *));