mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-08-03 21:14:40 +08:00
Minor changes in PPP (coding style, tabs, idents...)
This commit is contained in:
parent
a3ef33c56f
commit
fc2d28b851
@ -28,7 +28,7 @@
|
|||||||
* 03-01-01 Marc Boucher <marc@mbsi.ca>
|
* 03-01-01 Marc Boucher <marc@mbsi.ca>
|
||||||
* Ported to lwIP.
|
* Ported to lwIP.
|
||||||
* 97-12-04 Guy Lancaster <lancasterg@acm.org>, Global Election Systems Inc.
|
* 97-12-04 Guy Lancaster <lancasterg@acm.org>, Global Election Systems Inc.
|
||||||
* Original derived from BSD pppd.h.
|
* Original derived from BSD pppd.h.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
/*
|
/*
|
||||||
* pppd.h - PPP daemon global declarations.
|
* pppd.h - PPP daemon global declarations.
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
* 03-01-01 Marc Boucher <marc@mbsi.ca>
|
* 03-01-01 Marc Boucher <marc@mbsi.ca>
|
||||||
* Ported to lwIP.
|
* Ported to lwIP.
|
||||||
* 97-12-04 Guy Lancaster <lancasterg@acm.org>, Global Election Systems Inc.
|
* 97-12-04 Guy Lancaster <lancasterg@acm.org>, Global Election Systems Inc.
|
||||||
* Original based on BSD chap.c.
|
* Original based on BSD chap.c.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
/*
|
/*
|
||||||
* chap.c - Challenge Handshake Authentication Protocol.
|
* chap.c - Challenge Handshake Authentication Protocol.
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
* 03-01-01 Marc Boucher <marc@mbsi.ca>
|
* 03-01-01 Marc Boucher <marc@mbsi.ca>
|
||||||
* Ported to lwIP.
|
* Ported to lwIP.
|
||||||
* 97-12-03 Guy Lancaster <lancasterg@acm.org>, Global Election Systems Inc.
|
* 97-12-03 Guy Lancaster <lancasterg@acm.org>, Global Election Systems Inc.
|
||||||
* Original built from BSD network code.
|
* Original built from BSD network code.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
/*
|
/*
|
||||||
* chap.h - Challenge Handshake Authentication Protocol definitions.
|
* chap.h - Challenge Handshake Authentication Protocol definitions.
|
||||||
@ -62,7 +62,7 @@
|
|||||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
*
|
||||||
* $Id: chap.h,v 1.3 2007/12/02 22:56:19 fbernon Exp $
|
* $Id: chap.h,v 1.4 2007/12/19 20:47:22 fbernon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CHAP_H
|
#ifndef CHAP_H
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
* 03-01-01 Marc Boucher <marc@mbsi.ca>
|
* 03-01-01 Marc Boucher <marc@mbsi.ca>
|
||||||
* Ported to lwIP.
|
* Ported to lwIP.
|
||||||
* 97-12-08 Guy Lancaster <lancasterg@acm.org>, Global Election Systems Inc.
|
* 97-12-08 Guy Lancaster <lancasterg@acm.org>, Global Election Systems Inc.
|
||||||
* Original based on BSD chap_ms.c.
|
* Original based on BSD chap_ms.c.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
/*
|
/*
|
||||||
* chap_ms.c - Microsoft MS-CHAP compatible implementation.
|
* chap_ms.c - Microsoft MS-CHAP compatible implementation.
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
* 03-01-01 Marc Boucher <marc@mbsi.ca>
|
* 03-01-01 Marc Boucher <marc@mbsi.ca>
|
||||||
* Ported to lwIP.
|
* Ported to lwIP.
|
||||||
* 98-01-30 Guy Lancaster <lancasterg@acm.org>, Global Election Systems Inc.
|
* 98-01-30 Guy Lancaster <lancasterg@acm.org>, Global Election Systems Inc.
|
||||||
* Original built from BSD network code.
|
* Original built from BSD network code.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
/*
|
/*
|
||||||
* chap.h - Challenge Handshake Authentication Protocol definitions.
|
* chap.h - Challenge Handshake Authentication Protocol definitions.
|
||||||
@ -51,7 +51,7 @@
|
|||||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
*
|
||||||
* $Id: chpms.h,v 1.4 2007/12/02 22:56:19 fbernon Exp $
|
* $Id: chpms.h,v 1.5 2007/12/19 20:47:23 fbernon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CHPMS_H
|
#ifndef CHPMS_H
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
* 03-01-01 Marc Boucher <marc@mbsi.ca>
|
* 03-01-01 Marc Boucher <marc@mbsi.ca>
|
||||||
* Ported to lwIP.
|
* Ported to lwIP.
|
||||||
* 97-12-01 Guy Lancaster <lancasterg@acm.org>, Global Election Systems Inc.
|
* 97-12-01 Guy Lancaster <lancasterg@acm.org>, Global Election Systems Inc.
|
||||||
* Original based on BSD fsm.c.
|
* Original based on BSD fsm.c.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
/*
|
/*
|
||||||
* fsm.c - {Link, IP} Control Protocol Finite State Machine.
|
* fsm.c - {Link, IP} Control Protocol Finite State Machine.
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
* 03-01-01 Marc Boucher <marc@mbsi.ca>
|
* 03-01-01 Marc Boucher <marc@mbsi.ca>
|
||||||
* Ported to lwIP.
|
* Ported to lwIP.
|
||||||
* 97-11-05 Guy Lancaster <glanca@gesn.com>, Global Election Systems Inc.
|
* 97-11-05 Guy Lancaster <glanca@gesn.com>, Global Election Systems Inc.
|
||||||
* Original based on BSD code.
|
* Original based on BSD code.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
/*
|
/*
|
||||||
* fsm.h - {Link, IP} Control Protocol Finite State Machine definitions.
|
* fsm.h - {Link, IP} Control Protocol Finite State Machine definitions.
|
||||||
@ -48,7 +48,7 @@
|
|||||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
*
|
||||||
* $Id: fsm.h,v 1.3 2007/12/02 23:24:59 fbernon Exp $
|
* $Id: fsm.h,v 1.4 2007/12/19 20:47:23 fbernon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef FSM_H
|
#ifndef FSM_H
|
||||||
|
2112
src/netif/ppp/ipcp.c
2112
src/netif/ppp/ipcp.c
File diff suppressed because it is too large
Load Diff
@ -28,7 +28,7 @@
|
|||||||
* 03-01-01 Marc Boucher <marc@mbsi.ca>
|
* 03-01-01 Marc Boucher <marc@mbsi.ca>
|
||||||
* Ported to lwIP.
|
* Ported to lwIP.
|
||||||
* 97-12-04 Guy Lancaster <glanca@gesn.com>, Global Election Systems Inc.
|
* 97-12-04 Guy Lancaster <glanca@gesn.com>, Global Election Systems Inc.
|
||||||
* Original derived from BSD codes.
|
* Original derived from BSD codes.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
/*
|
/*
|
||||||
* ipcp.h - IP Control Protocol definitions.
|
* ipcp.h - IP Control Protocol definitions.
|
||||||
@ -48,7 +48,7 @@
|
|||||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
*
|
||||||
* $Id: ipcp.h,v 1.2 2007/11/29 22:19:57 fbernon Exp $
|
* $Id: ipcp.h,v 1.3 2007/12/19 20:47:23 fbernon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef IPCP_H
|
#ifndef IPCP_H
|
||||||
@ -60,23 +60,23 @@
|
|||||||
/*
|
/*
|
||||||
* Options.
|
* Options.
|
||||||
*/
|
*/
|
||||||
#define CI_ADDRS 1 /* IP Addresses */
|
#define CI_ADDRS 1 /* IP Addresses */
|
||||||
#define CI_COMPRESSTYPE 2 /* Compression Type */
|
#define CI_COMPRESSTYPE 2 /* Compression Type */
|
||||||
#define CI_ADDR 3
|
#define CI_ADDR 3
|
||||||
|
|
||||||
#define CI_MS_WINS1 128 /* Primary WINS value */
|
#define CI_MS_WINS1 128 /* Primary WINS value */
|
||||||
#define CI_MS_DNS1 129 /* Primary DNS value */
|
#define CI_MS_DNS1 129 /* Primary DNS value */
|
||||||
#define CI_MS_WINS2 130 /* Secondary WINS value */
|
#define CI_MS_WINS2 130 /* Secondary WINS value */
|
||||||
#define CI_MS_DNS2 131 /* Secondary DNS value */
|
#define CI_MS_DNS2 131 /* Secondary DNS value */
|
||||||
|
|
||||||
#define IPCP_VJMODE_OLD 1 /* "old" mode (option # = 0x0037) */
|
#define IPCP_VJMODE_OLD 1 /* "old" mode (option # = 0x0037) */
|
||||||
#define IPCP_VJMODE_RFC1172 2 /* "old-rfc"mode (option # = 0x002d) */
|
#define IPCP_VJMODE_RFC1172 2 /* "old-rfc"mode (option # = 0x002d) */
|
||||||
#define IPCP_VJMODE_RFC1332 3 /* "new-rfc"mode (option # = 0x002d, */
|
#define IPCP_VJMODE_RFC1332 3 /* "new-rfc"mode (option # = 0x002d, */
|
||||||
/* maxslot and slot number compression) */
|
/* maxslot and slot number compression) */
|
||||||
|
|
||||||
#define IPCP_VJ_COMP 0x002d /* current value for VJ compression option*/
|
#define IPCP_VJ_COMP 0x002d /* current value for VJ compression option */
|
||||||
#define IPCP_VJ_COMP_OLD 0x0037 /* "old" (i.e, broken) value for VJ */
|
#define IPCP_VJ_COMP_OLD 0x0037 /* "old" (i.e, broken) value for VJ */
|
||||||
/* compression option*/
|
/* compression option */
|
||||||
|
|
||||||
|
|
||||||
/************************
|
/************************
|
||||||
@ -84,23 +84,23 @@
|
|||||||
************************/
|
************************/
|
||||||
|
|
||||||
typedef struct ipcp_options {
|
typedef struct ipcp_options {
|
||||||
u_int neg_addr : 1; /* Negotiate IP Address? */
|
u_int neg_addr : 1; /* Negotiate IP Address? */
|
||||||
u_int old_addrs : 1; /* Use old (IP-Addresses) option? */
|
u_int old_addrs : 1; /* Use old (IP-Addresses) option? */
|
||||||
u_int req_addr : 1; /* Ask peer to send IP address? */
|
u_int req_addr : 1; /* Ask peer to send IP address? */
|
||||||
u_int default_route : 1; /* Assign default route through interface? */
|
u_int default_route : 1; /* Assign default route through interface? */
|
||||||
u_int proxy_arp : 1; /* Make proxy ARP entry for peer? */
|
u_int proxy_arp : 1; /* Make proxy ARP entry for peer? */
|
||||||
u_int neg_vj : 1; /* Van Jacobson Compression? */
|
u_int neg_vj : 1; /* Van Jacobson Compression? */
|
||||||
u_int old_vj : 1; /* use old (short) form of VJ option? */
|
u_int old_vj : 1; /* use old (short) form of VJ option? */
|
||||||
u_int accept_local : 1; /* accept peer's value for ouraddr */
|
u_int accept_local : 1; /* accept peer's value for ouraddr */
|
||||||
u_int accept_remote : 1; /* accept peer's value for hisaddr */
|
u_int accept_remote : 1; /* accept peer's value for hisaddr */
|
||||||
u_int req_dns1 : 1; /* Ask peer to send primary DNS address? */
|
u_int req_dns1 : 1; /* Ask peer to send primary DNS address? */
|
||||||
u_int req_dns2 : 1; /* Ask peer to send secondary DNS address? */
|
u_int req_dns2 : 1; /* Ask peer to send secondary DNS address? */
|
||||||
u_short vj_protocol; /* protocol value to use in VJ option */
|
u_short vj_protocol; /* protocol value to use in VJ option */
|
||||||
u_char maxslotindex; /* VJ slots - 1. */
|
u_char maxslotindex; /* VJ slots - 1. */
|
||||||
u_char cflag; /* VJ slot compression flag. */
|
u_char cflag; /* VJ slot compression flag. */
|
||||||
u32_t ouraddr, hisaddr; /* Addresses in NETWORK BYTE ORDER */
|
u32_t ouraddr, hisaddr; /* Addresses in NETWORK BYTE ORDER */
|
||||||
u32_t dnsaddr[2]; /* Primary and secondary MS DNS entries */
|
u32_t dnsaddr[2]; /* Primary and secondary MS DNS entries */
|
||||||
u32_t winsaddr[2]; /* Primary and secondary MS WINS entries */
|
u32_t winsaddr[2]; /* Primary and secondary MS WINS entries */
|
||||||
} ipcp_options;
|
} ipcp_options;
|
||||||
|
|
||||||
|
|
||||||
|
3125
src/netif/ppp/lcp.c
3125
src/netif/ppp/lcp.c
File diff suppressed because it is too large
Load Diff
@ -28,7 +28,7 @@
|
|||||||
* 03-01-01 Marc Boucher <marc@mbsi.ca>
|
* 03-01-01 Marc Boucher <marc@mbsi.ca>
|
||||||
* Ported to lwIP.
|
* Ported to lwIP.
|
||||||
* 97-11-05 Guy Lancaster <glanca@gesn.com>, Global Election Systems Inc.
|
* 97-11-05 Guy Lancaster <glanca@gesn.com>, Global Election Systems Inc.
|
||||||
* Original derived from BSD codes.
|
* Original derived from BSD codes.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
/*
|
/*
|
||||||
* lcp.h - Link Control Protocol definitions.
|
* lcp.h - Link Control Protocol definitions.
|
||||||
@ -48,7 +48,7 @@
|
|||||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
*
|
||||||
* $Id: lcp.h,v 1.2 2007/11/29 22:19:57 fbernon Exp $
|
* $Id: lcp.h,v 1.3 2007/12/19 20:47:23 fbernon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef LCP_H
|
#ifndef LCP_H
|
||||||
@ -60,26 +60,26 @@
|
|||||||
/*
|
/*
|
||||||
* Options.
|
* Options.
|
||||||
*/
|
*/
|
||||||
#define CI_MRU 1 /* Maximum Receive Unit */
|
#define CI_MRU 1 /* Maximum Receive Unit */
|
||||||
#define CI_ASYNCMAP 2 /* Async Control Character Map */
|
#define CI_ASYNCMAP 2 /* Async Control Character Map */
|
||||||
#define CI_AUTHTYPE 3 /* Authentication Type */
|
#define CI_AUTHTYPE 3 /* Authentication Type */
|
||||||
#define CI_QUALITY 4 /* Quality Protocol */
|
#define CI_QUALITY 4 /* Quality Protocol */
|
||||||
#define CI_MAGICNUMBER 5 /* Magic Number */
|
#define CI_MAGICNUMBER 5 /* Magic Number */
|
||||||
#define CI_PCOMPRESSION 7 /* Protocol Field Compression */
|
#define CI_PCOMPRESSION 7 /* Protocol Field Compression */
|
||||||
#define CI_ACCOMPRESSION 8 /* Address/Control Field Compression */
|
#define CI_ACCOMPRESSION 8 /* Address/Control Field Compression */
|
||||||
#define CI_CALLBACK 13 /* callback */
|
#define CI_CALLBACK 13 /* callback */
|
||||||
#define CI_MRRU 17 /* max reconstructed receive unit; multilink */
|
#define CI_MRRU 17 /* max reconstructed receive unit; multilink */
|
||||||
#define CI_SSNHF 18 /* short sequence numbers for multilink */
|
#define CI_SSNHF 18 /* short sequence numbers for multilink */
|
||||||
#define CI_EPDISC 19 /* endpoint discriminator */
|
#define CI_EPDISC 19 /* endpoint discriminator */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* LCP-specific packet types.
|
* LCP-specific packet types.
|
||||||
*/
|
*/
|
||||||
#define PROTREJ 8 /* Protocol Reject */
|
#define PROTREJ 8 /* Protocol Reject */
|
||||||
#define ECHOREQ 9 /* Echo Request */
|
#define ECHOREQ 9 /* Echo Request */
|
||||||
#define ECHOREP 10 /* Echo Reply */
|
#define ECHOREP 10 /* Echo Reply */
|
||||||
#define DISCREQ 11 /* Discard Request */
|
#define DISCREQ 11 /* Discard Request */
|
||||||
#define CBCP_OPT 6 /* Use callback control protocol */
|
#define CBCP_OPT 6 /* Use callback control protocol */
|
||||||
|
|
||||||
|
|
||||||
/************************
|
/************************
|
||||||
@ -90,34 +90,34 @@
|
|||||||
* The state of options is described by an lcp_options structure.
|
* The state of options is described by an lcp_options structure.
|
||||||
*/
|
*/
|
||||||
typedef struct lcp_options {
|
typedef struct lcp_options {
|
||||||
u_int passive : 1; /* Don't die if we don't get a response */
|
u_int passive : 1; /* Don't die if we don't get a response */
|
||||||
u_int silent : 1; /* Wait for the other end to start first */
|
u_int silent : 1; /* Wait for the other end to start first */
|
||||||
u_int restart : 1; /* Restart vs. exit after close */
|
u_int restart : 1; /* Restart vs. exit after close */
|
||||||
u_int neg_mru : 1; /* Negotiate the MRU? */
|
u_int neg_mru : 1; /* Negotiate the MRU? */
|
||||||
u_int neg_asyncmap : 1; /* Negotiate the async map? */
|
u_int neg_asyncmap : 1; /* Negotiate the async map? */
|
||||||
u_int neg_upap : 1; /* Ask for UPAP authentication? */
|
u_int neg_upap : 1; /* Ask for UPAP authentication? */
|
||||||
u_int neg_chap : 1; /* Ask for CHAP authentication? */
|
u_int neg_chap : 1; /* Ask for CHAP authentication? */
|
||||||
u_int neg_magicnumber : 1; /* Ask for magic number? */
|
u_int neg_magicnumber : 1; /* Ask for magic number? */
|
||||||
u_int neg_pcompression : 1; /* HDLC Protocol Field Compression? */
|
u_int neg_pcompression : 1; /* HDLC Protocol Field Compression? */
|
||||||
u_int neg_accompression : 1; /* HDLC Address/Control Field Compression? */
|
u_int neg_accompression : 1; /* HDLC Address/Control Field Compression? */
|
||||||
u_int neg_lqr : 1; /* Negotiate use of Link Quality Reports */
|
u_int neg_lqr : 1; /* Negotiate use of Link Quality Reports */
|
||||||
u_int neg_cbcp : 1; /* Negotiate use of CBCP */
|
u_int neg_cbcp : 1; /* Negotiate use of CBCP */
|
||||||
#ifdef PPP_MULTILINK
|
#ifdef PPP_MULTILINK
|
||||||
u_int neg_mrru : 1; /* Negotiate multilink MRRU */
|
u_int neg_mrru : 1; /* Negotiate multilink MRRU */
|
||||||
u_int neg_ssnhf : 1; /* Negotiate short sequence numbers */
|
u_int neg_ssnhf : 1; /* Negotiate short sequence numbers */
|
||||||
u_int neg_endpoint : 1; /* Negotiate endpoint discriminator */
|
u_int neg_endpoint : 1; /* Negotiate endpoint discriminator */
|
||||||
#endif
|
#endif
|
||||||
u_short mru; /* Value of MRU */
|
u_short mru; /* Value of MRU */
|
||||||
#ifdef PPP_MULTILINK
|
#ifdef PPP_MULTILINK
|
||||||
u_short mrru; /* Value of MRRU, and multilink enable */
|
u_short mrru; /* Value of MRRU, and multilink enable */
|
||||||
#endif
|
#endif
|
||||||
u_char chap_mdtype; /* which MD type (hashing algorithm) */
|
u_char chap_mdtype; /* which MD type (hashing algorithm) */
|
||||||
u32_t asyncmap; /* Value of async map */
|
u32_t asyncmap; /* Value of async map */
|
||||||
u32_t magicnumber;
|
u32_t magicnumber;
|
||||||
int numloops; /* Number of loops during magic number neg. */
|
int numloops; /* Number of loops during magic number neg. */
|
||||||
u32_t lqr_period; /* Reporting period for LQR 1/100ths second */
|
u32_t lqr_period; /* Reporting period for LQR 1/100ths second */
|
||||||
#ifdef PPP_MULTILINK
|
#ifdef PPP_MULTILINK
|
||||||
struct epdisc endpoint; /* endpoint discriminator */
|
struct epdisc endpoint; /* endpoint discriminator */
|
||||||
#endif
|
#endif
|
||||||
} lcp_options;
|
} lcp_options;
|
||||||
|
|
||||||
@ -125,13 +125,13 @@ typedef struct lcp_options {
|
|||||||
* Values for phase from BSD pppd.h based on RFC 1661.
|
* Values for phase from BSD pppd.h based on RFC 1661.
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
PHASE_DEAD = 0,
|
PHASE_DEAD = 0,
|
||||||
PHASE_INITIALIZE,
|
PHASE_INITIALIZE,
|
||||||
PHASE_ESTABLISH,
|
PHASE_ESTABLISH,
|
||||||
PHASE_AUTHENTICATE,
|
PHASE_AUTHENTICATE,
|
||||||
PHASE_CALLBACK,
|
PHASE_CALLBACK,
|
||||||
PHASE_NETWORK,
|
PHASE_NETWORK,
|
||||||
PHASE_TERMINATE
|
PHASE_TERMINATE
|
||||||
} LinkPhase;
|
} LinkPhase;
|
||||||
|
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ typedef enum {
|
|||||||
*** PUBLIC DATA STRUCTURES ***
|
*** PUBLIC DATA STRUCTURES ***
|
||||||
*****************************/
|
*****************************/
|
||||||
|
|
||||||
extern LinkPhase lcp_phase[NUM_PPP]; /* Phase of link session (RFC 1661) */
|
extern LinkPhase lcp_phase[NUM_PPP]; /* Phase of link session (RFC 1661) */
|
||||||
extern lcp_options lcp_wantoptions[];
|
extern lcp_options lcp_wantoptions[];
|
||||||
extern lcp_options lcp_gotoptions[];
|
extern lcp_options lcp_gotoptions[];
|
||||||
extern lcp_options lcp_allowoptions[];
|
extern lcp_options lcp_allowoptions[];
|
||||||
@ -151,17 +151,17 @@ extern ext_accm xmit_accm[];
|
|||||||
*** PUBLIC FUNCTIONS ***
|
*** PUBLIC FUNCTIONS ***
|
||||||
***********************/
|
***********************/
|
||||||
|
|
||||||
void lcp_init (int);
|
void lcp_init (int);
|
||||||
void lcp_open (int);
|
void lcp_open (int);
|
||||||
void lcp_close (int, char *);
|
void lcp_close (int, char *);
|
||||||
void lcp_lowerup (int);
|
void lcp_lowerup (int);
|
||||||
void lcp_lowerdown (int);
|
void lcp_lowerdown(int);
|
||||||
void lcp_sprotrej (int, u_char *, int); /* send protocol reject */
|
void lcp_sprotrej (int, u_char *, int); /* send protocol reject */
|
||||||
|
|
||||||
extern struct protent lcp_protent;
|
extern struct protent lcp_protent;
|
||||||
|
|
||||||
/* Default number of times we receive our magic number from the peer
|
/* Default number of times we receive our magic number from the peer
|
||||||
before deciding the link is looped-back. */
|
before deciding the link is looped-back. */
|
||||||
#define DEFLOOPBACKFAIL 10
|
#define DEFLOOPBACKFAIL 10
|
||||||
|
|
||||||
#endif /* LCP_H */
|
#endif /* LCP_H */
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
* 03-01-01 Marc Boucher <marc@mbsi.ca>
|
* 03-01-01 Marc Boucher <marc@mbsi.ca>
|
||||||
* Ported to lwIP.
|
* Ported to lwIP.
|
||||||
* 97-12-04 Guy Lancaster <lancasterg@acm.org>, Global Election Systems Inc.
|
* 97-12-04 Guy Lancaster <lancasterg@acm.org>, Global Election Systems Inc.
|
||||||
* Original based on BSD magic.c.
|
* Original based on BSD magic.c.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
/*
|
/*
|
||||||
* magic.c - PPP Magic Number routines.
|
* magic.c - PPP Magic Number routines.
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
* 03-01-01 Marc Boucher <marc@mbsi.ca>
|
* 03-01-01 Marc Boucher <marc@mbsi.ca>
|
||||||
* Ported to lwIP.
|
* Ported to lwIP.
|
||||||
* 97-12-12 Guy Lancaster <lancasterg@acm.org>, Global Election Systems Inc.
|
* 97-12-12 Guy Lancaster <lancasterg@acm.org>, Global Election Systems Inc.
|
||||||
* Original.
|
* Original.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
/*
|
/*
|
||||||
* upap.c - User/Password Authentication Protocol.
|
* upap.c - User/Password Authentication Protocol.
|
||||||
@ -67,49 +67,47 @@
|
|||||||
/*
|
/*
|
||||||
* Protocol entry points.
|
* Protocol entry points.
|
||||||
*/
|
*/
|
||||||
static void upap_init (int);
|
static void upap_init (int);
|
||||||
static void upap_lowerup (int);
|
static void upap_lowerup (int);
|
||||||
static void upap_lowerdown (int);
|
static void upap_lowerdown (int);
|
||||||
static void upap_input (int, u_char *, int);
|
static void upap_input (int, u_char *, int);
|
||||||
static void upap_protrej (int);
|
static void upap_protrej (int);
|
||||||
|
|
||||||
static void upap_timeout (void *);
|
|
||||||
static void upap_reqtimeout (void *);
|
|
||||||
static void upap_rauthreq (upap_state *, u_char *, int, int);
|
|
||||||
static void upap_rauthack (upap_state *, u_char *, int, int);
|
|
||||||
static void upap_rauthnak (upap_state *, u_char *, int, int);
|
|
||||||
static void upap_sauthreq (upap_state *);
|
|
||||||
static void upap_sresp (upap_state *, u_char, u_char, char *, int);
|
|
||||||
|
|
||||||
|
|
||||||
|
static void upap_timeout (void *);
|
||||||
|
static void upap_reqtimeout(void *);
|
||||||
|
static void upap_rauthreq (upap_state *, u_char *, int, int);
|
||||||
|
static void upap_rauthack (upap_state *, u_char *, int, int);
|
||||||
|
static void upap_rauthnak (upap_state *, u_char *, int, int);
|
||||||
|
static void upap_sauthreq (upap_state *);
|
||||||
|
static void upap_sresp (upap_state *, u_char, u_char, char *, int);
|
||||||
|
|
||||||
|
|
||||||
/******************************/
|
/******************************/
|
||||||
/*** PUBLIC DATA STRUCTURES ***/
|
/*** PUBLIC DATA STRUCTURES ***/
|
||||||
/******************************/
|
/******************************/
|
||||||
struct protent pap_protent = {
|
struct protent pap_protent = {
|
||||||
PPP_PAP,
|
PPP_PAP,
|
||||||
upap_init,
|
upap_init,
|
||||||
upap_input,
|
upap_input,
|
||||||
upap_protrej,
|
upap_protrej,
|
||||||
upap_lowerup,
|
upap_lowerup,
|
||||||
upap_lowerdown,
|
upap_lowerdown,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
#if 0
|
#if 0
|
||||||
upap_printpkt,
|
upap_printpkt,
|
||||||
NULL,
|
NULL,
|
||||||
#endif
|
#endif
|
||||||
1,
|
1,
|
||||||
"PAP",
|
"PAP",
|
||||||
#if 0
|
#if 0
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL
|
NULL
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
upap_state upap[NUM_PPP]; /* UPAP state; one for each unit */
|
upap_state upap[NUM_PPP]; /* UPAP state; one for each unit */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -119,15 +117,16 @@ upap_state upap[NUM_PPP]; /* UPAP state; one for each unit */
|
|||||||
/*
|
/*
|
||||||
* Set the default login name and password for the pap sessions
|
* Set the default login name and password for the pap sessions
|
||||||
*/
|
*/
|
||||||
void upap_setloginpasswd(int unit, const char *luser, const char *lpassword)
|
void
|
||||||
|
upap_setloginpasswd(int unit, const char *luser, const char *lpassword)
|
||||||
{
|
{
|
||||||
upap_state *u = &upap[unit];
|
upap_state *u = &upap[unit];
|
||||||
|
|
||||||
/* Save the username and password we're given */
|
/* Save the username and password we're given */
|
||||||
u->us_user = luser;
|
u->us_user = luser;
|
||||||
u->us_userlen = strlen(luser);
|
u->us_userlen = strlen(luser);
|
||||||
u->us_passwd = lpassword;
|
u->us_passwd = lpassword;
|
||||||
u->us_passwdlen = strlen(lpassword);
|
u->us_passwdlen = strlen(lpassword);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -136,25 +135,26 @@ void upap_setloginpasswd(int unit, const char *luser, const char *lpassword)
|
|||||||
*
|
*
|
||||||
* Set new state and send authenticate's.
|
* Set new state and send authenticate's.
|
||||||
*/
|
*/
|
||||||
void upap_authwithpeer(int unit, char *user, char *password)
|
void
|
||||||
|
upap_authwithpeer(int unit, char *user, char *password)
|
||||||
{
|
{
|
||||||
upap_state *u = &upap[unit];
|
upap_state *u = &upap[unit];
|
||||||
|
|
||||||
UPAPDEBUG((LOG_INFO, "upap_authwithpeer: %d user=%s password=%s s=%d\n",
|
|
||||||
unit, user, password, u->us_clientstate));
|
|
||||||
|
|
||||||
upap_setloginpasswd(unit, user, password);
|
|
||||||
|
|
||||||
u->us_transmits = 0;
|
UPAPDEBUG((LOG_INFO, "upap_authwithpeer: %d user=%s password=%s s=%d\n",
|
||||||
|
unit, user, password, u->us_clientstate));
|
||||||
/* Lower layer up yet? */
|
|
||||||
if (u->us_clientstate == UPAPCS_INITIAL ||
|
upap_setloginpasswd(unit, user, password);
|
||||||
u->us_clientstate == UPAPCS_PENDING) {
|
|
||||||
u->us_clientstate = UPAPCS_PENDING;
|
u->us_transmits = 0;
|
||||||
return;
|
|
||||||
}
|
/* Lower layer up yet? */
|
||||||
|
if (u->us_clientstate == UPAPCS_INITIAL ||
|
||||||
upap_sauthreq(u); /* Start protocol */
|
u->us_clientstate == UPAPCS_PENDING) {
|
||||||
|
u->us_clientstate = UPAPCS_PENDING;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
upap_sauthreq(u); /* Start protocol */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -163,20 +163,22 @@ void upap_authwithpeer(int unit, char *user, char *password)
|
|||||||
*
|
*
|
||||||
* Set new state.
|
* Set new state.
|
||||||
*/
|
*/
|
||||||
void upap_authpeer(int unit)
|
void
|
||||||
|
upap_authpeer(int unit)
|
||||||
{
|
{
|
||||||
upap_state *u = &upap[unit];
|
upap_state *u = &upap[unit];
|
||||||
|
|
||||||
/* Lower layer up yet? */
|
/* Lower layer up yet? */
|
||||||
if (u->us_serverstate == UPAPSS_INITIAL ||
|
if (u->us_serverstate == UPAPSS_INITIAL ||
|
||||||
u->us_serverstate == UPAPSS_PENDING) {
|
u->us_serverstate == UPAPSS_PENDING) {
|
||||||
u->us_serverstate = UPAPSS_PENDING;
|
u->us_serverstate = UPAPSS_PENDING;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
u->us_serverstate = UPAPSS_LISTEN;
|
u->us_serverstate = UPAPSS_LISTEN;
|
||||||
if (u->us_reqtimeout > 0)
|
if (u->us_reqtimeout > 0) {
|
||||||
TIMEOUT(upap_reqtimeout, u, u->us_reqtimeout);
|
TIMEOUT(upap_reqtimeout, u, u->us_reqtimeout);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -187,61 +189,66 @@ void upap_authpeer(int unit)
|
|||||||
/*
|
/*
|
||||||
* upap_init - Initialize a UPAP unit.
|
* upap_init - Initialize a UPAP unit.
|
||||||
*/
|
*/
|
||||||
static void upap_init(int unit)
|
static void
|
||||||
|
upap_init(int unit)
|
||||||
{
|
{
|
||||||
upap_state *u = &upap[unit];
|
upap_state *u = &upap[unit];
|
||||||
|
|
||||||
UPAPDEBUG((LOG_INFO, "upap_init: %d\n", unit));
|
UPAPDEBUG((LOG_INFO, "upap_init: %d\n", unit));
|
||||||
u->us_unit = unit;
|
u->us_unit = unit;
|
||||||
u->us_user = NULL;
|
u->us_user = NULL;
|
||||||
u->us_userlen = 0;
|
u->us_userlen = 0;
|
||||||
u->us_passwd = NULL;
|
u->us_passwd = NULL;
|
||||||
u->us_passwdlen = 0;
|
u->us_passwdlen = 0;
|
||||||
u->us_clientstate = UPAPCS_INITIAL;
|
u->us_clientstate = UPAPCS_INITIAL;
|
||||||
u->us_serverstate = UPAPSS_INITIAL;
|
u->us_serverstate = UPAPSS_INITIAL;
|
||||||
u->us_id = 0;
|
u->us_id = 0;
|
||||||
u->us_timeouttime = UPAP_DEFTIMEOUT;
|
u->us_timeouttime = UPAP_DEFTIMEOUT;
|
||||||
u->us_maxtransmits = 10;
|
u->us_maxtransmits = 10;
|
||||||
u->us_reqtimeout = UPAP_DEFREQTIME;
|
u->us_reqtimeout = UPAP_DEFREQTIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* upap_timeout - Retransmission timer for sending auth-reqs expired.
|
* upap_timeout - Retransmission timer for sending auth-reqs expired.
|
||||||
*/
|
*/
|
||||||
static void upap_timeout(void *arg)
|
static void
|
||||||
|
upap_timeout(void *arg)
|
||||||
{
|
{
|
||||||
upap_state *u = (upap_state *) arg;
|
upap_state *u = (upap_state *) arg;
|
||||||
|
|
||||||
UPAPDEBUG((LOG_INFO, "upap_timeout: %d timeout %d expired s=%d\n",
|
UPAPDEBUG((LOG_INFO, "upap_timeout: %d timeout %d expired s=%d\n",
|
||||||
u->us_unit, u->us_timeouttime, u->us_clientstate));
|
u->us_unit, u->us_timeouttime, u->us_clientstate));
|
||||||
|
|
||||||
if (u->us_clientstate != UPAPCS_AUTHREQ)
|
if (u->us_clientstate != UPAPCS_AUTHREQ) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
if (u->us_transmits >= u->us_maxtransmits) {
|
|
||||||
/* give up in disgust */
|
if (u->us_transmits >= u->us_maxtransmits) {
|
||||||
UPAPDEBUG((LOG_ERR, "No response to PAP authenticate-requests\n"));
|
/* give up in disgust */
|
||||||
u->us_clientstate = UPAPCS_BADAUTH;
|
UPAPDEBUG((LOG_ERR, "No response to PAP authenticate-requests\n"));
|
||||||
auth_withpeer_fail(u->us_unit, PPP_PAP);
|
u->us_clientstate = UPAPCS_BADAUTH;
|
||||||
return;
|
auth_withpeer_fail(u->us_unit, PPP_PAP);
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
upap_sauthreq(u); /* Send Authenticate-Request */
|
|
||||||
|
upap_sauthreq(u); /* Send Authenticate-Request */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* upap_reqtimeout - Give up waiting for the peer to send an auth-req.
|
* upap_reqtimeout - Give up waiting for the peer to send an auth-req.
|
||||||
*/
|
*/
|
||||||
static void upap_reqtimeout(void *arg)
|
static void
|
||||||
|
upap_reqtimeout(void *arg)
|
||||||
{
|
{
|
||||||
upap_state *u = (upap_state *) arg;
|
upap_state *u = (upap_state *) arg;
|
||||||
|
|
||||||
if (u->us_serverstate != UPAPSS_LISTEN)
|
if (u->us_serverstate != UPAPSS_LISTEN) {
|
||||||
return; /* huh?? */
|
return; /* huh?? */
|
||||||
|
}
|
||||||
auth_peer_fail(u->us_unit, PPP_PAP);
|
|
||||||
u->us_serverstate = UPAPSS_BADAUTH;
|
auth_peer_fail(u->us_unit, PPP_PAP);
|
||||||
|
u->us_serverstate = UPAPSS_BADAUTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -250,25 +257,27 @@ static void upap_reqtimeout(void *arg)
|
|||||||
*
|
*
|
||||||
* Start authenticating if pending.
|
* Start authenticating if pending.
|
||||||
*/
|
*/
|
||||||
static void upap_lowerup(int unit)
|
static void
|
||||||
|
upap_lowerup(int unit)
|
||||||
{
|
{
|
||||||
upap_state *u = &upap[unit];
|
upap_state *u = &upap[unit];
|
||||||
|
|
||||||
UPAPDEBUG((LOG_INFO, "upap_lowerup: %d s=%d\n", unit, u->us_clientstate));
|
UPAPDEBUG((LOG_INFO, "upap_lowerup: %d s=%d\n", unit, u->us_clientstate));
|
||||||
|
|
||||||
if (u->us_clientstate == UPAPCS_INITIAL)
|
if (u->us_clientstate == UPAPCS_INITIAL) {
|
||||||
u->us_clientstate = UPAPCS_CLOSED;
|
u->us_clientstate = UPAPCS_CLOSED;
|
||||||
else if (u->us_clientstate == UPAPCS_PENDING) {
|
} else if (u->us_clientstate == UPAPCS_PENDING) {
|
||||||
upap_sauthreq(u); /* send an auth-request */
|
upap_sauthreq(u); /* send an auth-request */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (u->us_serverstate == UPAPSS_INITIAL)
|
if (u->us_serverstate == UPAPSS_INITIAL) {
|
||||||
u->us_serverstate = UPAPSS_CLOSED;
|
u->us_serverstate = UPAPSS_CLOSED;
|
||||||
else if (u->us_serverstate == UPAPSS_PENDING) {
|
} else if (u->us_serverstate == UPAPSS_PENDING) {
|
||||||
u->us_serverstate = UPAPSS_LISTEN;
|
u->us_serverstate = UPAPSS_LISTEN;
|
||||||
if (u->us_reqtimeout > 0)
|
if (u->us_reqtimeout > 0) {
|
||||||
TIMEOUT(upap_reqtimeout, u, u->us_reqtimeout);
|
TIMEOUT(upap_reqtimeout, u, u->us_reqtimeout);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -277,19 +286,22 @@ static void upap_lowerup(int unit)
|
|||||||
*
|
*
|
||||||
* Cancel all timeouts.
|
* Cancel all timeouts.
|
||||||
*/
|
*/
|
||||||
static void upap_lowerdown(int unit)
|
static void
|
||||||
|
upap_lowerdown(int unit)
|
||||||
{
|
{
|
||||||
upap_state *u = &upap[unit];
|
upap_state *u = &upap[unit];
|
||||||
|
|
||||||
UPAPDEBUG((LOG_INFO, "upap_lowerdown: %d s=%d\n", unit, u->us_clientstate));
|
UPAPDEBUG((LOG_INFO, "upap_lowerdown: %d s=%d\n", unit, u->us_clientstate));
|
||||||
|
|
||||||
if (u->us_clientstate == UPAPCS_AUTHREQ) /* Timeout pending? */
|
if (u->us_clientstate == UPAPCS_AUTHREQ) { /* Timeout pending? */
|
||||||
UNTIMEOUT(upap_timeout, u); /* Cancel timeout */
|
UNTIMEOUT(upap_timeout, u); /* Cancel timeout */
|
||||||
if (u->us_serverstate == UPAPSS_LISTEN && u->us_reqtimeout > 0)
|
}
|
||||||
UNTIMEOUT(upap_reqtimeout, u);
|
if (u->us_serverstate == UPAPSS_LISTEN && u->us_reqtimeout > 0) {
|
||||||
|
UNTIMEOUT(upap_reqtimeout, u);
|
||||||
u->us_clientstate = UPAPCS_INITIAL;
|
}
|
||||||
u->us_serverstate = UPAPSS_INITIAL;
|
|
||||||
|
u->us_clientstate = UPAPCS_INITIAL;
|
||||||
|
u->us_serverstate = UPAPSS_INITIAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -298,295 +310,283 @@ static void upap_lowerdown(int unit)
|
|||||||
*
|
*
|
||||||
* This shouldn't happen. In any case, pretend lower layer went down.
|
* This shouldn't happen. In any case, pretend lower layer went down.
|
||||||
*/
|
*/
|
||||||
static void upap_protrej(int unit)
|
static void
|
||||||
|
upap_protrej(int unit)
|
||||||
{
|
{
|
||||||
upap_state *u = &upap[unit];
|
upap_state *u = &upap[unit];
|
||||||
|
|
||||||
if (u->us_clientstate == UPAPCS_AUTHREQ) {
|
if (u->us_clientstate == UPAPCS_AUTHREQ) {
|
||||||
UPAPDEBUG((LOG_ERR, "PAP authentication failed due to protocol-reject\n"));
|
UPAPDEBUG((LOG_ERR, "PAP authentication failed due to protocol-reject\n"));
|
||||||
auth_withpeer_fail(unit, PPP_PAP);
|
auth_withpeer_fail(unit, PPP_PAP);
|
||||||
}
|
}
|
||||||
if (u->us_serverstate == UPAPSS_LISTEN) {
|
if (u->us_serverstate == UPAPSS_LISTEN) {
|
||||||
UPAPDEBUG((LOG_ERR, "PAP authentication of peer failed (protocol-reject)\n"));
|
UPAPDEBUG((LOG_ERR, "PAP authentication of peer failed (protocol-reject)\n"));
|
||||||
auth_peer_fail(unit, PPP_PAP);
|
auth_peer_fail(unit, PPP_PAP);
|
||||||
}
|
}
|
||||||
upap_lowerdown(unit);
|
upap_lowerdown(unit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* upap_input - Input UPAP packet.
|
* upap_input - Input UPAP packet.
|
||||||
*/
|
*/
|
||||||
static void upap_input(int unit, u_char *inpacket, int l)
|
static void
|
||||||
|
upap_input(int unit, u_char *inpacket, int l)
|
||||||
{
|
{
|
||||||
upap_state *u = &upap[unit];
|
upap_state *u = &upap[unit];
|
||||||
u_char *inp;
|
u_char *inp;
|
||||||
u_char code, id;
|
u_char code, id;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Parse header (code, id and length).
|
* Parse header (code, id and length).
|
||||||
* If packet too short, drop it.
|
* If packet too short, drop it.
|
||||||
*/
|
*/
|
||||||
inp = inpacket;
|
inp = inpacket;
|
||||||
if (l < UPAP_HEADERLEN) {
|
if (l < UPAP_HEADERLEN) {
|
||||||
UPAPDEBUG((LOG_INFO, "pap_input: rcvd short header.\n"));
|
UPAPDEBUG((LOG_INFO, "pap_input: rcvd short header.\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GETCHAR(code, inp);
|
GETCHAR(code, inp);
|
||||||
GETCHAR(id, inp);
|
GETCHAR(id, inp);
|
||||||
GETSHORT(len, inp);
|
GETSHORT(len, inp);
|
||||||
if (len < UPAP_HEADERLEN) {
|
if (len < UPAP_HEADERLEN) {
|
||||||
UPAPDEBUG((LOG_INFO, "pap_input: rcvd illegal length.\n"));
|
UPAPDEBUG((LOG_INFO, "pap_input: rcvd illegal length.\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (len > l) {
|
if (len > l) {
|
||||||
UPAPDEBUG((LOG_INFO, "pap_input: rcvd short packet.\n"));
|
UPAPDEBUG((LOG_INFO, "pap_input: rcvd short packet.\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
len -= UPAP_HEADERLEN;
|
len -= UPAP_HEADERLEN;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action depends on code.
|
* Action depends on code.
|
||||||
*/
|
*/
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case UPAP_AUTHREQ:
|
case UPAP_AUTHREQ:
|
||||||
upap_rauthreq(u, inp, id, len);
|
upap_rauthreq(u, inp, id, len);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UPAP_AUTHACK:
|
case UPAP_AUTHACK:
|
||||||
upap_rauthack(u, inp, id, len);
|
upap_rauthack(u, inp, id, len);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UPAP_AUTHNAK:
|
case UPAP_AUTHNAK:
|
||||||
upap_rauthnak(u, inp, id, len);
|
upap_rauthnak(u, inp, id, len);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: /* XXX Need code reject */
|
default: /* XXX Need code reject */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* upap_rauth - Receive Authenticate.
|
* upap_rauth - Receive Authenticate.
|
||||||
*/
|
*/
|
||||||
static void upap_rauthreq(
|
static void
|
||||||
upap_state *u,
|
upap_rauthreq(upap_state *u, u_char *inp, int id, int len)
|
||||||
u_char *inp,
|
|
||||||
int id,
|
|
||||||
int len
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
u_char ruserlen, rpasswdlen;
|
u_char ruserlen, rpasswdlen;
|
||||||
char *ruser, *rpasswd;
|
char *ruser, *rpasswd;
|
||||||
int retcode;
|
int retcode;
|
||||||
char *msg;
|
char *msg;
|
||||||
int msglen;
|
int msglen;
|
||||||
|
|
||||||
UPAPDEBUG((LOG_INFO, "pap_rauth: Rcvd id %d.\n", id));
|
UPAPDEBUG((LOG_INFO, "pap_rauth: Rcvd id %d.\n", id));
|
||||||
|
|
||||||
if (u->us_serverstate < UPAPSS_LISTEN)
|
if (u->us_serverstate < UPAPSS_LISTEN) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
/*
|
|
||||||
* If we receive a duplicate authenticate-request, we are
|
/*
|
||||||
* supposed to return the same status as for the first request.
|
* If we receive a duplicate authenticate-request, we are
|
||||||
*/
|
* supposed to return the same status as for the first request.
|
||||||
if (u->us_serverstate == UPAPSS_OPEN) {
|
*/
|
||||||
upap_sresp(u, UPAP_AUTHACK, id, "", 0); /* return auth-ack */
|
if (u->us_serverstate == UPAPSS_OPEN) {
|
||||||
return;
|
upap_sresp(u, UPAP_AUTHACK, id, "", 0); /* return auth-ack */
|
||||||
}
|
return;
|
||||||
if (u->us_serverstate == UPAPSS_BADAUTH) {
|
}
|
||||||
upap_sresp(u, UPAP_AUTHNAK, id, "", 0); /* return auth-nak */
|
if (u->us_serverstate == UPAPSS_BADAUTH) {
|
||||||
return;
|
upap_sresp(u, UPAP_AUTHNAK, id, "", 0); /* return auth-nak */
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
/*
|
|
||||||
* Parse user/passwd.
|
/*
|
||||||
*/
|
* Parse user/passwd.
|
||||||
if (len < sizeof (u_char)) {
|
*/
|
||||||
UPAPDEBUG((LOG_INFO, "pap_rauth: rcvd short packet.\n"));
|
if (len < sizeof (u_char)) {
|
||||||
return;
|
UPAPDEBUG((LOG_INFO, "pap_rauth: rcvd short packet.\n"));
|
||||||
}
|
return;
|
||||||
GETCHAR(ruserlen, inp);
|
}
|
||||||
len -= sizeof (u_char) + ruserlen + sizeof (u_char);
|
GETCHAR(ruserlen, inp);
|
||||||
if (len < 0) {
|
len -= sizeof (u_char) + ruserlen + sizeof (u_char);
|
||||||
UPAPDEBUG((LOG_INFO, "pap_rauth: rcvd short packet.\n"));
|
if (len < 0) {
|
||||||
return;
|
UPAPDEBUG((LOG_INFO, "pap_rauth: rcvd short packet.\n"));
|
||||||
}
|
return;
|
||||||
ruser = (char *) inp;
|
}
|
||||||
INCPTR(ruserlen, inp);
|
ruser = (char *) inp;
|
||||||
GETCHAR(rpasswdlen, inp);
|
INCPTR(ruserlen, inp);
|
||||||
if (len < rpasswdlen) {
|
GETCHAR(rpasswdlen, inp);
|
||||||
UPAPDEBUG((LOG_INFO, "pap_rauth: rcvd short packet.\n"));
|
if (len < rpasswdlen) {
|
||||||
return;
|
UPAPDEBUG((LOG_INFO, "pap_rauth: rcvd short packet.\n"));
|
||||||
}
|
return;
|
||||||
rpasswd = (char *) inp;
|
}
|
||||||
|
rpasswd = (char *) inp;
|
||||||
/*
|
|
||||||
* Check the username and password given.
|
/*
|
||||||
*/
|
* Check the username and password given.
|
||||||
retcode = check_passwd(u->us_unit, ruser, ruserlen, rpasswd,
|
*/
|
||||||
rpasswdlen, &msg, &msglen);
|
retcode = check_passwd(u->us_unit, ruser, ruserlen, rpasswd, rpasswdlen, &msg, &msglen);
|
||||||
BZERO(rpasswd, rpasswdlen);
|
BZERO(rpasswd, rpasswdlen);
|
||||||
|
|
||||||
upap_sresp(u, retcode, id, msg, msglen);
|
upap_sresp(u, retcode, id, msg, msglen);
|
||||||
|
|
||||||
if (retcode == UPAP_AUTHACK) {
|
if (retcode == UPAP_AUTHACK) {
|
||||||
u->us_serverstate = UPAPSS_OPEN;
|
u->us_serverstate = UPAPSS_OPEN;
|
||||||
auth_peer_success(u->us_unit, PPP_PAP, ruser, ruserlen);
|
auth_peer_success(u->us_unit, PPP_PAP, ruser, ruserlen);
|
||||||
} else {
|
} else {
|
||||||
u->us_serverstate = UPAPSS_BADAUTH;
|
u->us_serverstate = UPAPSS_BADAUTH;
|
||||||
auth_peer_fail(u->us_unit, PPP_PAP);
|
auth_peer_fail(u->us_unit, PPP_PAP);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (u->us_reqtimeout > 0)
|
if (u->us_reqtimeout > 0) {
|
||||||
UNTIMEOUT(upap_reqtimeout, u);
|
UNTIMEOUT(upap_reqtimeout, u);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* upap_rauthack - Receive Authenticate-Ack.
|
* upap_rauthack - Receive Authenticate-Ack.
|
||||||
*/
|
*/
|
||||||
static void upap_rauthack(
|
static void
|
||||||
upap_state *u,
|
upap_rauthack(upap_state *u, u_char *inp, int id, int len)
|
||||||
u_char *inp,
|
|
||||||
int id,
|
|
||||||
int len
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
u_char msglen;
|
u_char msglen;
|
||||||
char *msg;
|
char *msg;
|
||||||
|
|
||||||
UPAPDEBUG((LOG_INFO, "pap_rauthack: Rcvd id %d s=%d\n", id, u->us_clientstate));
|
UPAPDEBUG((LOG_INFO, "pap_rauthack: Rcvd id %d s=%d\n", id, u->us_clientstate));
|
||||||
|
|
||||||
if (u->us_clientstate != UPAPCS_AUTHREQ) /* XXX */
|
if (u->us_clientstate != UPAPCS_AUTHREQ) { /* XXX */
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
/*
|
|
||||||
* Parse message.
|
/*
|
||||||
*/
|
* Parse message.
|
||||||
if (len < sizeof (u_char)) {
|
*/
|
||||||
UPAPDEBUG((LOG_INFO, "pap_rauthack: rcvd short packet.\n"));
|
if (len < sizeof (u_char)) {
|
||||||
return;
|
UPAPDEBUG((LOG_INFO, "pap_rauthack: rcvd short packet.\n"));
|
||||||
}
|
return;
|
||||||
GETCHAR(msglen, inp);
|
}
|
||||||
len -= sizeof (u_char);
|
GETCHAR(msglen, inp);
|
||||||
if (len < msglen) {
|
len -= sizeof (u_char);
|
||||||
UPAPDEBUG((LOG_INFO, "pap_rauthack: rcvd short packet.\n"));
|
if (len < msglen) {
|
||||||
return;
|
UPAPDEBUG((LOG_INFO, "pap_rauthack: rcvd short packet.\n"));
|
||||||
}
|
return;
|
||||||
msg = (char *) inp;
|
}
|
||||||
PRINTMSG(msg, msglen);
|
msg = (char *) inp;
|
||||||
|
PRINTMSG(msg, msglen);
|
||||||
u->us_clientstate = UPAPCS_OPEN;
|
|
||||||
|
u->us_clientstate = UPAPCS_OPEN;
|
||||||
auth_withpeer_success(u->us_unit, PPP_PAP);
|
|
||||||
|
auth_withpeer_success(u->us_unit, PPP_PAP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* upap_rauthnak - Receive Authenticate-Nakk.
|
* upap_rauthnak - Receive Authenticate-Nakk.
|
||||||
*/
|
*/
|
||||||
static void upap_rauthnak(
|
static void
|
||||||
upap_state *u,
|
upap_rauthnak(upap_state *u, u_char *inp, int id, int len)
|
||||||
u_char *inp,
|
|
||||||
int id,
|
|
||||||
int len
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
u_char msglen;
|
u_char msglen;
|
||||||
char *msg;
|
char *msg;
|
||||||
|
|
||||||
UPAPDEBUG((LOG_INFO, "pap_rauthnak: Rcvd id %d s=%d\n", id, u->us_clientstate));
|
UPAPDEBUG((LOG_INFO, "pap_rauthnak: Rcvd id %d s=%d\n", id, u->us_clientstate));
|
||||||
|
|
||||||
if (u->us_clientstate != UPAPCS_AUTHREQ) /* XXX */
|
if (u->us_clientstate != UPAPCS_AUTHREQ) { /* XXX */
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
/*
|
|
||||||
* Parse message.
|
/*
|
||||||
*/
|
* Parse message.
|
||||||
if (len < sizeof (u_char)) {
|
*/
|
||||||
UPAPDEBUG((LOG_INFO, "pap_rauthnak: rcvd short packet.\n"));
|
if (len < sizeof (u_char)) {
|
||||||
return;
|
UPAPDEBUG((LOG_INFO, "pap_rauthnak: rcvd short packet.\n"));
|
||||||
}
|
return;
|
||||||
GETCHAR(msglen, inp);
|
}
|
||||||
len -= sizeof (u_char);
|
GETCHAR(msglen, inp);
|
||||||
if (len < msglen) {
|
len -= sizeof (u_char);
|
||||||
UPAPDEBUG((LOG_INFO, "pap_rauthnak: rcvd short packet.\n"));
|
if (len < msglen) {
|
||||||
return;
|
UPAPDEBUG((LOG_INFO, "pap_rauthnak: rcvd short packet.\n"));
|
||||||
}
|
return;
|
||||||
msg = (char *) inp;
|
}
|
||||||
PRINTMSG(msg, msglen);
|
msg = (char *) inp;
|
||||||
|
PRINTMSG(msg, msglen);
|
||||||
u->us_clientstate = UPAPCS_BADAUTH;
|
|
||||||
|
u->us_clientstate = UPAPCS_BADAUTH;
|
||||||
UPAPDEBUG((LOG_ERR, "PAP authentication failed\n"));
|
|
||||||
auth_withpeer_fail(u->us_unit, PPP_PAP);
|
UPAPDEBUG((LOG_ERR, "PAP authentication failed\n"));
|
||||||
|
auth_withpeer_fail(u->us_unit, PPP_PAP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* upap_sauthreq - Send an Authenticate-Request.
|
* upap_sauthreq - Send an Authenticate-Request.
|
||||||
*/
|
*/
|
||||||
static void upap_sauthreq(upap_state *u)
|
static void
|
||||||
|
upap_sauthreq(upap_state *u)
|
||||||
{
|
{
|
||||||
u_char *outp;
|
u_char *outp;
|
||||||
int outlen;
|
int outlen;
|
||||||
|
|
||||||
outlen = UPAP_HEADERLEN + 2 * sizeof (u_char)
|
outlen = UPAP_HEADERLEN + 2 * sizeof (u_char)
|
||||||
+ u->us_userlen + u->us_passwdlen;
|
+ u->us_userlen + u->us_passwdlen;
|
||||||
outp = outpacket_buf[u->us_unit];
|
outp = outpacket_buf[u->us_unit];
|
||||||
|
|
||||||
MAKEHEADER(outp, PPP_PAP);
|
MAKEHEADER(outp, PPP_PAP);
|
||||||
|
|
||||||
PUTCHAR(UPAP_AUTHREQ, outp);
|
PUTCHAR(UPAP_AUTHREQ, outp);
|
||||||
PUTCHAR(++u->us_id, outp);
|
PUTCHAR(++u->us_id, outp);
|
||||||
PUTSHORT(outlen, outp);
|
PUTSHORT(outlen, outp);
|
||||||
PUTCHAR(u->us_userlen, outp);
|
PUTCHAR(u->us_userlen, outp);
|
||||||
BCOPY(u->us_user, outp, u->us_userlen);
|
BCOPY(u->us_user, outp, u->us_userlen);
|
||||||
INCPTR(u->us_userlen, outp);
|
INCPTR(u->us_userlen, outp);
|
||||||
PUTCHAR(u->us_passwdlen, outp);
|
PUTCHAR(u->us_passwdlen, outp);
|
||||||
BCOPY(u->us_passwd, outp, u->us_passwdlen);
|
BCOPY(u->us_passwd, outp, u->us_passwdlen);
|
||||||
|
|
||||||
pppWrite(u->us_unit, outpacket_buf[u->us_unit], outlen + PPP_HDRLEN);
|
pppWrite(u->us_unit, outpacket_buf[u->us_unit], outlen + PPP_HDRLEN);
|
||||||
|
|
||||||
UPAPDEBUG((LOG_INFO, "pap_sauth: Sent id %d\n", u->us_id));
|
UPAPDEBUG((LOG_INFO, "pap_sauth: Sent id %d\n", u->us_id));
|
||||||
|
|
||||||
TIMEOUT(upap_timeout, u, u->us_timeouttime);
|
TIMEOUT(upap_timeout, u, u->us_timeouttime);
|
||||||
++u->us_transmits;
|
++u->us_transmits;
|
||||||
u->us_clientstate = UPAPCS_AUTHREQ;
|
u->us_clientstate = UPAPCS_AUTHREQ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* upap_sresp - Send a response (ack or nak).
|
* upap_sresp - Send a response (ack or nak).
|
||||||
*/
|
*/
|
||||||
static void upap_sresp(
|
static void
|
||||||
upap_state *u,
|
upap_sresp(upap_state *u, u_char code, u_char id, char *msg, int msglen)
|
||||||
u_char code,
|
|
||||||
u_char id,
|
|
||||||
char *msg,
|
|
||||||
int msglen
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
u_char *outp;
|
u_char *outp;
|
||||||
int outlen;
|
int outlen;
|
||||||
|
|
||||||
outlen = UPAP_HEADERLEN + sizeof (u_char) + msglen;
|
outlen = UPAP_HEADERLEN + sizeof (u_char) + msglen;
|
||||||
outp = outpacket_buf[u->us_unit];
|
outp = outpacket_buf[u->us_unit];
|
||||||
MAKEHEADER(outp, PPP_PAP);
|
MAKEHEADER(outp, PPP_PAP);
|
||||||
|
|
||||||
PUTCHAR(code, outp);
|
PUTCHAR(code, outp);
|
||||||
PUTCHAR(id, outp);
|
PUTCHAR(id, outp);
|
||||||
PUTSHORT(outlen, outp);
|
PUTSHORT(outlen, outp);
|
||||||
PUTCHAR(msglen, outp);
|
PUTCHAR(msglen, outp);
|
||||||
BCOPY(msg, outp, msglen);
|
BCOPY(msg, outp, msglen);
|
||||||
pppWrite(u->us_unit, outpacket_buf[u->us_unit], outlen + PPP_HDRLEN);
|
pppWrite(u->us_unit, outpacket_buf[u->us_unit], outlen + PPP_HDRLEN);
|
||||||
|
|
||||||
UPAPDEBUG((LOG_INFO, "pap_sresp: Sent code %d, id %d s=%d\n",
|
UPAPDEBUG((LOG_INFO, "pap_sresp: Sent code %d, id %d s=%d\n", code, id, u->us_clientstate));
|
||||||
code, id, u->us_clientstate));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@ -594,17 +594,17 @@ static void upap_sresp(
|
|||||||
* upap_printpkt - print the contents of a PAP packet.
|
* upap_printpkt - print the contents of a PAP packet.
|
||||||
*/
|
*/
|
||||||
static int upap_printpkt(
|
static int upap_printpkt(
|
||||||
u_char *p,
|
u_char *p,
|
||||||
int plen,
|
int plen,
|
||||||
void (*printer) (void *, char *, ...),
|
void (*printer) (void *, char *, ...),
|
||||||
void *arg
|
void *arg
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
LWIP_UNUSED_ARG(p);
|
LWIP_UNUSED_ARG(p);
|
||||||
LWIP_UNUSED_ARG(plen);
|
LWIP_UNUSED_ARG(plen);
|
||||||
LWIP_UNUSED_ARG(printer);
|
LWIP_UNUSED_ARG(printer);
|
||||||
LWIP_UNUSED_ARG(arg);
|
LWIP_UNUSED_ARG(arg);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif /* 0 */
|
#endif /* 0 */
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
* 03-01-01 Marc Boucher <marc@mbsi.ca>
|
* 03-01-01 Marc Boucher <marc@mbsi.ca>
|
||||||
* Ported to lwIP.
|
* Ported to lwIP.
|
||||||
* 97-12-04 Guy Lancaster <glanca@gesn.com>, Global Election Systems Inc.
|
* 97-12-04 Guy Lancaster <glanca@gesn.com>, Global Election Systems Inc.
|
||||||
* Original derived from BSD codes.
|
* Original derived from BSD codes.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
/*
|
/*
|
||||||
* upap.h - User/Password Authentication Protocol definitions.
|
* upap.h - User/Password Authentication Protocol definitions.
|
||||||
@ -60,35 +60,35 @@
|
|||||||
/*
|
/*
|
||||||
* Packet header = Code, id, length.
|
* Packet header = Code, id, length.
|
||||||
*/
|
*/
|
||||||
#define UPAP_HEADERLEN (sizeof (u_char) + sizeof (u_char) + sizeof (u_short))
|
#define UPAP_HEADERLEN (sizeof (u_char) + sizeof (u_char) + sizeof (u_short))
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* UPAP codes.
|
* UPAP codes.
|
||||||
*/
|
*/
|
||||||
#define UPAP_AUTHREQ 1 /* Authenticate-Request */
|
#define UPAP_AUTHREQ 1 /* Authenticate-Request */
|
||||||
#define UPAP_AUTHACK 2 /* Authenticate-Ack */
|
#define UPAP_AUTHACK 2 /* Authenticate-Ack */
|
||||||
#define UPAP_AUTHNAK 3 /* Authenticate-Nak */
|
#define UPAP_AUTHNAK 3 /* Authenticate-Nak */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Client states.
|
* Client states.
|
||||||
*/
|
*/
|
||||||
#define UPAPCS_INITIAL 0 /* Connection down */
|
#define UPAPCS_INITIAL 0 /* Connection down */
|
||||||
#define UPAPCS_CLOSED 1 /* Connection up, haven't requested auth */
|
#define UPAPCS_CLOSED 1 /* Connection up, haven't requested auth */
|
||||||
#define UPAPCS_PENDING 2 /* Connection down, have requested auth */
|
#define UPAPCS_PENDING 2 /* Connection down, have requested auth */
|
||||||
#define UPAPCS_AUTHREQ 3 /* We've sent an Authenticate-Request */
|
#define UPAPCS_AUTHREQ 3 /* We've sent an Authenticate-Request */
|
||||||
#define UPAPCS_OPEN 4 /* We've received an Ack */
|
#define UPAPCS_OPEN 4 /* We've received an Ack */
|
||||||
#define UPAPCS_BADAUTH 5 /* We've received a Nak */
|
#define UPAPCS_BADAUTH 5 /* We've received a Nak */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Server states.
|
* Server states.
|
||||||
*/
|
*/
|
||||||
#define UPAPSS_INITIAL 0 /* Connection down */
|
#define UPAPSS_INITIAL 0 /* Connection down */
|
||||||
#define UPAPSS_CLOSED 1 /* Connection up, haven't requested auth */
|
#define UPAPSS_CLOSED 1 /* Connection up, haven't requested auth */
|
||||||
#define UPAPSS_PENDING 2 /* Connection down, have requested auth */
|
#define UPAPSS_PENDING 2 /* Connection down, have requested auth */
|
||||||
#define UPAPSS_LISTEN 3 /* Listening for an Authenticate */
|
#define UPAPSS_LISTEN 3 /* Listening for an Authenticate */
|
||||||
#define UPAPSS_OPEN 4 /* We've sent an Ack */
|
#define UPAPSS_OPEN 4 /* We've sent an Ack */
|
||||||
#define UPAPSS_BADAUTH 5 /* We've sent a Nak */
|
#define UPAPSS_BADAUTH 5 /* We've sent a Nak */
|
||||||
|
|
||||||
|
|
||||||
/************************
|
/************************
|
||||||
@ -99,18 +99,18 @@
|
|||||||
* Each interface is described by upap structure.
|
* Each interface is described by upap structure.
|
||||||
*/
|
*/
|
||||||
typedef struct upap_state {
|
typedef struct upap_state {
|
||||||
int us_unit; /* Interface unit number */
|
int us_unit; /* Interface unit number */
|
||||||
const char *us_user; /* User */
|
const char *us_user; /* User */
|
||||||
int us_userlen; /* User length */
|
int us_userlen; /* User length */
|
||||||
const char *us_passwd; /* Password */
|
const char *us_passwd; /* Password */
|
||||||
int us_passwdlen; /* Password length */
|
int us_passwdlen; /* Password length */
|
||||||
int us_clientstate; /* Client state */
|
int us_clientstate; /* Client state */
|
||||||
int us_serverstate; /* Server state */
|
int us_serverstate; /* Server state */
|
||||||
u_char us_id; /* Current id */
|
u_char us_id; /* Current id */
|
||||||
int us_timeouttime; /* Timeout (seconds) for auth-req retrans. */
|
int us_timeouttime; /* Timeout (seconds) for auth-req retrans. */
|
||||||
int us_transmits; /* Number of auth-reqs sent */
|
int us_transmits; /* Number of auth-reqs sent */
|
||||||
int us_maxtransmits; /* Maximum number of auth-reqs to send */
|
int us_maxtransmits; /* Maximum number of auth-reqs to send */
|
||||||
int us_reqtimeout; /* Time to wait for auth-req from peer */
|
int us_reqtimeout; /* Time to wait for auth-req from peer */
|
||||||
} upap_state;
|
} upap_state;
|
||||||
|
|
||||||
|
|
||||||
@ -121,8 +121,8 @@ typedef struct upap_state {
|
|||||||
extern upap_state upap[];
|
extern upap_state upap[];
|
||||||
|
|
||||||
void upap_setloginpasswd(int unit, const char *luser, const char *lpassword);
|
void upap_setloginpasswd(int unit, const char *luser, const char *lpassword);
|
||||||
void upap_authwithpeer (int, char *, char *);
|
void upap_authwithpeer (int, char *, char *);
|
||||||
void upap_authpeer (int);
|
void upap_authpeer (int);
|
||||||
|
|
||||||
extern struct protent pap_protent;
|
extern struct protent pap_protent;
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
* 03-01-01 Marc Boucher <marc@mbsi.ca>
|
* 03-01-01 Marc Boucher <marc@mbsi.ca>
|
||||||
* Ported to lwIP.
|
* Ported to lwIP.
|
||||||
* 97-11-05 Guy Lancaster <glanca@gesn.com>, Global Election Systems Inc.
|
* 97-11-05 Guy Lancaster <glanca@gesn.com>, Global Election Systems Inc.
|
||||||
* Original derived from BSD codes.
|
* Original derived from BSD codes.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifndef PPP_H
|
#ifndef PPP_H
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -29,7 +29,7 @@
|
|||||||
* 03-01-01 Marc Boucher <marc@mbsi.ca>
|
* 03-01-01 Marc Boucher <marc@mbsi.ca>
|
||||||
* Ported to lwIP.
|
* Ported to lwIP.
|
||||||
* 98-07-29 Guy Lancaster <lancasterg@acm.org>, Global Election Systems Inc.
|
* 98-07-29 Guy Lancaster <lancasterg@acm.org>, Global Election Systems Inc.
|
||||||
* Original.
|
* Original.
|
||||||
*
|
*
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
*/
|
*/
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
* 03-01-01 Marc Boucher <marc@mbsi.ca>
|
* 03-01-01 Marc Boucher <marc@mbsi.ca>
|
||||||
* Ported to lwIP.
|
* Ported to lwIP.
|
||||||
* 98-05-29 Guy Lancaster <glanca@gesn.com>, Global Election Systems Inc.
|
* 98-05-29 Guy Lancaster <glanca@gesn.com>, Global Election Systems Inc.
|
||||||
* Extracted from avos.
|
* Extracted from avos.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifndef RANDM_H
|
#ifndef RANDM_H
|
||||||
|
1057
src/netif/ppp/vj.c
1057
src/netif/ppp/vj.c
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Definitions for tcp compression routines.
|
* Definitions for tcp compression routines.
|
||||||
*
|
*
|
||||||
* $Id: vj.h,v 1.4 2004/02/07 00:30:03 likewise Exp $
|
* $Id: vj.h,v 1.5 2007/12/19 20:47:23 fbernon Exp $
|
||||||
*
|
*
|
||||||
* Copyright (c) 1989 Regents of the University of California.
|
* Copyright (c) 1989 Regents of the University of California.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
@ -18,8 +18,8 @@
|
|||||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
*
|
||||||
* Van Jacobson (van@helios.ee.lbl.gov), Dec 31, 1989:
|
* Van Jacobson (van@helios.ee.lbl.gov), Dec 31, 1989:
|
||||||
* - Initial distribution.
|
* - Initial distribution.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef VJ_H
|
#ifndef VJ_H
|
||||||
@ -27,8 +27,8 @@
|
|||||||
|
|
||||||
#include "vjbsdhdr.h"
|
#include "vjbsdhdr.h"
|
||||||
|
|
||||||
#define MAX_SLOTS 16 /* must be > 2 and < 256 */
|
#define MAX_SLOTS 16 /* must be > 2 and < 256 */
|
||||||
#define MAX_HDR 128
|
#define MAX_HDR 128
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Compressed packet format:
|
* Compressed packet format:
|
||||||
@ -74,22 +74,22 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* packet types */
|
/* packet types */
|
||||||
#define TYPE_IP 0x40
|
#define TYPE_IP 0x40
|
||||||
#define TYPE_UNCOMPRESSED_TCP 0x70
|
#define TYPE_UNCOMPRESSED_TCP 0x70
|
||||||
#define TYPE_COMPRESSED_TCP 0x80
|
#define TYPE_COMPRESSED_TCP 0x80
|
||||||
#define TYPE_ERROR 0x00
|
#define TYPE_ERROR 0x00
|
||||||
|
|
||||||
/* Bits in first octet of compressed packet */
|
/* Bits in first octet of compressed packet */
|
||||||
#define NEW_C 0x40 /* flag bits for what changed in a packet */
|
#define NEW_C 0x40 /* flag bits for what changed in a packet */
|
||||||
#define NEW_I 0x20
|
#define NEW_I 0x20
|
||||||
#define NEW_S 0x08
|
#define NEW_S 0x08
|
||||||
#define NEW_A 0x04
|
#define NEW_A 0x04
|
||||||
#define NEW_W 0x02
|
#define NEW_W 0x02
|
||||||
#define NEW_U 0x01
|
#define NEW_U 0x01
|
||||||
|
|
||||||
/* reserved, special-case values of above */
|
/* reserved, special-case values of above */
|
||||||
#define SPECIAL_I (NEW_S|NEW_W|NEW_U) /* echoed interactive traffic */
|
#define SPECIAL_I (NEW_S|NEW_W|NEW_U) /* echoed interactive traffic */
|
||||||
#define SPECIAL_D (NEW_S|NEW_A|NEW_W|NEW_U) /* unidirectional data */
|
#define SPECIAL_D (NEW_S|NEW_A|NEW_W|NEW_U) /* unidirectional data */
|
||||||
#define SPECIALS_MASK (NEW_S|NEW_A|NEW_W|NEW_U)
|
#define SPECIALS_MASK (NEW_S|NEW_A|NEW_W|NEW_U)
|
||||||
|
|
||||||
#define TCP_PUSH_BIT 0x10
|
#define TCP_PUSH_BIT 0x10
|
||||||
@ -102,54 +102,54 @@
|
|||||||
* the transmit & receive ends of the line use to locate saved header.
|
* the transmit & receive ends of the line use to locate saved header.
|
||||||
*/
|
*/
|
||||||
struct cstate {
|
struct cstate {
|
||||||
struct cstate *cs_next; /* next most recently used state (xmit only) */
|
struct cstate *cs_next; /* next most recently used state (xmit only) */
|
||||||
u_short cs_hlen; /* size of hdr (receive only) */
|
u_short cs_hlen; /* size of hdr (receive only) */
|
||||||
u_char cs_id; /* connection # associated with this state */
|
u_char cs_id; /* connection # associated with this state */
|
||||||
u_char cs_filler;
|
u_char cs_filler;
|
||||||
union {
|
union {
|
||||||
char csu_hdr[MAX_HDR];
|
char csu_hdr[MAX_HDR];
|
||||||
struct ip csu_ip; /* ip/tcp hdr from most recent packet */
|
struct ip csu_ip; /* ip/tcp hdr from most recent packet */
|
||||||
} vjcs_u;
|
} vjcs_u;
|
||||||
};
|
};
|
||||||
#define cs_ip vjcs_u.csu_ip
|
#define cs_ip vjcs_u.csu_ip
|
||||||
#define cs_hdr vjcs_u.csu_hdr
|
#define cs_hdr vjcs_u.csu_hdr
|
||||||
|
|
||||||
|
|
||||||
struct vjstat {
|
struct vjstat {
|
||||||
unsigned long vjs_packets; /* outbound packets */
|
unsigned long vjs_packets; /* outbound packets */
|
||||||
unsigned long vjs_compressed; /* outbound compressed packets */
|
unsigned long vjs_compressed; /* outbound compressed packets */
|
||||||
unsigned long vjs_searches; /* searches for connection state */
|
unsigned long vjs_searches; /* searches for connection state */
|
||||||
unsigned long vjs_misses; /* times couldn't find conn. state */
|
unsigned long vjs_misses; /* times couldn't find conn. state */
|
||||||
unsigned long vjs_uncompressedin; /* inbound uncompressed packets */
|
unsigned long vjs_uncompressedin; /* inbound uncompressed packets */
|
||||||
unsigned long vjs_compressedin; /* inbound compressed packets */
|
unsigned long vjs_compressedin; /* inbound compressed packets */
|
||||||
unsigned long vjs_errorin; /* inbound unknown type packets */
|
unsigned long vjs_errorin; /* inbound unknown type packets */
|
||||||
unsigned long vjs_tossed; /* inbound packets tossed because of error */
|
unsigned long vjs_tossed; /* inbound packets tossed because of error */
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* all the state data for one serial line (we need one of these per line).
|
* all the state data for one serial line (we need one of these per line).
|
||||||
*/
|
*/
|
||||||
struct vjcompress {
|
struct vjcompress {
|
||||||
struct cstate *last_cs; /* most recently used tstate */
|
struct cstate *last_cs; /* most recently used tstate */
|
||||||
u_char last_recv; /* last rcvd conn. id */
|
u_char last_recv; /* last rcvd conn. id */
|
||||||
u_char last_xmit; /* last sent conn. id */
|
u_char last_xmit; /* last sent conn. id */
|
||||||
u_short flags;
|
u_short flags;
|
||||||
u_char maxSlotIndex;
|
u_char maxSlotIndex;
|
||||||
u_char compressSlot; /* Flag indicating OK to compress slot ID. */
|
u_char compressSlot; /* Flag indicating OK to compress slot ID. */
|
||||||
#if LINK_STATS
|
#if LINK_STATS
|
||||||
struct vjstat stats;
|
struct vjstat stats;
|
||||||
#endif
|
#endif
|
||||||
struct cstate tstate[MAX_SLOTS]; /* xmit connection states */
|
struct cstate tstate[MAX_SLOTS]; /* xmit connection states */
|
||||||
struct cstate rstate[MAX_SLOTS]; /* receive connection states */
|
struct cstate rstate[MAX_SLOTS]; /* receive connection states */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* flag values */
|
/* flag values */
|
||||||
#define VJF_TOSS 1U /* tossing rcvd frames because of input err */
|
#define VJF_TOSS 1U /* tossing rcvd frames because of input err */
|
||||||
|
|
||||||
extern void vj_compress_init (struct vjcompress *comp);
|
extern void vj_compress_init (struct vjcompress *comp);
|
||||||
extern u_int vj_compress_tcp (struct vjcompress *comp, struct pbuf *pb);
|
extern u_int vj_compress_tcp (struct vjcompress *comp, struct pbuf *pb);
|
||||||
extern void vj_uncompress_err (struct vjcompress *comp);
|
extern void vj_uncompress_err (struct vjcompress *comp);
|
||||||
extern int vj_uncompress_uncomp(struct pbuf *nb, struct vjcompress *comp);
|
extern int vj_uncompress_uncomp(struct pbuf *nb, struct vjcompress *comp);
|
||||||
extern int vj_uncompress_tcp(struct pbuf **nb, struct vjcompress *comp);
|
extern int vj_uncompress_tcp (struct pbuf **nb, struct vjcompress *comp);
|
||||||
|
|
||||||
#endif /* VJ_H */
|
#endif /* VJ_H */
|
||||||
|
@ -14,29 +14,29 @@ PACK_STRUCT_BEGIN
|
|||||||
struct ip
|
struct ip
|
||||||
{
|
{
|
||||||
#if defined(NO_CHAR_BITFIELDS)
|
#if defined(NO_CHAR_BITFIELDS)
|
||||||
u_char ip_hl_v; /* bug in GCC for mips means the bitfield stuff will sometimes break - so we use a char for both and get round it with macro's instead... */
|
u_char ip_hl_v; /* bug in GCC for mips means the bitfield stuff will sometimes break - so we use a char for both and get round it with macro's instead... */
|
||||||
#else
|
#else
|
||||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||||
unsigned ip_hl:4, /* header length */
|
unsigned ip_hl:4, /* header length */
|
||||||
ip_v:4; /* version */
|
ip_v :4; /* version */
|
||||||
#elif BYTE_ORDER == BIG_ENDIAN
|
#elif BYTE_ORDER == BIG_ENDIAN
|
||||||
unsigned ip_v:4, /* version */
|
unsigned ip_v :4, /* version */
|
||||||
ip_hl:4; /* header length */
|
ip_hl:4; /* header length */
|
||||||
#else
|
#else
|
||||||
COMPLAIN - NO BYTE ORDER SELECTED!
|
COMPLAIN - NO BYTE ORDER SELECTED!
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
u_char ip_tos; /* type of service */
|
u_char ip_tos; /* type of service */
|
||||||
u_short ip_len; /* total length */
|
u_short ip_len; /* total length */
|
||||||
u_short ip_id; /* identification */
|
u_short ip_id; /* identification */
|
||||||
u_short ip_off; /* fragment offset field */
|
u_short ip_off; /* fragment offset field */
|
||||||
#define IP_DF 0x4000 /* dont fragment flag */
|
#define IP_DF 0x4000 /* dont fragment flag */
|
||||||
#define IP_MF 0x2000 /* more fragments flag */
|
#define IP_MF 0x2000 /* more fragments flag */
|
||||||
#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */
|
#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */
|
||||||
u_char ip_ttl; /* time to live */
|
u_char ip_ttl; /* time to live */
|
||||||
u_char ip_p; /* protocol */
|
u_char ip_p; /* protocol */
|
||||||
u_short ip_sum; /* checksum */
|
u_short ip_sum; /* checksum */
|
||||||
struct in_addr ip_src,ip_dst; /* source and dest address */
|
struct in_addr ip_src,ip_dst; /* source and dest address */
|
||||||
};
|
};
|
||||||
PACK_STRUCT_END
|
PACK_STRUCT_END
|
||||||
|
|
||||||
@ -49,26 +49,26 @@ typedef u32_t tcp_seq;
|
|||||||
PACK_STRUCT_BEGIN
|
PACK_STRUCT_BEGIN
|
||||||
struct tcphdr
|
struct tcphdr
|
||||||
{
|
{
|
||||||
u_short th_sport; /* source port */
|
u_short th_sport; /* source port */
|
||||||
u_short th_dport; /* destination port */
|
u_short th_dport; /* destination port */
|
||||||
tcp_seq th_seq; /* sequence number */
|
tcp_seq th_seq; /* sequence number */
|
||||||
tcp_seq th_ack; /* acknowledgement number */
|
tcp_seq th_ack; /* acknowledgement number */
|
||||||
#if defined(NO_CHAR_BITFIELDS)
|
#if defined(NO_CHAR_BITFIELDS)
|
||||||
u_char th_x2_off;
|
u_char th_x2_off;
|
||||||
#else
|
#else
|
||||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||||
unsigned th_x2:4, /* (unused) */
|
unsigned th_x2 :4, /* (unused) */
|
||||||
th_off:4; /* data offset */
|
th_off:4; /* data offset */
|
||||||
#endif
|
#endif
|
||||||
#if BYTE_ORDER == BIG_ENDIAN
|
#if BYTE_ORDER == BIG_ENDIAN
|
||||||
unsigned th_off:4, /* data offset */
|
unsigned th_off:4, /* data offset */
|
||||||
th_x2:4; /* (unused) */
|
th_x2 :4; /* (unused) */
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
u_char th_flags;
|
u_char th_flags;
|
||||||
u_short th_win; /* window */
|
u_short th_win; /* window */
|
||||||
u_short th_sum; /* checksum */
|
u_short th_sum; /* checksum */
|
||||||
u_short th_urp; /* urgent pointer */
|
u_short th_urp; /* urgent pointer */
|
||||||
};
|
};
|
||||||
PACK_STRUCT_END
|
PACK_STRUCT_END
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user