mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-08-03 21:14:40 +08:00
First fix for bug #21664 "PPP code is broken".
This commit is contained in:
parent
788892ee7c
commit
b714cd5f4b
@ -64,8 +64,13 @@
|
|||||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "lwip/opt.h"
|
||||||
|
|
||||||
|
#if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */
|
||||||
|
|
||||||
#include "ppp.h"
|
#include "ppp.h"
|
||||||
#if PPP_SUPPORT > 0
|
#include "pppdebug.h"
|
||||||
|
|
||||||
#include "fsm.h"
|
#include "fsm.h"
|
||||||
#include "lcp.h"
|
#include "lcp.h"
|
||||||
#include "pap.h"
|
#include "pap.h"
|
||||||
@ -73,12 +78,9 @@
|
|||||||
#include "auth.h"
|
#include "auth.h"
|
||||||
#include "ipcp.h"
|
#include "ipcp.h"
|
||||||
|
|
||||||
#if CBCP_SUPPORT > 0
|
#if CBCP_SUPPORT
|
||||||
#include "cbcp.h"
|
#include "cbcp.h"
|
||||||
#endif
|
#endif /* CBCP_SUPPORT */
|
||||||
|
|
||||||
#include "pppdebug.h"
|
|
||||||
|
|
||||||
|
|
||||||
/*************************/
|
/*************************/
|
||||||
/*** LOCAL DEFINITIONS ***/
|
/*** LOCAL DEFINITIONS ***/
|
||||||
@ -122,13 +124,13 @@ static int get_pap_passwd (int, char *, char *);
|
|||||||
static int have_pap_secret (void);
|
static int have_pap_secret (void);
|
||||||
static int have_chap_secret (char *, char *, u32_t);
|
static int have_chap_secret (char *, char *, u32_t);
|
||||||
static int ip_addr_check (u32_t, struct wordlist *);
|
static int ip_addr_check (u32_t, struct wordlist *);
|
||||||
#if 0 /* PAP_SUPPORT > 0 || CHAP_SUPPORT > 0 */
|
#if 0 /* PAP_SUPPORT || CHAP_SUPPORT */
|
||||||
static void set_allowed_addrs(int unit, struct wordlist *addrs);
|
static void set_allowed_addrs(int unit, struct wordlist *addrs);
|
||||||
static void free_wordlist (struct wordlist *);
|
static void free_wordlist (struct wordlist *);
|
||||||
#endif
|
#endif /* 0 */ /* PAP_SUPPORT || CHAP_SUPPORT */
|
||||||
#if CBCP_SUPPORT > 0
|
#if CBCP_SUPPORT
|
||||||
static void callback_phase (int);
|
static void callback_phase (int);
|
||||||
#endif
|
#endif /* CBCP_SUPPORT */
|
||||||
|
|
||||||
|
|
||||||
/******************************/
|
/******************************/
|
||||||
@ -139,10 +141,10 @@ static void callback_phase (int);
|
|||||||
/*****************************/
|
/*****************************/
|
||||||
/*** LOCAL DATA STRUCTURES ***/
|
/*** LOCAL DATA STRUCTURES ***/
|
||||||
/*****************************/
|
/*****************************/
|
||||||
#if PAP_SUPPORT > 0 || CHAP_SUPPORT > 0
|
#if PAP_SUPPORT || CHAP_SUPPORT
|
||||||
/* The name by which the peer authenticated itself to us. */
|
/* The name by which the peer authenticated itself to us. */
|
||||||
static char peer_authname[MAXNAMELEN];
|
static char peer_authname[MAXNAMELEN];
|
||||||
#endif
|
#endif /* PAP_SUPPORT || CHAP_SUPPORT */
|
||||||
|
|
||||||
/* Records which authentication operations haven't completed yet. */
|
/* Records which authentication operations haven't completed yet. */
|
||||||
static int auth_pending[NUM_PPP];
|
static int auth_pending[NUM_PPP];
|
||||||
@ -162,10 +164,10 @@ static int num_np_open;
|
|||||||
/* Number of network protocols which have come up. */
|
/* Number of network protocols which have come up. */
|
||||||
static int num_np_up;
|
static int num_np_up;
|
||||||
|
|
||||||
#if PAP_SUPPORT > 0 || CHAP_SUPPORT > 0
|
#if PAP_SUPPORT || CHAP_SUPPORT
|
||||||
/* Set if we got the contents of passwd[] from the pap-secrets file. */
|
/* Set if we got the contents of passwd[] from the pap-secrets file. */
|
||||||
static int passwd_from_file;
|
static int passwd_from_file;
|
||||||
#endif
|
#endif /* PAP_SUPPORT || CHAP_SUPPORT */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -237,9 +239,9 @@ void link_established(int unit)
|
|||||||
struct protent *protp;
|
struct protent *protp;
|
||||||
lcp_options *wo = &lcp_wantoptions[unit];
|
lcp_options *wo = &lcp_wantoptions[unit];
|
||||||
lcp_options *go = &lcp_gotoptions[unit];
|
lcp_options *go = &lcp_gotoptions[unit];
|
||||||
#if PAP_SUPPORT > 0 || CHAP_SUPPORT > 0
|
#if PAP_SUPPORT || CHAP_SUPPORT
|
||||||
lcp_options *ho = &lcp_hisoptions[unit];
|
lcp_options *ho = &lcp_hisoptions[unit];
|
||||||
#endif
|
#endif /* PAP_SUPPORT || CHAP_SUPPORT */
|
||||||
|
|
||||||
AUTHDEBUG((LOG_INFO, "link_established: %d\n", unit));
|
AUTHDEBUG((LOG_INFO, "link_established: %d\n", unit));
|
||||||
/*
|
/*
|
||||||
@ -265,31 +267,31 @@ void link_established(int unit)
|
|||||||
|
|
||||||
lcp_phase[unit] = PHASE_AUTHENTICATE;
|
lcp_phase[unit] = PHASE_AUTHENTICATE;
|
||||||
auth = 0;
|
auth = 0;
|
||||||
#if CHAP_SUPPORT > 0
|
#if CHAP_SUPPORT
|
||||||
if (go->neg_chap) {
|
if (go->neg_chap) {
|
||||||
ChapAuthPeer(unit, ppp_settings.our_name, go->chap_mdtype);
|
ChapAuthPeer(unit, ppp_settings.our_name, go->chap_mdtype);
|
||||||
auth |= CHAP_PEER;
|
auth |= CHAP_PEER;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* CHAP_SUPPORT */
|
||||||
#if PAP_SUPPORT > 0 && CHAP_SUPPORT > 0
|
#if PAP_SUPPORT && CHAP_SUPPORT
|
||||||
else
|
else
|
||||||
#endif
|
#endif /* PAP_SUPPORT && CHAP_SUPPORT */
|
||||||
#if PAP_SUPPORT > 0
|
#if PAP_SUPPORT
|
||||||
if (go->neg_upap) {
|
if (go->neg_upap) {
|
||||||
upap_authpeer(unit);
|
upap_authpeer(unit);
|
||||||
auth |= PAP_PEER;
|
auth |= PAP_PEER;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* PAP_SUPPORT */
|
||||||
#if CHAP_SUPPORT > 0
|
#if CHAP_SUPPORT
|
||||||
if (ho->neg_chap) {
|
if (ho->neg_chap) {
|
||||||
ChapAuthWithPeer(unit, ppp_settings.user, ho->chap_mdtype);
|
ChapAuthWithPeer(unit, ppp_settings.user, ho->chap_mdtype);
|
||||||
auth |= CHAP_WITHPEER;
|
auth |= CHAP_WITHPEER;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* CHAP_SUPPORT */
|
||||||
#if PAP_SUPPORT > 0 && CHAP_SUPPORT > 0
|
#if PAP_SUPPORT && CHAP_SUPPORT
|
||||||
else
|
else
|
||||||
#endif
|
#endif /* PAP_SUPPORT && CHAP_SUPPORT */
|
||||||
#if PAP_SUPPORT > 0
|
#if PAP_SUPPORT
|
||||||
if (ho->neg_upap) {
|
if (ho->neg_upap) {
|
||||||
if (ppp_settings.passwd[0] == 0) {
|
if (ppp_settings.passwd[0] == 0) {
|
||||||
passwd_from_file = 1;
|
passwd_from_file = 1;
|
||||||
@ -299,7 +301,7 @@ void link_established(int unit)
|
|||||||
upap_authwithpeer(unit, ppp_settings.user, ppp_settings.passwd);
|
upap_authwithpeer(unit, ppp_settings.user, ppp_settings.passwd);
|
||||||
auth |= PAP_WITHPEER;
|
auth |= PAP_WITHPEER;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* PAP_SUPPORT */
|
||||||
auth_pending[unit] = auth;
|
auth_pending[unit] = auth;
|
||||||
|
|
||||||
if (!auth)
|
if (!auth)
|
||||||
@ -320,7 +322,7 @@ void auth_peer_fail(int unit, u16_t protocol)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if PAP_SUPPORT > 0 || CHAP_SUPPORT > 0
|
#if PAP_SUPPORT || CHAP_SUPPORT
|
||||||
/*
|
/*
|
||||||
* The peer has been successfully authenticated using `protocol'.
|
* The peer has been successfully authenticated using `protocol'.
|
||||||
*/
|
*/
|
||||||
@ -412,7 +414,7 @@ void auth_withpeer_success(int unit, u16_t protocol)
|
|||||||
if ((auth_pending[unit] &= ~pbit) == 0)
|
if ((auth_pending[unit] &= ~pbit) == 0)
|
||||||
network_phase(unit);
|
network_phase(unit);
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* PAP_SUPPORT || CHAP_SUPPORT */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -487,8 +489,7 @@ void auth_reset(int unit)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if PAP_SUPPORT
|
||||||
#if PAP_SUPPORT > 0
|
|
||||||
/*
|
/*
|
||||||
* check_passwd - Check the user name and passwd against the PAP secrets
|
* check_passwd - Check the user name and passwd against the PAP secrets
|
||||||
* file. If requested, also check against the system password database,
|
* file. If requested, also check against the system password database,
|
||||||
@ -564,7 +565,7 @@ int check_passwd(
|
|||||||
return ret;
|
return ret;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* PAP_SUPPORT */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -589,7 +590,7 @@ int bad_ip_adrs(u32_t addr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if CHAP_SUPPORT > 0
|
#if CHAP_SUPPORT
|
||||||
/*
|
/*
|
||||||
* get_secret - open the CHAP secret file and return the secret
|
* get_secret - open the CHAP secret file and return the secret
|
||||||
* for authenticating the given client on the given server.
|
* for authenticating the given client on the given server.
|
||||||
@ -650,7 +651,7 @@ int get_secret(
|
|||||||
return 1;
|
return 1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* CHAP_SUPPORT */
|
||||||
|
|
||||||
|
|
||||||
#if 0 /* UNUSED */
|
#if 0 /* UNUSED */
|
||||||
@ -713,7 +714,7 @@ static void network_phase(int unit)
|
|||||||
did_authup = 1;
|
did_authup = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CBCP_SUPPORT > 0
|
#if CBCP_SUPPORT
|
||||||
/*
|
/*
|
||||||
* If we negotiated callback, do it now.
|
* If we negotiated callback, do it now.
|
||||||
*/
|
*/
|
||||||
@ -722,7 +723,7 @@ static void network_phase(int unit)
|
|||||||
(*cbcp_protent.open)(unit);
|
(*cbcp_protent.open)(unit);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* CBCP_SUPPORT */
|
||||||
|
|
||||||
lcp_phase[unit] = PHASE_NETWORK;
|
lcp_phase[unit] = PHASE_NETWORK;
|
||||||
for (i = 0; (protp = ppp_protocols[i]) != NULL; ++i)
|
for (i = 0; (protp = ppp_protocols[i]) != NULL; ++i)
|
||||||
@ -858,7 +859,7 @@ static int have_chap_secret(char *client, char *server, u32_t remote)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if 0 /* PAP_SUPPORT > 0 || CHAP_SUPPORT > 0 */
|
#if 0 /* PAP_SUPPORT || CHAP_SUPPORT */
|
||||||
/*
|
/*
|
||||||
* set_allowed_addrs() - set the list of allowed addresses.
|
* set_allowed_addrs() - set the list of allowed addresses.
|
||||||
*/
|
*/
|
||||||
@ -892,7 +893,7 @@ static void set_allowed_addrs(int unit, struct wordlist *addrs)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* 0 */ /* PAP_SUPPORT || CHAP_SUPPORT */
|
||||||
|
|
||||||
static int ip_addr_check(u32_t addr, struct wordlist *addrs)
|
static int ip_addr_check(u32_t addr, struct wordlist *addrs)
|
||||||
{
|
{
|
||||||
@ -908,7 +909,7 @@ static int ip_addr_check(u32_t addr, struct wordlist *addrs)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0 /* PAP_SUPPORT > 0 || CHAP_SUPPORT */
|
#if 0 /* PAP_SUPPORT || CHAP_SUPPORT */
|
||||||
/*
|
/*
|
||||||
* free_wordlist - release memory allocated for a wordlist.
|
* free_wordlist - release memory allocated for a wordlist.
|
||||||
*/
|
*/
|
||||||
@ -922,6 +923,6 @@ static void free_wordlist(struct wordlist *wp)
|
|||||||
wp = next;
|
wp = next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* 0 */ /* PAP_SUPPORT || CHAP_SUPPORT */
|
||||||
|
|
||||||
#endif /* PPP_SUPPORT */
|
#endif /* PPP_SUPPORT */
|
||||||
|
@ -90,5 +90,4 @@ int auth_ip_addr (int, u32_t);
|
|||||||
/* check if IP address is unreasonable */
|
/* check if IP address is unreasonable */
|
||||||
int bad_ip_adrs (u32_t);
|
int bad_ip_adrs (u32_t);
|
||||||
|
|
||||||
|
|
||||||
#endif /* AUTH_H */
|
#endif /* AUTH_H */
|
||||||
|
@ -66,18 +66,21 @@
|
|||||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "lwip/opt.h"
|
||||||
|
|
||||||
|
#if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */
|
||||||
|
|
||||||
|
#if CHAP_SUPPORT /* don't build if not configured for use in lwipopts.h */
|
||||||
|
|
||||||
#include "ppp.h"
|
#include "ppp.h"
|
||||||
#if PPP_SUPPORT > 0
|
#include "pppdebug.h"
|
||||||
|
|
||||||
#include "magic.h"
|
#include "magic.h"
|
||||||
|
|
||||||
#if CHAP_SUPPORT > 0
|
|
||||||
|
|
||||||
#include "randm.h"
|
#include "randm.h"
|
||||||
#include "auth.h"
|
#include "auth.h"
|
||||||
#include "md5.h"
|
#include "md5.h"
|
||||||
#include "chap.h"
|
#include "chap.h"
|
||||||
#include "chpms.h"
|
#include "chpms.h"
|
||||||
#include "pppdebug.h"
|
|
||||||
|
|
||||||
|
|
||||||
/*************************/
|
/*************************/
|
||||||
@ -865,6 +868,6 @@ static int ChapPrintPkt(
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* CHAP_SUPPORT > 0 */
|
#endif /* CHAP_SUPPORT */
|
||||||
|
|
||||||
#endif /* PPP_SUPPORT */
|
#endif /* PPP_SUPPORT */
|
||||||
|
@ -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.1 2003/05/27 14:37:56 jani Exp $
|
* $Id: chap.h,v 1.2 2007/11/29 22:19:57 fbernon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CHAP_H
|
#ifndef CHAP_H
|
||||||
@ -164,4 +164,3 @@ void ChapAuthWithPeer (int, char *, int);
|
|||||||
void ChapAuthPeer (int, char *, int);
|
void ChapAuthPeer (int, char *, int);
|
||||||
|
|
||||||
#endif /* CHAP_H */
|
#endif /* CHAP_H */
|
||||||
|
|
||||||
|
@ -66,10 +66,14 @@
|
|||||||
|
|
||||||
#define USE_CRYPT
|
#define USE_CRYPT
|
||||||
|
|
||||||
|
#include "lwip/opt.h"
|
||||||
|
|
||||||
|
#if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */
|
||||||
|
|
||||||
|
#if MSCHAP_SUPPORT /* don't build if not configured for use in lwipopts.h */
|
||||||
|
|
||||||
#include "ppp.h"
|
#include "ppp.h"
|
||||||
|
#include "pppdebug.h"
|
||||||
#if MSCHAP_SUPPORT > 0
|
|
||||||
|
|
||||||
#include "md4.h"
|
#include "md4.h"
|
||||||
#ifndef USE_CRYPT
|
#ifndef USE_CRYPT
|
||||||
@ -77,7 +81,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "chap.h"
|
#include "chap.h"
|
||||||
#include "chpms.h"
|
#include "chpms.h"
|
||||||
#include "pppdebug.h"
|
|
||||||
|
|
||||||
|
|
||||||
/*************************/
|
/*************************/
|
||||||
@ -396,3 +399,4 @@ static ChapMS_LANMan(
|
|||||||
|
|
||||||
#endif /* MSCHAP_SUPPORT */
|
#endif /* MSCHAP_SUPPORT */
|
||||||
|
|
||||||
|
#endif /* PPP_SUPPORT */
|
||||||
|
@ -49,23 +49,42 @@
|
|||||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TODO:
|
* TODO:
|
||||||
* Randomize fsm id on link/init.
|
* Randomize fsm id on link/init.
|
||||||
* Deal with variable outgoing MTU.
|
* Deal with variable outgoing MTU.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "lwip/opt.h"
|
||||||
|
|
||||||
|
#if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */
|
||||||
|
|
||||||
#include "ppp.h"
|
#include "ppp.h"
|
||||||
#if PPP_SUPPORT > 0
|
|
||||||
#include "fsm.h"
|
|
||||||
#include "pppdebug.h"
|
#include "pppdebug.h"
|
||||||
|
|
||||||
|
#include "fsm.h"
|
||||||
|
|
||||||
|
|
||||||
/*************************/
|
/*************************/
|
||||||
/*** LOCAL DEFINITIONS ***/
|
/*** LOCAL DEFINITIONS ***/
|
||||||
/*************************/
|
/*************************/
|
||||||
|
|
||||||
|
#if PPP_DEBUG
|
||||||
|
|
||||||
|
static const char *ppperr_strerr[] = {
|
||||||
|
"LS_INITIAL", /* LS_INITIAL 0 */
|
||||||
|
"LS_STARTING", /* LS_STARTING 1 */
|
||||||
|
"LS_CLOSED", /* LS_CLOSED 2 */
|
||||||
|
"LS_STOPPED", /* LS_STOPPED 3 */
|
||||||
|
"LS_CLOSING", /* LS_CLOSING 4 */
|
||||||
|
"LS_STOPPING", /* LS_STOPPING 5 */
|
||||||
|
"LS_REQSENT", /* LS_REQSENT 6 */
|
||||||
|
"LS_ACKRCVD", /* LS_ACKRCVD 7 */
|
||||||
|
"LS_ACKSENT", /* LS_ACKSENT 8 */
|
||||||
|
"LS_OPENED" /* LS_OPENED 9 */
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* PPP_DEBUG */
|
||||||
|
|
||||||
/************************/
|
/************************/
|
||||||
/*** LOCAL DATA TYPES ***/
|
/*** LOCAL DATA TYPES ***/
|
||||||
@ -109,7 +128,7 @@ int peer_mru[NUM_PPP];
|
|||||||
*/
|
*/
|
||||||
void fsm_init(fsm *f)
|
void fsm_init(fsm *f)
|
||||||
{
|
{
|
||||||
f->state = INITIAL;
|
f->state = LS_INITIAL;
|
||||||
f->flags = 0;
|
f->flags = 0;
|
||||||
f->id = 0; /* XXX Start with random id? */
|
f->id = 0; /* XXX Start with random id? */
|
||||||
f->timeouttime = FSM_DEFTIMEOUT;
|
f->timeouttime = FSM_DEFTIMEOUT;
|
||||||
@ -128,27 +147,27 @@ void fsm_lowerup(fsm *f)
|
|||||||
int oldState = f->state;
|
int oldState = f->state;
|
||||||
|
|
||||||
switch( f->state ){
|
switch( f->state ){
|
||||||
case INITIAL:
|
case LS_INITIAL:
|
||||||
f->state = CLOSED;
|
f->state = LS_CLOSED;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STARTING:
|
case LS_STARTING:
|
||||||
if( f->flags & OPT_SILENT )
|
if( f->flags & OPT_SILENT )
|
||||||
f->state = STOPPED;
|
f->state = LS_STOPPED;
|
||||||
else {
|
else {
|
||||||
/* Send an initial configure-request */
|
/* Send an initial configure-request */
|
||||||
fsm_sconfreq(f, 0);
|
fsm_sconfreq(f, 0);
|
||||||
f->state = REQSENT;
|
f->state = LS_REQSENT;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
FSMDEBUG((LOG_INFO, "%s: Up event in state %d!\n",
|
FSMDEBUG((LOG_INFO, "%s: Up event in state %d (%s)!\n",
|
||||||
PROTO_NAME(f), f->state));
|
PROTO_NAME(f), f->state, ppperr_strerr[f->state]));
|
||||||
}
|
}
|
||||||
|
|
||||||
FSMDEBUG((LOG_INFO, "%s: lowerup state %d -> %d\n",
|
FSMDEBUG((LOG_INFO, "%s: lowerup state %d (%s) -> %d (%s)\n",
|
||||||
PROTO_NAME(f), oldState, f->state));
|
PROTO_NAME(f), oldState, ppperr_strerr[oldState], f->state, ppperr_strerr[f->state]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -162,42 +181,42 @@ void fsm_lowerdown(fsm *f)
|
|||||||
int oldState = f->state;
|
int oldState = f->state;
|
||||||
|
|
||||||
switch( f->state ){
|
switch( f->state ){
|
||||||
case CLOSED:
|
case LS_CLOSED:
|
||||||
f->state = INITIAL;
|
f->state = LS_INITIAL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STOPPED:
|
case LS_STOPPED:
|
||||||
f->state = STARTING;
|
f->state = LS_STARTING;
|
||||||
if( f->callbacks->starting )
|
if( f->callbacks->starting )
|
||||||
(*f->callbacks->starting)(f);
|
(*f->callbacks->starting)(f);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CLOSING:
|
case LS_CLOSING:
|
||||||
f->state = INITIAL;
|
f->state = LS_INITIAL;
|
||||||
UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */
|
UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STOPPING:
|
case LS_STOPPING:
|
||||||
case REQSENT:
|
case LS_REQSENT:
|
||||||
case ACKRCVD:
|
case LS_ACKRCVD:
|
||||||
case ACKSENT:
|
case LS_ACKSENT:
|
||||||
f->state = STARTING;
|
f->state = LS_STARTING;
|
||||||
UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */
|
UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OPENED:
|
case LS_OPENED:
|
||||||
if( f->callbacks->down )
|
if( f->callbacks->down )
|
||||||
(*f->callbacks->down)(f);
|
(*f->callbacks->down)(f);
|
||||||
f->state = STARTING;
|
f->state = LS_STARTING;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
FSMDEBUG((LOG_INFO, "%s: Down event in state %d!\n",
|
FSMDEBUG((LOG_INFO, "%s: Down event in state %d (%s)!\n",
|
||||||
PROTO_NAME(f), f->state));
|
PROTO_NAME(f), f->state, ppperr_strerr[f->state]));
|
||||||
}
|
}
|
||||||
|
|
||||||
FSMDEBUG((LOG_INFO, "%s: lowerdown state %d -> %d\n",
|
FSMDEBUG((LOG_INFO, "%s: lowerdown state %d (%s) -> %d (%s)\n",
|
||||||
PROTO_NAME(f), oldState, f->state));
|
PROTO_NAME(f), oldState, ppperr_strerr[oldState], f->state, ppperr_strerr[f->state]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -209,27 +228,27 @@ void fsm_open(fsm *f)
|
|||||||
int oldState = f->state;
|
int oldState = f->state;
|
||||||
|
|
||||||
switch( f->state ){
|
switch( f->state ){
|
||||||
case INITIAL:
|
case LS_INITIAL:
|
||||||
f->state = STARTING;
|
f->state = LS_STARTING;
|
||||||
if( f->callbacks->starting )
|
if( f->callbacks->starting )
|
||||||
(*f->callbacks->starting)(f);
|
(*f->callbacks->starting)(f);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CLOSED:
|
case LS_CLOSED:
|
||||||
if( f->flags & OPT_SILENT )
|
if( f->flags & OPT_SILENT )
|
||||||
f->state = STOPPED;
|
f->state = LS_STOPPED;
|
||||||
else {
|
else {
|
||||||
/* Send an initial configure-request */
|
/* Send an initial configure-request */
|
||||||
fsm_sconfreq(f, 0);
|
fsm_sconfreq(f, 0);
|
||||||
f->state = REQSENT;
|
f->state = LS_REQSENT;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CLOSING:
|
case LS_CLOSING:
|
||||||
f->state = STOPPING;
|
f->state = LS_STOPPING;
|
||||||
/* fall through */
|
/* fall through */
|
||||||
case STOPPED:
|
case LS_STOPPED:
|
||||||
case OPENED:
|
case LS_OPENED:
|
||||||
if( f->flags & OPT_RESTART ){
|
if( f->flags & OPT_RESTART ){
|
||||||
fsm_lowerdown(f);
|
fsm_lowerdown(f);
|
||||||
fsm_lowerup(f);
|
fsm_lowerup(f);
|
||||||
@ -237,8 +256,8 @@ void fsm_open(fsm *f)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
FSMDEBUG((LOG_INFO, "%s: open state %d -> %d\n",
|
FSMDEBUG((LOG_INFO, "%s: open state %d (%s) -> %d (%s)\n",
|
||||||
PROTO_NAME(f), oldState, f->state));
|
PROTO_NAME(f), oldState, ppperr_strerr[oldState], f->state, ppperr_strerr[f->state]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -246,7 +265,7 @@ void fsm_open(fsm *f)
|
|||||||
* fsm_close - Start closing connection.
|
* fsm_close - Start closing connection.
|
||||||
*
|
*
|
||||||
* Cancel timeouts and either initiate close or possibly go directly to
|
* Cancel timeouts and either initiate close or possibly go directly to
|
||||||
* the CLOSED state.
|
* the LS_CLOSED state.
|
||||||
*/
|
*/
|
||||||
void fsm_close(fsm *f, char *reason)
|
void fsm_close(fsm *f, char *reason)
|
||||||
{
|
{
|
||||||
@ -255,21 +274,21 @@ void fsm_close(fsm *f, char *reason)
|
|||||||
f->term_reason = reason;
|
f->term_reason = reason;
|
||||||
f->term_reason_len = (reason == NULL? 0: strlen(reason));
|
f->term_reason_len = (reason == NULL? 0: strlen(reason));
|
||||||
switch( f->state ){
|
switch( f->state ){
|
||||||
case STARTING:
|
case LS_STARTING:
|
||||||
f->state = INITIAL;
|
f->state = LS_INITIAL;
|
||||||
break;
|
break;
|
||||||
case STOPPED:
|
case LS_STOPPED:
|
||||||
f->state = CLOSED;
|
f->state = LS_CLOSED;
|
||||||
break;
|
break;
|
||||||
case STOPPING:
|
case LS_STOPPING:
|
||||||
f->state = CLOSING;
|
f->state = LS_CLOSING;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case REQSENT:
|
case LS_REQSENT:
|
||||||
case ACKRCVD:
|
case LS_ACKRCVD:
|
||||||
case ACKSENT:
|
case LS_ACKSENT:
|
||||||
case OPENED:
|
case LS_OPENED:
|
||||||
if( f->state != OPENED )
|
if( f->state != LS_OPENED )
|
||||||
UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */
|
UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */
|
||||||
else if( f->callbacks->down )
|
else if( f->callbacks->down )
|
||||||
(*f->callbacks->down)(f); /* Inform upper layers we're down */
|
(*f->callbacks->down)(f); /* Inform upper layers we're down */
|
||||||
@ -281,12 +300,12 @@ void fsm_close(fsm *f, char *reason)
|
|||||||
TIMEOUT(fsm_timeout, f, f->timeouttime);
|
TIMEOUT(fsm_timeout, f, f->timeouttime);
|
||||||
--f->retransmits;
|
--f->retransmits;
|
||||||
|
|
||||||
f->state = CLOSING;
|
f->state = LS_CLOSING;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
FSMDEBUG((LOG_INFO, "%s: close reason=%s state %d -> %d\n",
|
FSMDEBUG((LOG_INFO, "%s: close reason=%s state %d (%s) -> %d (%s)\n",
|
||||||
PROTO_NAME(f), reason, oldState, f->state));
|
PROTO_NAME(f), reason, oldState, ppperr_strerr[oldState], f->state, ppperr_strerr[f->state]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -356,9 +375,9 @@ void fsm_input(fsm *f, u_char *inpacket, int l)
|
|||||||
}
|
}
|
||||||
len -= HEADERLEN; /* subtract header length */
|
len -= HEADERLEN; /* subtract header length */
|
||||||
|
|
||||||
if( f->state == INITIAL || f->state == STARTING ){
|
if( f->state == LS_INITIAL || f->state == LS_STARTING ){
|
||||||
FSMDEBUG((LOG_INFO, "fsm_input(%x): Rcvd packet in state %d.\n",
|
FSMDEBUG((LOG_INFO, "fsm_input(%x): Rcvd packet in state %d (%s).\n",
|
||||||
f->protocol, f->state));
|
f->protocol, f->state, ppperr_strerr[f->state]));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FSMDEBUG((LOG_INFO, "fsm_input(%s):%d,%d,%d\n", PROTO_NAME(f), code, id, l));
|
FSMDEBUG((LOG_INFO, "fsm_input(%s):%d,%d,%d\n", PROTO_NAME(f), code, id, l));
|
||||||
@ -408,28 +427,28 @@ void fsm_input(fsm *f, u_char *inpacket, int l)
|
|||||||
void fsm_protreject(fsm *f)
|
void fsm_protreject(fsm *f)
|
||||||
{
|
{
|
||||||
switch( f->state ){
|
switch( f->state ){
|
||||||
case CLOSING:
|
case LS_CLOSING:
|
||||||
UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */
|
UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */
|
||||||
/* fall through */
|
/* fall through */
|
||||||
case CLOSED:
|
case LS_CLOSED:
|
||||||
f->state = CLOSED;
|
f->state = LS_CLOSED;
|
||||||
if( f->callbacks->finished )
|
if( f->callbacks->finished )
|
||||||
(*f->callbacks->finished)(f);
|
(*f->callbacks->finished)(f);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STOPPING:
|
case LS_STOPPING:
|
||||||
case REQSENT:
|
case LS_REQSENT:
|
||||||
case ACKRCVD:
|
case LS_ACKRCVD:
|
||||||
case ACKSENT:
|
case LS_ACKSENT:
|
||||||
UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */
|
UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */
|
||||||
/* fall through */
|
/* fall through */
|
||||||
case STOPPED:
|
case LS_STOPPED:
|
||||||
f->state = STOPPED;
|
f->state = LS_STOPPED;
|
||||||
if( f->callbacks->finished )
|
if( f->callbacks->finished )
|
||||||
(*f->callbacks->finished)(f);
|
(*f->callbacks->finished)(f);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OPENED:
|
case LS_OPENED:
|
||||||
if( f->callbacks->down )
|
if( f->callbacks->down )
|
||||||
(*f->callbacks->down)(f);
|
(*f->callbacks->down)(f);
|
||||||
|
|
||||||
@ -440,12 +459,12 @@ void fsm_protreject(fsm *f)
|
|||||||
TIMEOUT(fsm_timeout, f, f->timeouttime);
|
TIMEOUT(fsm_timeout, f, f->timeouttime);
|
||||||
--f->retransmits;
|
--f->retransmits;
|
||||||
|
|
||||||
f->state = STOPPING;
|
f->state = LS_STOPPING;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
FSMDEBUG((LOG_INFO, "%s: Protocol-reject event in state %d!\n",
|
FSMDEBUG((LOG_INFO, "%s: Protocol-reject event in state %d (%s)!\n",
|
||||||
PROTO_NAME(f), f->state));
|
PROTO_NAME(f), f->state, ppperr_strerr[f->state]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -465,20 +484,20 @@ static void fsm_timeout(void *arg)
|
|||||||
fsm *f = (fsm *) arg;
|
fsm *f = (fsm *) arg;
|
||||||
|
|
||||||
switch (f->state) {
|
switch (f->state) {
|
||||||
case CLOSING:
|
case LS_CLOSING:
|
||||||
case STOPPING:
|
case LS_STOPPING:
|
||||||
if( f->retransmits <= 0 ){
|
if( f->retransmits <= 0 ){
|
||||||
FSMDEBUG((LOG_WARNING, "%s: timeout sending Terminate-Request state=%d\n",
|
FSMDEBUG((LOG_WARNING, "%s: timeout sending Terminate-Request state=%d (%s)\n",
|
||||||
PROTO_NAME(f), f->state));
|
PROTO_NAME(f), f->state, ppperr_strerr[f->state]));
|
||||||
/*
|
/*
|
||||||
* We've waited for an ack long enough. Peer probably heard us.
|
* We've waited for an ack long enough. Peer probably heard us.
|
||||||
*/
|
*/
|
||||||
f->state = (f->state == CLOSING)? CLOSED: STOPPED;
|
f->state = (f->state == LS_CLOSING)? LS_CLOSED: LS_STOPPED;
|
||||||
if( f->callbacks->finished )
|
if( f->callbacks->finished )
|
||||||
(*f->callbacks->finished)(f);
|
(*f->callbacks->finished)(f);
|
||||||
} else {
|
} else {
|
||||||
FSMDEBUG((LOG_WARNING, "%s: timeout resending Terminate-Requests state=%d\n",
|
FSMDEBUG((LOG_WARNING, "%s: timeout resending Terminate-Requests state=%d (%s)\n",
|
||||||
PROTO_NAME(f), f->state));
|
PROTO_NAME(f), f->state, ppperr_strerr[f->state]));
|
||||||
/* Send Terminate-Request */
|
/* Send Terminate-Request */
|
||||||
fsm_sdata(f, TERMREQ, f->reqid = ++f->id,
|
fsm_sdata(f, TERMREQ, f->reqid = ++f->id,
|
||||||
(u_char *) f->term_reason, f->term_reason_len);
|
(u_char *) f->term_reason, f->term_reason_len);
|
||||||
@ -487,31 +506,31 @@ static void fsm_timeout(void *arg)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case REQSENT:
|
case LS_REQSENT:
|
||||||
case ACKRCVD:
|
case LS_ACKRCVD:
|
||||||
case ACKSENT:
|
case LS_ACKSENT:
|
||||||
if (f->retransmits <= 0) {
|
if (f->retransmits <= 0) {
|
||||||
FSMDEBUG((LOG_WARNING, "%s: timeout sending Config-Requests state=%d\n",
|
FSMDEBUG((LOG_WARNING, "%s: timeout sending Config-Requests state=%d (%s)\n",
|
||||||
PROTO_NAME(f), f->state));
|
PROTO_NAME(f), f->state, ppperr_strerr[f->state]));
|
||||||
f->state = STOPPED;
|
f->state = LS_STOPPED;
|
||||||
if( (f->flags & OPT_PASSIVE) == 0 && f->callbacks->finished )
|
if( (f->flags & OPT_PASSIVE) == 0 && f->callbacks->finished )
|
||||||
(*f->callbacks->finished)(f);
|
(*f->callbacks->finished)(f);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
FSMDEBUG((LOG_WARNING, "%s: timeout resending Config-Request state=%d\n",
|
FSMDEBUG((LOG_WARNING, "%s: timeout resending Config-Request state=%d (%s)\n",
|
||||||
PROTO_NAME(f), f->state));
|
PROTO_NAME(f), f->state, ppperr_strerr[f->state]));
|
||||||
/* Retransmit the configure-request */
|
/* Retransmit the configure-request */
|
||||||
if (f->callbacks->retransmit)
|
if (f->callbacks->retransmit)
|
||||||
(*f->callbacks->retransmit)(f);
|
(*f->callbacks->retransmit)(f);
|
||||||
fsm_sconfreq(f, 1); /* Re-send Configure-Request */
|
fsm_sconfreq(f, 1); /* Re-send Configure-Request */
|
||||||
if( f->state == ACKRCVD )
|
if( f->state == LS_ACKRCVD )
|
||||||
f->state = REQSENT;
|
f->state = LS_REQSENT;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
FSMDEBUG((LOG_INFO, "%s: Timeout event in state %d!\n",
|
FSMDEBUG((LOG_INFO, "%s: Timeout event in state %d (%s)!\n",
|
||||||
PROTO_NAME(f), f->state));
|
PROTO_NAME(f), f->state, ppperr_strerr[f->state]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -523,28 +542,28 @@ static void fsm_rconfreq(fsm *f, u_char id, u_char *inp, int len)
|
|||||||
{
|
{
|
||||||
int code, reject_if_disagree;
|
int code, reject_if_disagree;
|
||||||
|
|
||||||
FSMDEBUG((LOG_INFO, "fsm_rconfreq(%s): Rcvd id %d state=%d\n",
|
FSMDEBUG((LOG_INFO, "fsm_rconfreq(%s): Rcvd id %d state=%d (%s)\n",
|
||||||
PROTO_NAME(f), id, f->state));
|
PROTO_NAME(f), id, f->state, ppperr_strerr[f->state]));
|
||||||
switch( f->state ){
|
switch( f->state ){
|
||||||
case CLOSED:
|
case LS_CLOSED:
|
||||||
/* Go away, we're closed */
|
/* Go away, we're closed */
|
||||||
fsm_sdata(f, TERMACK, id, NULL, 0);
|
fsm_sdata(f, TERMACK, id, NULL, 0);
|
||||||
return;
|
return;
|
||||||
case CLOSING:
|
case LS_CLOSING:
|
||||||
case STOPPING:
|
case LS_STOPPING:
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case OPENED:
|
case LS_OPENED:
|
||||||
/* Go down and restart negotiation */
|
/* Go down and restart negotiation */
|
||||||
if( f->callbacks->down )
|
if( f->callbacks->down )
|
||||||
(*f->callbacks->down)(f); /* Inform upper layers */
|
(*f->callbacks->down)(f); /* Inform upper layers */
|
||||||
fsm_sconfreq(f, 0); /* Send initial Configure-Request */
|
fsm_sconfreq(f, 0); /* Send initial Configure-Request */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STOPPED:
|
case LS_STOPPED:
|
||||||
/* Negotiation started by our peer */
|
/* Negotiation started by our peer */
|
||||||
fsm_sconfreq(f, 0); /* Send initial Configure-Request */
|
fsm_sconfreq(f, 0); /* Send initial Configure-Request */
|
||||||
f->state = REQSENT;
|
f->state = LS_REQSENT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -565,20 +584,20 @@ static void fsm_rconfreq(fsm *f, u_char id, u_char *inp, int len)
|
|||||||
fsm_sdata(f, (u_char)code, id, inp, len);
|
fsm_sdata(f, (u_char)code, id, inp, len);
|
||||||
|
|
||||||
if (code == CONFACK) {
|
if (code == CONFACK) {
|
||||||
if (f->state == ACKRCVD) {
|
if (f->state == LS_ACKRCVD) {
|
||||||
UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */
|
UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */
|
||||||
f->state = OPENED;
|
f->state = LS_OPENED;
|
||||||
if (f->callbacks->up)
|
if (f->callbacks->up)
|
||||||
(*f->callbacks->up)(f); /* Inform upper layers */
|
(*f->callbacks->up)(f); /* Inform upper layers */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
f->state = ACKSENT;
|
f->state = LS_ACKSENT;
|
||||||
f->nakloops = 0;
|
f->nakloops = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* we sent CONFACK or CONFREJ */
|
/* we sent CONFACK or CONFREJ */
|
||||||
if (f->state != ACKRCVD)
|
if (f->state != LS_ACKRCVD)
|
||||||
f->state = REQSENT;
|
f->state = LS_REQSENT;
|
||||||
if( code == CONFNAK )
|
if( code == CONFNAK )
|
||||||
++f->nakloops;
|
++f->nakloops;
|
||||||
}
|
}
|
||||||
@ -590,8 +609,8 @@ static void fsm_rconfreq(fsm *f, u_char id, u_char *inp, int len)
|
|||||||
*/
|
*/
|
||||||
static void fsm_rconfack(fsm *f, int id, u_char *inp, int len)
|
static void fsm_rconfack(fsm *f, int id, u_char *inp, int len)
|
||||||
{
|
{
|
||||||
FSMDEBUG((LOG_INFO, "fsm_rconfack(%s): Rcvd id %d state=%d\n",
|
FSMDEBUG((LOG_INFO, "fsm_rconfack(%s): Rcvd id %d state=%d (%s)\n",
|
||||||
PROTO_NAME(f), id, f->state));
|
PROTO_NAME(f), id, f->state, ppperr_strerr[f->state]));
|
||||||
|
|
||||||
if (id != f->reqid || f->seen_ack) /* Expected id? */
|
if (id != f->reqid || f->seen_ack) /* Expected id? */
|
||||||
return; /* Nope, toss... */
|
return; /* Nope, toss... */
|
||||||
@ -605,37 +624,37 @@ static void fsm_rconfack(fsm *f, int id, u_char *inp, int len)
|
|||||||
f->seen_ack = 1;
|
f->seen_ack = 1;
|
||||||
|
|
||||||
switch (f->state) {
|
switch (f->state) {
|
||||||
case CLOSED:
|
case LS_CLOSED:
|
||||||
case STOPPED:
|
case LS_STOPPED:
|
||||||
fsm_sdata(f, TERMACK, (u_char)id, NULL, 0);
|
fsm_sdata(f, TERMACK, (u_char)id, NULL, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case REQSENT:
|
case LS_REQSENT:
|
||||||
f->state = ACKRCVD;
|
f->state = LS_ACKRCVD;
|
||||||
f->retransmits = f->maxconfreqtransmits;
|
f->retransmits = f->maxconfreqtransmits;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACKRCVD:
|
case LS_ACKRCVD:
|
||||||
/* Huh? an extra valid Ack? oh well... */
|
/* Huh? an extra valid Ack? oh well... */
|
||||||
UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */
|
UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */
|
||||||
fsm_sconfreq(f, 0);
|
fsm_sconfreq(f, 0);
|
||||||
f->state = REQSENT;
|
f->state = LS_REQSENT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACKSENT:
|
case LS_ACKSENT:
|
||||||
UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */
|
UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */
|
||||||
f->state = OPENED;
|
f->state = LS_OPENED;
|
||||||
f->retransmits = f->maxconfreqtransmits;
|
f->retransmits = f->maxconfreqtransmits;
|
||||||
if (f->callbacks->up)
|
if (f->callbacks->up)
|
||||||
(*f->callbacks->up)(f); /* Inform upper layers */
|
(*f->callbacks->up)(f); /* Inform upper layers */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OPENED:
|
case LS_OPENED:
|
||||||
/* Go down and restart negotiation */
|
/* Go down and restart negotiation */
|
||||||
if (f->callbacks->down)
|
if (f->callbacks->down)
|
||||||
(*f->callbacks->down)(f); /* Inform upper layers */
|
(*f->callbacks->down)(f); /* Inform upper layers */
|
||||||
fsm_sconfreq(f, 0); /* Send initial Configure-Request */
|
fsm_sconfreq(f, 0); /* Send initial Configure-Request */
|
||||||
f->state = REQSENT;
|
f->state = LS_REQSENT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -649,8 +668,8 @@ static void fsm_rconfnakrej(fsm *f, int code, int id, u_char *inp, int len)
|
|||||||
int (*proc) (fsm *, u_char *, int);
|
int (*proc) (fsm *, u_char *, int);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
FSMDEBUG((LOG_INFO, "fsm_rconfnakrej(%s): Rcvd id %d state=%d\n",
|
FSMDEBUG((LOG_INFO, "fsm_rconfnakrej(%s): Rcvd id %d state=%d (%s)\n",
|
||||||
PROTO_NAME(f), id, f->state));
|
PROTO_NAME(f), id, f->state, ppperr_strerr[f->state]));
|
||||||
|
|
||||||
if (id != f->reqid || f->seen_ack) /* Expected id? */
|
if (id != f->reqid || f->seen_ack) /* Expected id? */
|
||||||
return; /* Nope, toss... */
|
return; /* Nope, toss... */
|
||||||
@ -664,34 +683,34 @@ static void fsm_rconfnakrej(fsm *f, int code, int id, u_char *inp, int len)
|
|||||||
f->seen_ack = 1;
|
f->seen_ack = 1;
|
||||||
|
|
||||||
switch (f->state) {
|
switch (f->state) {
|
||||||
case CLOSED:
|
case LS_CLOSED:
|
||||||
case STOPPED:
|
case LS_STOPPED:
|
||||||
fsm_sdata(f, TERMACK, (u_char)id, NULL, 0);
|
fsm_sdata(f, TERMACK, (u_char)id, NULL, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case REQSENT:
|
case LS_REQSENT:
|
||||||
case ACKSENT:
|
case LS_ACKSENT:
|
||||||
/* They didn't agree to what we wanted - try another request */
|
/* They didn't agree to what we wanted - try another request */
|
||||||
UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */
|
UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
f->state = STOPPED; /* kludge for stopping CCP */
|
f->state = LS_STOPPED; /* kludge for stopping CCP */
|
||||||
else
|
else
|
||||||
fsm_sconfreq(f, 0); /* Send Configure-Request */
|
fsm_sconfreq(f, 0); /* Send Configure-Request */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACKRCVD:
|
case LS_ACKRCVD:
|
||||||
/* Got a Nak/reject when we had already had an Ack?? oh well... */
|
/* Got a Nak/reject when we had already had an Ack?? oh well... */
|
||||||
UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */
|
UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */
|
||||||
fsm_sconfreq(f, 0);
|
fsm_sconfreq(f, 0);
|
||||||
f->state = REQSENT;
|
f->state = LS_REQSENT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OPENED:
|
case LS_OPENED:
|
||||||
/* Go down and restart negotiation */
|
/* Go down and restart negotiation */
|
||||||
if (f->callbacks->down)
|
if (f->callbacks->down)
|
||||||
(*f->callbacks->down)(f); /* Inform upper layers */
|
(*f->callbacks->down)(f); /* Inform upper layers */
|
||||||
fsm_sconfreq(f, 0); /* Send initial Configure-Request */
|
fsm_sconfreq(f, 0); /* Send initial Configure-Request */
|
||||||
f->state = REQSENT;
|
f->state = LS_REQSENT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -702,16 +721,16 @@ static void fsm_rconfnakrej(fsm *f, int code, int id, u_char *inp, int len)
|
|||||||
*/
|
*/
|
||||||
static void fsm_rtermreq(fsm *f, int id, u_char *p, int len)
|
static void fsm_rtermreq(fsm *f, int id, u_char *p, int len)
|
||||||
{
|
{
|
||||||
FSMDEBUG((LOG_INFO, "fsm_rtermreq(%s): Rcvd id %d state=%d\n",
|
FSMDEBUG((LOG_INFO, "fsm_rtermreq(%s): Rcvd id %d state=%d (%s)\n",
|
||||||
PROTO_NAME(f), id, f->state));
|
PROTO_NAME(f), id, f->state, ppperr_strerr[f->state]));
|
||||||
|
|
||||||
switch (f->state) {
|
switch (f->state) {
|
||||||
case ACKRCVD:
|
case LS_ACKRCVD:
|
||||||
case ACKSENT:
|
case LS_ACKSENT:
|
||||||
f->state = REQSENT; /* Start over but keep trying */
|
f->state = LS_REQSENT; /* Start over but keep trying */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OPENED:
|
case LS_OPENED:
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
FSMDEBUG((LOG_INFO, "%s terminated by peer (%x)\n", PROTO_NAME(f), p));
|
FSMDEBUG((LOG_INFO, "%s terminated by peer (%x)\n", PROTO_NAME(f), p));
|
||||||
} else {
|
} else {
|
||||||
@ -720,7 +739,7 @@ static void fsm_rtermreq(fsm *f, int id, u_char *p, int len)
|
|||||||
if (f->callbacks->down)
|
if (f->callbacks->down)
|
||||||
(*f->callbacks->down)(f); /* Inform upper layers */
|
(*f->callbacks->down)(f); /* Inform upper layers */
|
||||||
f->retransmits = 0;
|
f->retransmits = 0;
|
||||||
f->state = STOPPING;
|
f->state = LS_STOPPING;
|
||||||
TIMEOUT(fsm_timeout, f, f->timeouttime);
|
TIMEOUT(fsm_timeout, f, f->timeouttime);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -734,28 +753,28 @@ static void fsm_rtermreq(fsm *f, int id, u_char *p, int len)
|
|||||||
*/
|
*/
|
||||||
static void fsm_rtermack(fsm *f)
|
static void fsm_rtermack(fsm *f)
|
||||||
{
|
{
|
||||||
FSMDEBUG((LOG_INFO, "fsm_rtermack(%s): state=%d\n",
|
FSMDEBUG((LOG_INFO, "fsm_rtermack(%s): state=%d (%s)\n",
|
||||||
PROTO_NAME(f), f->state));
|
PROTO_NAME(f), f->state, ppperr_strerr[f->state]));
|
||||||
|
|
||||||
switch (f->state) {
|
switch (f->state) {
|
||||||
case CLOSING:
|
case LS_CLOSING:
|
||||||
UNTIMEOUT(fsm_timeout, f);
|
UNTIMEOUT(fsm_timeout, f);
|
||||||
f->state = CLOSED;
|
f->state = LS_CLOSED;
|
||||||
if( f->callbacks->finished )
|
if( f->callbacks->finished )
|
||||||
(*f->callbacks->finished)(f);
|
(*f->callbacks->finished)(f);
|
||||||
break;
|
break;
|
||||||
case STOPPING:
|
case LS_STOPPING:
|
||||||
UNTIMEOUT(fsm_timeout, f);
|
UNTIMEOUT(fsm_timeout, f);
|
||||||
f->state = STOPPED;
|
f->state = LS_STOPPED;
|
||||||
if( f->callbacks->finished )
|
if( f->callbacks->finished )
|
||||||
(*f->callbacks->finished)(f);
|
(*f->callbacks->finished)(f);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACKRCVD:
|
case LS_ACKRCVD:
|
||||||
f->state = REQSENT;
|
f->state = LS_REQSENT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OPENED:
|
case LS_OPENED:
|
||||||
if (f->callbacks->down)
|
if (f->callbacks->down)
|
||||||
(*f->callbacks->down)(f); /* Inform upper layers */
|
(*f->callbacks->down)(f); /* Inform upper layers */
|
||||||
fsm_sconfreq(f, 0);
|
fsm_sconfreq(f, 0);
|
||||||
@ -771,8 +790,8 @@ static void fsm_rcoderej(fsm *f, u_char *inp, int len)
|
|||||||
{
|
{
|
||||||
u_char code, id;
|
u_char code, id;
|
||||||
|
|
||||||
FSMDEBUG((LOG_INFO, "fsm_rcoderej(%s): state=%d\n",
|
FSMDEBUG((LOG_INFO, "fsm_rcoderej(%s): state=%d (%s)\n",
|
||||||
PROTO_NAME(f), f->state));
|
PROTO_NAME(f), f->state, ppperr_strerr[f->state]));
|
||||||
|
|
||||||
if (len < HEADERLEN) {
|
if (len < HEADERLEN) {
|
||||||
FSMDEBUG((LOG_INFO, "fsm_rcoderej: Rcvd short Code-Reject packet!\n"));
|
FSMDEBUG((LOG_INFO, "fsm_rcoderej: Rcvd short Code-Reject packet!\n"));
|
||||||
@ -783,8 +802,8 @@ static void fsm_rcoderej(fsm *f, u_char *inp, int len)
|
|||||||
FSMDEBUG((LOG_WARNING, "%s: Rcvd Code-Reject for code %d, id %d\n",
|
FSMDEBUG((LOG_WARNING, "%s: Rcvd Code-Reject for code %d, id %d\n",
|
||||||
PROTO_NAME(f), code, id));
|
PROTO_NAME(f), code, id));
|
||||||
|
|
||||||
if( f->state == ACKRCVD )
|
if( f->state == LS_ACKRCVD )
|
||||||
f->state = REQSENT;
|
f->state = LS_REQSENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -796,7 +815,7 @@ static void fsm_sconfreq(fsm *f, int retransmit)
|
|||||||
u_char *outp;
|
u_char *outp;
|
||||||
int cilen;
|
int cilen;
|
||||||
|
|
||||||
if( f->state != REQSENT && f->state != ACKRCVD && f->state != ACKSENT ){
|
if( f->state != LS_REQSENT && f->state != LS_ACKRCVD && f->state != LS_ACKSENT ){
|
||||||
/* Not currently negotiating - reset options */
|
/* Not currently negotiating - reset options */
|
||||||
if( f->callbacks->resetci )
|
if( f->callbacks->resetci )
|
||||||
(*f->callbacks->resetci)(f);
|
(*f->callbacks->resetci)(f);
|
||||||
|
@ -48,13 +48,12 @@
|
|||||||
* 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.1 2003/05/27 14:37:56 jani Exp $
|
* $Id: fsm.h,v 1.2 2007/11/29 22:19:57 fbernon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef FSM_H
|
#ifndef FSM_H
|
||||||
#define FSM_H
|
#define FSM_H
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
************************* PUBLIC DEFINITIONS *********************************
|
************************* PUBLIC DEFINITIONS *********************************
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
@ -78,16 +77,16 @@
|
|||||||
/*
|
/*
|
||||||
* Link states.
|
* Link states.
|
||||||
*/
|
*/
|
||||||
#define INITIAL 0 /* Down, hasn't been opened */
|
#define LS_INITIAL 0 /* Down, hasn't been opened */
|
||||||
#define STARTING 1 /* Down, been opened */
|
#define LS_STARTING 1 /* Down, been opened */
|
||||||
#define CLOSED 2 /* Up, hasn't been opened */
|
#define LS_CLOSED 2 /* Up, hasn't been opened */
|
||||||
#define STOPPED 3 /* Open, waiting for down event */
|
#define LS_STOPPED 3 /* Open, waiting for down event */
|
||||||
#define CLOSING 4 /* Terminating the connection, not open */
|
#define LS_CLOSING 4 /* Terminating the connection, not open */
|
||||||
#define STOPPING 5 /* Terminating, but open */
|
#define LS_STOPPING 5 /* Terminating, but open */
|
||||||
#define REQSENT 6 /* We've sent a Config Request */
|
#define LS_REQSENT 6 /* We've sent a Config Request */
|
||||||
#define ACKRCVD 7 /* We've received a Config Ack */
|
#define LS_ACKRCVD 7 /* We've received a Config Ack */
|
||||||
#define ACKSENT 8 /* We've sent a Config Ack */
|
#define LS_ACKSENT 8 /* We've sent a Config Ack */
|
||||||
#define OPENED 9 /* Connection available */
|
#define LS_OPENED 9 /* Connection available */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -139,9 +138,9 @@ typedef struct fsm_callbacks {
|
|||||||
(fsm*, u_char*, int);
|
(fsm*, u_char*, int);
|
||||||
int (*reqci) /* Request peer's Configuration Information */
|
int (*reqci) /* Request peer's Configuration Information */
|
||||||
(fsm*, u_char*, int*, int);
|
(fsm*, u_char*, int*, int);
|
||||||
void (*up) /* Called when fsm reaches OPENED state */
|
void (*up) /* Called when fsm reaches LS_OPENED state */
|
||||||
(fsm*);
|
(fsm*);
|
||||||
void (*down) /* Called when fsm leaves OPENED state */
|
void (*down) /* Called when fsm leaves LS_OPENED state */
|
||||||
(fsm*);
|
(fsm*);
|
||||||
void (*starting) /* Called when we want the lower layer */
|
void (*starting) /* Called when we want the lower layer */
|
||||||
(fsm*);
|
(fsm*);
|
||||||
@ -182,6 +181,4 @@ void fsm_input (fsm*, u_char*, int);
|
|||||||
void fsm_protreject (fsm*);
|
void fsm_protreject (fsm*);
|
||||||
void fsm_sdata (fsm*, u_char, u_char, u_char*, int);
|
void fsm_sdata (fsm*, u_char, u_char, u_char*, int);
|
||||||
|
|
||||||
|
|
||||||
#endif /* FSM_H */
|
#endif /* FSM_H */
|
||||||
|
|
||||||
|
@ -49,16 +49,19 @@
|
|||||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include "lwip/opt.h"
|
||||||
|
|
||||||
|
#if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */
|
||||||
|
|
||||||
#include "ppp.h"
|
#include "ppp.h"
|
||||||
#if PPP_SUPPORT > 0
|
#include "pppdebug.h"
|
||||||
|
|
||||||
#include "auth.h"
|
#include "auth.h"
|
||||||
#include "fsm.h"
|
#include "fsm.h"
|
||||||
#include "vj.h"
|
#include "vj.h"
|
||||||
#include "ipcp.h"
|
#include "ipcp.h"
|
||||||
#include "pppdebug.h"
|
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
/*************************/
|
/*************************/
|
||||||
/*** LOCAL DEFINITIONS ***/
|
/*** LOCAL DEFINITIONS ***/
|
||||||
@ -164,8 +167,8 @@ static fsm_callbacks ipcp_callbacks = { /* IPCP callback routines */
|
|||||||
ipcp_nakci, /* NAK our Configuration Information */
|
ipcp_nakci, /* NAK our Configuration Information */
|
||||||
ipcp_rejci, /* Reject our Configuration Information */
|
ipcp_rejci, /* Reject our Configuration Information */
|
||||||
ipcp_reqci, /* Request peer's Configuration Information */
|
ipcp_reqci, /* Request peer's Configuration Information */
|
||||||
ipcp_up, /* Called when fsm reaches OPENED state */
|
ipcp_up, /* Called when fsm reaches LS_OPENED state */
|
||||||
ipcp_down, /* Called when fsm leaves OPENED state */
|
ipcp_down, /* Called when fsm leaves LS_OPENED state */
|
||||||
NULL, /* Called when we want the lower layer up */
|
NULL, /* Called when we want the lower layer up */
|
||||||
ipcp_finished, /* Called when we want the lower layer down */
|
ipcp_finished, /* Called when we want the lower layer down */
|
||||||
NULL, /* Called when Protocol-Reject received */
|
NULL, /* Called when Protocol-Reject received */
|
||||||
@ -213,11 +216,11 @@ static void ipcp_init(int unit)
|
|||||||
|
|
||||||
wo->neg_addr = 1;
|
wo->neg_addr = 1;
|
||||||
wo->ouraddr = 0;
|
wo->ouraddr = 0;
|
||||||
#if VJ_SUPPORT > 0
|
#if VJ_SUPPORT
|
||||||
wo->neg_vj = 1;
|
wo->neg_vj = 1;
|
||||||
#else
|
#else /* VJ_SUPPORT */
|
||||||
wo->neg_vj = 0;
|
wo->neg_vj = 0;
|
||||||
#endif
|
#endif /* VJ_SUPPORT */
|
||||||
wo->vj_protocol = IPCP_VJ_COMP;
|
wo->vj_protocol = IPCP_VJ_COMP;
|
||||||
wo->maxslotindex = MAX_SLOTS - 1;
|
wo->maxslotindex = MAX_SLOTS - 1;
|
||||||
wo->cflag = 0;
|
wo->cflag = 0;
|
||||||
@ -225,11 +228,11 @@ static void ipcp_init(int unit)
|
|||||||
wo->default_route = 1;
|
wo->default_route = 1;
|
||||||
|
|
||||||
ao->neg_addr = 1;
|
ao->neg_addr = 1;
|
||||||
#if VJ_SUPPORT > 0
|
#if VJ_SUPPORT
|
||||||
ao->neg_vj = 1;
|
ao->neg_vj = 1;
|
||||||
#else
|
#else /* VJ_SUPPORT */
|
||||||
ao->neg_vj = 0;
|
ao->neg_vj = 0;
|
||||||
#endif
|
#endif /* VJ_SUPPORT */
|
||||||
ao->maxslotindex = MAX_SLOTS - 1;
|
ao->maxslotindex = MAX_SLOTS - 1;
|
||||||
ao->cflag = 1;
|
ao->cflag = 1;
|
||||||
|
|
||||||
@ -533,7 +536,7 @@ bad:
|
|||||||
/*
|
/*
|
||||||
* ipcp_nakci - Peer has sent a NAK for some of our CIs.
|
* ipcp_nakci - Peer has sent a NAK for some of our CIs.
|
||||||
* This should not modify any state if the Nak is bad
|
* This should not modify any state if the Nak is bad
|
||||||
* or if IPCP is in the OPENED state.
|
* or if IPCP is in the LS_OPENED state.
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* 0 - Nak was bad.
|
* 0 - Nak was bad.
|
||||||
@ -716,7 +719,7 @@ static int ipcp_nakci(fsm *f, u_char *p, int len)
|
|||||||
/*
|
/*
|
||||||
* OK, the Nak is good. Now we can update state.
|
* OK, the Nak is good. Now we can update state.
|
||||||
*/
|
*/
|
||||||
if (f->state != OPENED)
|
if (f->state != LS_OPENED)
|
||||||
*go = try;
|
*go = try;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -823,7 +826,7 @@ static int ipcp_rejci(fsm *f, u_char *p, int len)
|
|||||||
/*
|
/*
|
||||||
* Now we can update state.
|
* Now we can update state.
|
||||||
*/
|
*/
|
||||||
if (f->state != OPENED)
|
if (f->state != LS_OPENED)
|
||||||
*go = try;
|
*go = try;
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
@ -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.1 2003/05/27 14:37:56 jani Exp $
|
* $Id: ipcp.h,v 1.2 2007/11/29 22:19:57 fbernon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef IPCP_H
|
#ifndef IPCP_H
|
||||||
@ -121,6 +121,4 @@ extern struct protent ipcp_protent;
|
|||||||
*** PUBLIC FUNCTIONS ***
|
*** PUBLIC FUNCTIONS ***
|
||||||
***********************/
|
***********************/
|
||||||
|
|
||||||
|
|
||||||
#endif /* IPCP_H */
|
#endif /* IPCP_H */
|
||||||
|
|
||||||
|
@ -50,16 +50,21 @@
|
|||||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
#include "lwip/opt.h"
|
||||||
|
|
||||||
|
#if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */
|
||||||
|
|
||||||
#include "ppp.h"
|
#include "ppp.h"
|
||||||
#if PPP_SUPPORT > 0
|
#include "pppdebug.h"
|
||||||
|
|
||||||
#include "fsm.h"
|
#include "fsm.h"
|
||||||
#include "chap.h"
|
#include "chap.h"
|
||||||
#include "magic.h"
|
#include "magic.h"
|
||||||
#include "auth.h"
|
#include "auth.h"
|
||||||
#include "lcp.h"
|
#include "lcp.h"
|
||||||
#include "pppdebug.h"
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#if PPPOE_SUPPORT
|
#if PPPOE_SUPPORT
|
||||||
#include "ppp_oe.h"
|
#include "ppp_oe.h"
|
||||||
@ -159,8 +164,8 @@ static fsm_callbacks lcp_callbacks = { /* LCP callback routines */
|
|||||||
lcp_nakci, /* NAK our Configuration Information */
|
lcp_nakci, /* NAK our Configuration Information */
|
||||||
lcp_rejci, /* Reject our Configuration Information */
|
lcp_rejci, /* Reject our Configuration Information */
|
||||||
lcp_reqci, /* Request peer's Configuration Information */
|
lcp_reqci, /* Request peer's Configuration Information */
|
||||||
lcp_up, /* Called when fsm reaches OPENED state */
|
lcp_up, /* Called when fsm reaches LS_OPENED state */
|
||||||
lcp_down, /* Called when fsm leaves OPENED state */
|
lcp_down, /* Called when fsm leaves LS_OPENED state */
|
||||||
lcp_starting, /* Called when we want the lower layer up */
|
lcp_starting, /* Called when we want the lower layer up */
|
||||||
lcp_finished, /* Called when we want the lower layer down */
|
lcp_finished, /* Called when we want the lower layer down */
|
||||||
NULL, /* Called when Protocol-Reject received */
|
NULL, /* Called when Protocol-Reject received */
|
||||||
@ -291,14 +296,14 @@ void lcp_close(int unit, char *reason)
|
|||||||
|
|
||||||
if (lcp_phase[unit] != PHASE_DEAD)
|
if (lcp_phase[unit] != PHASE_DEAD)
|
||||||
lcp_phase[unit] = PHASE_TERMINATE;
|
lcp_phase[unit] = PHASE_TERMINATE;
|
||||||
if (f->state == STOPPED && f->flags & (OPT_PASSIVE|OPT_SILENT)) {
|
if (f->state == LS_STOPPED && f->flags & (OPT_PASSIVE|OPT_SILENT)) {
|
||||||
/*
|
/*
|
||||||
* This action is not strictly according to the FSM in RFC1548,
|
* This action is not strictly according to the FSM in RFC1548,
|
||||||
* but it does mean that the program terminates if you do an
|
* but it does mean that the program terminates if you do an
|
||||||
* lcp_close() in passive/silent mode when a connection hasn't
|
* lcp_close() in passive/silent mode when a connection hasn't
|
||||||
* been established.
|
* been established.
|
||||||
*/
|
*/
|
||||||
f->state = CLOSED;
|
f->state = LS_CLOSED;
|
||||||
lcp_finished(f);
|
lcp_finished(f);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -353,7 +358,7 @@ void lcp_sprotrej(int unit, u_char *p, int len)
|
|||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Send back the protocol and the information field of the
|
* Send back the protocol and the information field of the
|
||||||
* rejected packet. We only get here if LCP is in the OPENED state.
|
* rejected packet. We only get here if LCP is in the LS_OPENED state.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fsm_sdata(&lcp_fsm[unit], PROTREJ, ++lcp_fsm[unit].id,
|
fsm_sdata(&lcp_fsm[unit], PROTREJ, ++lcp_fsm[unit].id,
|
||||||
@ -389,7 +394,7 @@ static int lcp_extcode(fsm *f, int code, u_char id, u_char *inp, int len)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ECHOREQ:
|
case ECHOREQ:
|
||||||
if (f->state != OPENED)
|
if (f->state != LS_OPENED)
|
||||||
break;
|
break;
|
||||||
LCPDEBUG((LOG_INFO, "lcp: Echo-Request, Rcvd id %d\n", id));
|
LCPDEBUG((LOG_INFO, "lcp: Echo-Request, Rcvd id %d\n", id));
|
||||||
magp = inp;
|
magp = inp;
|
||||||
@ -436,9 +441,9 @@ static void lcp_rprotrej(fsm *f, u_char *inp, int len)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Protocol-Reject packets received in any state other than the LCP
|
* Protocol-Reject packets received in any state other than the LCP
|
||||||
* OPENED state SHOULD be silently discarded.
|
* LS_OPENED state SHOULD be silently discarded.
|
||||||
*/
|
*/
|
||||||
if( f->state != OPENED ){
|
if( f->state != LS_OPENED ){
|
||||||
LCPDEBUG((LOG_INFO, "Protocol-Reject discarded: LCP in state %d\n",
|
LCPDEBUG((LOG_INFO, "Protocol-Reject discarded: LCP in state %d\n",
|
||||||
f->state));
|
f->state));
|
||||||
return;
|
return;
|
||||||
@ -714,7 +719,7 @@ bad:
|
|||||||
/*
|
/*
|
||||||
* lcp_nakci - Peer has sent a NAK for some of our CIs.
|
* lcp_nakci - Peer has sent a NAK for some of our CIs.
|
||||||
* This should not modify any state if the Nak is bad
|
* This should not modify any state if the Nak is bad
|
||||||
* or if LCP is in the OPENED state.
|
* or if LCP is in the LS_OPENED state.
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* 0 - Nak was bad.
|
* 0 - Nak was bad.
|
||||||
@ -995,7 +1000,7 @@ static int lcp_nakci(fsm *f, u_char *p, int len)
|
|||||||
/*
|
/*
|
||||||
* OK, the Nak is good. Now we can update state.
|
* OK, the Nak is good. Now we can update state.
|
||||||
*/
|
*/
|
||||||
if (f->state != OPENED) {
|
if (f->state != LS_OPENED) {
|
||||||
if (looped_back) {
|
if (looped_back) {
|
||||||
if (++try.numloops >= lcp_loopbackfail) {
|
if (++try.numloops >= lcp_loopbackfail) {
|
||||||
LCPDEBUG((LOG_NOTICE, "Serial line is looped back.\n"));
|
LCPDEBUG((LOG_NOTICE, "Serial line is looped back.\n"));
|
||||||
@ -1018,7 +1023,7 @@ bad:
|
|||||||
/*
|
/*
|
||||||
* lcp_rejci - Peer has Rejected some of our CIs.
|
* lcp_rejci - Peer has Rejected some of our CIs.
|
||||||
* This should not modify any state if the Reject is bad
|
* This should not modify any state if the Reject is bad
|
||||||
* or if LCP is in the OPENED state.
|
* or if LCP is in the LS_OPENED state.
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* 0 - Reject was bad.
|
* 0 - Reject was bad.
|
||||||
@ -1143,7 +1148,7 @@ static int lcp_rejci(fsm *f, u_char *p, int len)
|
|||||||
/*
|
/*
|
||||||
* Now we can update state.
|
* Now we can update state.
|
||||||
*/
|
*/
|
||||||
if (f->state != OPENED)
|
if (f->state != LS_OPENED)
|
||||||
*go = try;
|
*go = try;
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
@ -1871,7 +1876,7 @@ static int lcp_printpkt(
|
|||||||
|
|
||||||
static void LcpLinkFailure (fsm *f)
|
static void LcpLinkFailure (fsm *f)
|
||||||
{
|
{
|
||||||
if (f->state == OPENED) {
|
if (f->state == LS_OPENED) {
|
||||||
LCPDEBUG((LOG_INFO, "No response to %d echo-requests\n", lcp_echos_pending));
|
LCPDEBUG((LOG_INFO, "No response to %d echo-requests\n", lcp_echos_pending));
|
||||||
LCPDEBUG((LOG_NOTICE, "Serial link appears to be disconnected.\n"));
|
LCPDEBUG((LOG_NOTICE, "Serial link appears to be disconnected.\n"));
|
||||||
lcp_close(f->unit, "Peer not responding");
|
lcp_close(f->unit, "Peer not responding");
|
||||||
@ -1954,7 +1959,7 @@ static void LcpSendEchoRequest (fsm *f)
|
|||||||
/*
|
/*
|
||||||
* Make and send the echo request frame.
|
* Make and send the echo request frame.
|
||||||
*/
|
*/
|
||||||
if (f->state == OPENED) {
|
if (f->state == LS_OPENED) {
|
||||||
lcp_magic = lcp_gotoptions[f->unit].magicnumber;
|
lcp_magic = lcp_gotoptions[f->unit].magicnumber;
|
||||||
pktp = pkt;
|
pktp = pkt;
|
||||||
PUTLONG(lcp_magic, pktp);
|
PUTLONG(lcp_magic, pktp);
|
||||||
|
@ -48,13 +48,12 @@
|
|||||||
* 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.1 2003/05/27 14:37:56 jani Exp $
|
* $Id: lcp.h,v 1.2 2007/11/29 22:19:57 fbernon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef LCP_H
|
#ifndef LCP_H
|
||||||
#define LCP_H
|
#define LCP_H
|
||||||
|
|
||||||
|
|
||||||
/*************************
|
/*************************
|
||||||
*** PUBLIC DEFINITIONS ***
|
*** PUBLIC DEFINITIONS ***
|
||||||
*************************/
|
*************************/
|
||||||
@ -166,4 +165,3 @@ extern struct protent lcp_protent;
|
|||||||
#define DEFLOOPBACKFAIL 10
|
#define DEFLOOPBACKFAIL 10
|
||||||
|
|
||||||
#endif /* LCP_H */
|
#endif /* LCP_H */
|
||||||
|
|
||||||
|
@ -31,11 +31,16 @@
|
|||||||
***********************************************************************
|
***********************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "lwip/opt.h"
|
||||||
|
|
||||||
|
#if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */
|
||||||
|
|
||||||
|
#if CHAP_SUPPORT || MD5_SUPPORT
|
||||||
|
|
||||||
#include "ppp.h"
|
#include "ppp.h"
|
||||||
#include "md5.h"
|
|
||||||
#include "pppdebug.h"
|
#include "pppdebug.h"
|
||||||
|
|
||||||
#if CHAP_SUPPORT > 0 || MD5_SUPPORT > 0
|
#include "md5.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
***********************************************************************
|
***********************************************************************
|
||||||
@ -302,5 +307,6 @@ static void Transform (u32_t *buf, u32_t *in)
|
|||||||
buf[3] += d;
|
buf[3] += d;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif /* CHAP_SUPPORT || MD5_SUPPORT */
|
||||||
|
|
||||||
|
#endif /* PPP_SUPPORT */
|
||||||
|
@ -49,13 +49,17 @@
|
|||||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "lwip/opt.h"
|
||||||
|
|
||||||
|
#if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */
|
||||||
|
|
||||||
|
#if PAP_SUPPORT /* don't build if not configured for use in lwipopts.h */
|
||||||
|
|
||||||
#include "ppp.h"
|
#include "ppp.h"
|
||||||
#include "auth.h"
|
|
||||||
#include "pap.h"
|
|
||||||
#include "pppdebug.h"
|
#include "pppdebug.h"
|
||||||
|
|
||||||
|
#include "auth.h"
|
||||||
#if PAP_SUPPORT > 0
|
#include "pap.h"
|
||||||
|
|
||||||
/***********************************/
|
/***********************************/
|
||||||
/*** LOCAL FUNCTION DECLARATIONS ***/
|
/*** LOCAL FUNCTION DECLARATIONS ***/
|
||||||
@ -602,7 +606,8 @@ static int upap_printpkt(
|
|||||||
LWIP_UNUSED_ARG(arg);
|
LWIP_UNUSED_ARG(arg);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* 0 */
|
||||||
|
|
||||||
#endif /* PAP_SUPPORT */
|
#endif /* PAP_SUPPORT */
|
||||||
|
|
||||||
|
#endif /* PPP_SUPPORT */
|
||||||
|
@ -49,11 +49,10 @@
|
|||||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef PAP_H
|
#ifndef PAP_H
|
||||||
#define PAP_H
|
#define PAP_H
|
||||||
|
|
||||||
#if PAP_SUPPORT > 0
|
#if PAP_SUPPORT /* don't build if not configured for use in lwipopts.h */
|
||||||
|
|
||||||
/*************************
|
/*************************
|
||||||
*** PUBLIC DEFINITIONS ***
|
*** PUBLIC DEFINITIONS ***
|
||||||
|
@ -79,30 +79,33 @@
|
|||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include "lwip/opt.h"
|
||||||
|
|
||||||
|
#if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */
|
||||||
|
|
||||||
#include "ppp.h"
|
#include "ppp.h"
|
||||||
#if PPP_SUPPORT > 0
|
#include "pppdebug.h"
|
||||||
|
|
||||||
#include "randm.h"
|
#include "randm.h"
|
||||||
#include "fsm.h"
|
#include "fsm.h"
|
||||||
#if PAP_SUPPORT > 0
|
#if PAP_SUPPORT
|
||||||
#include "pap.h"
|
#include "pap.h"
|
||||||
#endif
|
#endif /* PAP_SUPPORT */
|
||||||
#if CHAP_SUPPORT > 0
|
#if CHAP_SUPPORT
|
||||||
#include "chap.h"
|
#include "chap.h"
|
||||||
#endif
|
#endif /* CHAP_SUPPORT */
|
||||||
#include "ipcp.h"
|
#include "ipcp.h"
|
||||||
#include "lcp.h"
|
#include "lcp.h"
|
||||||
#include "magic.h"
|
#include "magic.h"
|
||||||
#include "auth.h"
|
#include "auth.h"
|
||||||
#if VJ_SUPPORT > 0
|
#if VJ_SUPPORT
|
||||||
#include "vj.h"
|
#include "vj.h"
|
||||||
#endif
|
#endif /* VJ_SUPPORT */
|
||||||
#if PPPOE_SUPPORT > 0
|
#if PPPOE_SUPPORT
|
||||||
#include "ppp_oe.h"
|
#include "ppp_oe.h"
|
||||||
#endif
|
#endif /* PPPOE_SUPPORT */
|
||||||
|
|
||||||
#include "pppdebug.h"
|
#include <string.h>
|
||||||
|
|
||||||
/*************************/
|
/*************************/
|
||||||
/*** LOCAL DEFINITIONS ***/
|
/*** LOCAL DEFINITIONS ***/
|
||||||
@ -140,7 +143,7 @@ typedef struct PPPControl_s {
|
|||||||
#if PPPOE_SUPPORT
|
#if PPPOE_SUPPORT
|
||||||
struct netif *ethif;
|
struct netif *ethif;
|
||||||
struct pppoe_softc *pppoe_sc;
|
struct pppoe_softc *pppoe_sc;
|
||||||
#endif
|
#endif /* PPPOE_SUPPORT */
|
||||||
int if_up; /* True when the interface is up. */
|
int if_up; /* True when the interface is up. */
|
||||||
int errCode; /* Code indicating why interface is down. */
|
int errCode; /* Code indicating why interface is down. */
|
||||||
#if PPPOS_SUPPORT
|
#if PPPOS_SUPPORT
|
||||||
@ -152,17 +155,17 @@ typedef struct PPPControl_s {
|
|||||||
char inEscaped; /* Escape next character. */
|
char inEscaped; /* Escape next character. */
|
||||||
u16_t inProtocol; /* The input protocol code. */
|
u16_t inProtocol; /* The input protocol code. */
|
||||||
u16_t inFCS; /* Input Frame Check Sequence value. */
|
u16_t inFCS; /* Input Frame Check Sequence value. */
|
||||||
#endif
|
#endif /* PPPOS_SUPPORT */
|
||||||
int mtu; /* Peer's mru */
|
int mtu; /* Peer's mru */
|
||||||
int pcomp; /* Does peer accept protocol compression? */
|
int pcomp; /* Does peer accept protocol compression? */
|
||||||
int accomp; /* Does peer accept addr/ctl compression? */
|
int accomp; /* Does peer accept addr/ctl compression? */
|
||||||
u_long lastXMit; /* Time of last transmission. */
|
u_long lastXMit; /* Time of last transmission. */
|
||||||
ext_accm inACCM; /* Async-Ctl-Char-Map for input. */
|
ext_accm inACCM; /* Async-Ctl-Char-Map for input. */
|
||||||
ext_accm outACCM; /* Async-Ctl-Char-Map for output. */
|
ext_accm outACCM; /* Async-Ctl-Char-Map for output. */
|
||||||
#if PPPOS_SUPPORT && VJ_SUPPORT > 0
|
#if PPPOS_SUPPORT && VJ_SUPPORT
|
||||||
int vjEnabled; /* Flag indicating VJ compression enabled. */
|
int vjEnabled; /* Flag indicating VJ compression enabled. */
|
||||||
struct vjcompress vjComp; /* Van Jabobsen compression header. */
|
struct vjcompress vjComp; /* Van Jabobsen compression header. */
|
||||||
#endif
|
#endif /* PPPOS_SUPPORT && VJ_SUPPORT */
|
||||||
|
|
||||||
struct netif netif;
|
struct netif netif;
|
||||||
|
|
||||||
@ -192,7 +195,7 @@ struct npioctl {
|
|||||||
static void pppMain(void *pd);
|
static void pppMain(void *pd);
|
||||||
static void pppDrop(PPPControl *pc);
|
static void pppDrop(PPPControl *pc);
|
||||||
static void pppInProc(int pd, u_char *s, int l);
|
static void pppInProc(int pd, u_char *s, int l);
|
||||||
#endif
|
#endif /* PPPOS_SUPPORT */
|
||||||
|
|
||||||
|
|
||||||
/******************************/
|
/******************************/
|
||||||
@ -209,19 +212,19 @@ static PPPControl pppControl[NUM_PPP]; /* The PPP interface control blocks. */
|
|||||||
*/
|
*/
|
||||||
struct protent *ppp_protocols[] = {
|
struct protent *ppp_protocols[] = {
|
||||||
&lcp_protent,
|
&lcp_protent,
|
||||||
#if PAP_SUPPORT > 0
|
#if PAP_SUPPORT
|
||||||
&pap_protent,
|
&pap_protent,
|
||||||
#endif
|
#endif /* PAP_SUPPORT */
|
||||||
#if CHAP_SUPPORT > 0
|
#if CHAP_SUPPORT
|
||||||
&chap_protent,
|
&chap_protent,
|
||||||
#endif
|
#endif /* CHAP_SUPPORT */
|
||||||
#if CBCP_SUPPORT > 0
|
#if CBCP_SUPPORT
|
||||||
&cbcp_protent,
|
&cbcp_protent,
|
||||||
#endif
|
#endif /* CBCP_SUPPORT */
|
||||||
&ipcp_protent,
|
&ipcp_protent,
|
||||||
#if CCP_SUPPORT > 0
|
#if CCP_SUPPORT
|
||||||
&ccp_protent,
|
&ccp_protent,
|
||||||
#endif
|
#endif /* CCP_SUPPORT */
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -410,9 +413,9 @@ pppInit(void)
|
|||||||
memset(&lwip_stats.link, 0, sizeof(lwip_stats.link));
|
memset(&lwip_stats.link, 0, sizeof(lwip_stats.link));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if PPPOE_SUPPORT > 0
|
#if PPPOE_SUPPORT
|
||||||
pppoe_init();
|
pppoe_init();
|
||||||
#endif
|
#endif /* PPPOE_SUPPORT */
|
||||||
|
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
@ -504,7 +507,9 @@ int pppOverSerialOpen(sio_fd_t fd, void (*linkStatusCB)(void *ctx, int errCode,
|
|||||||
lcp_init(pd);
|
lcp_init(pd);
|
||||||
pc = &pppControl[pd];
|
pc = &pppControl[pd];
|
||||||
pc->fd = fd;
|
pc->fd = fd;
|
||||||
|
#if PPPOE_SUPPORT
|
||||||
pc->ethif= NULL;
|
pc->ethif= NULL;
|
||||||
|
#endif /* PPPOE_SUPPORT */
|
||||||
pc->kill_link = 0;
|
pc->kill_link = 0;
|
||||||
pc->sig_hup = 0;
|
pc->sig_hup = 0;
|
||||||
pc->if_up = 0;
|
pc->if_up = 0;
|
||||||
@ -515,10 +520,10 @@ int pppOverSerialOpen(sio_fd_t fd, void (*linkStatusCB)(void *ctx, int errCode,
|
|||||||
pc->inEscaped = 0;
|
pc->inEscaped = 0;
|
||||||
pc->lastXMit = 0;
|
pc->lastXMit = 0;
|
||||||
|
|
||||||
#if VJ_SUPPORT > 0
|
#if VJ_SUPPORT
|
||||||
pc->vjEnabled = 0;
|
pc->vjEnabled = 0;
|
||||||
vj_compress_init(&pc->vjComp);
|
vj_compress_init(&pc->vjComp);
|
||||||
#endif
|
#endif /* VJ_SUPPORT */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Default the in and out accm so that escape and flag characters
|
* Default the in and out accm so that escape and flag characters
|
||||||
@ -603,9 +608,9 @@ int pppOverEthernetOpen(struct netif *ethif, const char *service_name, const cha
|
|||||||
pc->inHead = NULL;
|
pc->inHead = NULL;
|
||||||
pc->inTail = NULL;
|
pc->inTail = NULL;
|
||||||
pc->inEscaped = 0;
|
pc->inEscaped = 0;
|
||||||
#if VJ_SUPPORT > 0
|
#if VJ_SUPPORT
|
||||||
pc->vjEnabled = 0;
|
pc->vjEnabled = 0;
|
||||||
#endif
|
#endif /* VJ_SUPPORT */
|
||||||
#endif /* PPPOS_SUPPORT */
|
#endif /* PPPOS_SUPPORT */
|
||||||
pc->ethif= ethif;
|
pc->ethif= ethif;
|
||||||
|
|
||||||
@ -855,7 +860,7 @@ static err_t pppifOutput(struct netif *netif, struct pbuf *pb, struct ip_addr *i
|
|||||||
return ERR_MEM;
|
return ERR_MEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if VJ_SUPPORT > 0
|
#if VJ_SUPPORT
|
||||||
/*
|
/*
|
||||||
* Attempt Van Jacobson header compression if VJ is configured and
|
* Attempt Van Jacobson header compression if VJ is configured and
|
||||||
* this is an IP packet.
|
* this is an IP packet.
|
||||||
@ -883,7 +888,7 @@ static err_t pppifOutput(struct netif *netif, struct pbuf *pb, struct ip_addr *i
|
|||||||
return ERR_VAL;
|
return ERR_VAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* VJ_SUPPORT */
|
||||||
|
|
||||||
tailMB = headMB;
|
tailMB = headMB;
|
||||||
|
|
||||||
@ -1294,7 +1299,7 @@ int sifvjcomp(
|
|||||||
int maxcid
|
int maxcid
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
#if PPPOS_SUPPORT > 0 && VJ_SUPPORT > 0
|
#if PPPOS_SUPPORT && VJ_SUPPORT
|
||||||
PPPControl *pc = &pppControl[pd];
|
PPPControl *pc = &pppControl[pd];
|
||||||
|
|
||||||
pc->vjEnabled = vjcomp;
|
pc->vjEnabled = vjcomp;
|
||||||
@ -1302,7 +1307,7 @@ int sifvjcomp(
|
|||||||
pc->vjComp.maxSlotIndex = maxcid;
|
pc->vjComp.maxSlotIndex = maxcid;
|
||||||
PPPDEBUG((LOG_INFO, "sifvjcomp: VJ compress enable=%d slot=%d max slot=%d\n",
|
PPPDEBUG((LOG_INFO, "sifvjcomp: VJ compress enable=%d slot=%d max slot=%d\n",
|
||||||
vjcomp, cidcomp, maxcid));
|
vjcomp, cidcomp, maxcid));
|
||||||
#endif
|
#endif /* PPPOS_SUPPORT && VJ_SUPPORT */
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1336,8 +1341,10 @@ int sifup(int pd)
|
|||||||
if (netif_add(&pc->netif, &pc->addrs.our_ipaddr, &pc->addrs.netmask, &pc->addrs.his_ipaddr, (void *)pd, pppifNetifInit, ip_input)) {
|
if (netif_add(&pc->netif, &pc->addrs.our_ipaddr, &pc->addrs.netmask, &pc->addrs.his_ipaddr, (void *)pd, pppifNetifInit, ip_input)) {
|
||||||
|
|
||||||
netif_set_up(&pc->netif);
|
netif_set_up(&pc->netif);
|
||||||
|
#if LWIP_DHCP
|
||||||
/* ugly workaround for storing a reference to the ppp related info*/
|
/* ugly workaround for storing a reference to the ppp related info*/
|
||||||
pc->netif.dhcp = (struct dhcp *) &pc->addrs;
|
pc->netif.dhcp = (struct dhcp *) &pc->addrs;
|
||||||
|
#endif /* LWIP_DHCP */
|
||||||
pc->if_up = 1;
|
pc->if_up = 1;
|
||||||
pc->errCode = PPPERR_NONE;
|
pc->errCode = PPPERR_NONE;
|
||||||
|
|
||||||
@ -1492,56 +1499,57 @@ int cifdefaultroute(int pd, u32_t l, u32_t g)
|
|||||||
* to section 4 of RFC 1661: The Point-To-Point Protocol. */
|
* to section 4 of RFC 1661: The Point-To-Point Protocol. */
|
||||||
static void pppMain(void *arg)
|
static void pppMain(void *arg)
|
||||||
{
|
{
|
||||||
int pd = (int)arg;
|
int pd = (int)arg;
|
||||||
struct pbuf *p;
|
struct pbuf *p;
|
||||||
PPPControl* pc;
|
PPPControl* pc;
|
||||||
|
int c;
|
||||||
|
|
||||||
pc = &pppControl[pd];
|
pc = &pppControl[pd];
|
||||||
|
|
||||||
p = pbuf_alloc(PBUF_RAW, PPP_MRU+PPP_HDRLEN, PBUF_RAM);
|
p = pbuf_alloc(PBUF_RAW, PPP_MRU+PPP_HDRLEN, PBUF_RAM);
|
||||||
if(!p) {
|
if (!p) {
|
||||||
LWIP_ASSERT("p != NULL", p);
|
LWIP_ASSERT("p != NULL", p);
|
||||||
pc->errCode = PPPERR_ALLOC;
|
pc->errCode = PPPERR_ALLOC;
|
||||||
goto out;
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Start the connection and handle incoming events (packet or timeout).
|
||||||
|
*/
|
||||||
|
PPPDEBUG((LOG_INFO, "pppMain: unit %d: Connecting\n", pd));
|
||||||
|
tcpip_callback(pppStartCB, arg);
|
||||||
|
while (lcp_phase[pd] != PHASE_DEAD) {
|
||||||
|
if (pc->kill_link) {
|
||||||
|
PPPDEBUG((LOG_DEBUG, "pppMainWakeup: unit %d kill_link -> pppStopCB\n", pd));
|
||||||
|
pc->errCode = PPPERR_USER;
|
||||||
|
/* This will leave us at PHASE_DEAD. */
|
||||||
|
tcpip_callback(pppStopCB, arg);
|
||||||
|
pc->kill_link = 0;
|
||||||
|
} else if (pc->sig_hup) {
|
||||||
|
PPPDEBUG((LOG_DEBUG, "pppMainWakeup: unit %d sig_hup -> pppHupCB\n", pd));
|
||||||
|
pc->sig_hup = 0;
|
||||||
|
tcpip_callback(pppHupCB, arg);
|
||||||
|
} else {
|
||||||
|
c = sio_read(pc->fd, p->payload, p->len);
|
||||||
|
if(c > 0) {
|
||||||
|
pppInProc(pd, p->payload, c);
|
||||||
|
} else {
|
||||||
|
PPPDEBUG((LOG_DEBUG, "pppMainWakeup: unit %d sio_read len=%d returned %d\n", pd, p->len, c));
|
||||||
|
sys_msleep(1); /* give other tasks a chance to run */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/*
|
PPPDEBUG((LOG_INFO, "pppMain: unit %d: PHASE_DEAD\n", pd));
|
||||||
* Start the connection and handle incoming events (packet or timeout).
|
pppDrop(pc); /* bug fix #17726 */
|
||||||
*/
|
pbuf_free(p);
|
||||||
PPPDEBUG((LOG_INFO, "pppMain: unit %d: Connecting\n", pd));
|
|
||||||
tcpip_callback(pppStartCB, arg);
|
|
||||||
while (lcp_phase[pd] != PHASE_DEAD) {
|
|
||||||
if (pc->kill_link) {
|
|
||||||
PPPDEBUG((LOG_DEBUG, "pppMainWakeup: unit %d kill_link -> pppStopCB\n", pd));
|
|
||||||
pc->errCode = PPPERR_USER;
|
|
||||||
/* This will leave us at PHASE_DEAD. */
|
|
||||||
tcpip_callback(pppStopCB, arg);
|
|
||||||
pc->kill_link = 0;
|
|
||||||
}
|
|
||||||
else if (pc->sig_hup) {
|
|
||||||
PPPDEBUG((LOG_DEBUG, "pppMainWakeup: unit %d sig_hup -> pppHupCB\n", pd));
|
|
||||||
pc->sig_hup = 0;
|
|
||||||
tcpip_callback(pppHupCB, arg);
|
|
||||||
} else {
|
|
||||||
int c = sio_read(pc->fd, p->payload, p->len);
|
|
||||||
if(c > 0) {
|
|
||||||
pppInProc(pd, p->payload, c);
|
|
||||||
} else {
|
|
||||||
PPPDEBUG((LOG_DEBUG, "pppMainWakeup: unit %d sio_read len=%d returned %d\n", pd, p->len, c));
|
|
||||||
sys_msleep(1); /* give other tasks a chance to run */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
PPPDEBUG((LOG_INFO, "pppMain: unit %d: PHASE_DEAD\n", pd));
|
|
||||||
pppDrop(pc); /* bug fix #17726 */
|
|
||||||
pbuf_free(p);
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
PPPDEBUG((LOG_DEBUG, "pppMain: unit %d: linkStatusCB=%lx errCode=%d\n", pd, pc->linkStatusCB, pc->errCode));
|
PPPDEBUG((LOG_DEBUG, "pppMain: unit %d: linkStatusCB=%lx errCode=%d\n", pd, pc->linkStatusCB, pc->errCode));
|
||||||
if(pc->linkStatusCB)
|
if(pc->linkStatusCB) {
|
||||||
pc->linkStatusCB(pc->linkStatusCtx, pc->errCode ? pc->errCode : PPPERR_PROTOCOL, NULL);
|
pc->linkStatusCB(pc->linkStatusCtx, pc->errCode ? pc->errCode : PPPERR_PROTOCOL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
pc->openFlag = 0;
|
pc->openFlag = 0;
|
||||||
}
|
}
|
||||||
#endif /* PPPOS_SUPPORT */
|
#endif /* PPPOS_SUPPORT */
|
||||||
|
|
||||||
@ -1647,7 +1655,7 @@ static void pppInput(void *arg)
|
|||||||
|
|
||||||
switch(protocol) {
|
switch(protocol) {
|
||||||
case PPP_VJC_COMP: /* VJ compressed TCP */
|
case PPP_VJC_COMP: /* VJ compressed TCP */
|
||||||
#if VJ_SUPPORT > 0
|
#if VJ_SUPPORT
|
||||||
PPPDEBUG((LOG_INFO, "pppInput[%d]: vj_comp in pbuf len=%d\n", pd, nb->len));
|
PPPDEBUG((LOG_INFO, "pppInput[%d]: vj_comp in pbuf len=%d\n", pd, nb->len));
|
||||||
/*
|
/*
|
||||||
* Clip off the VJ header and prepend the rebuilt TCP/IP header and
|
* Clip off the VJ header and prepend the rebuilt TCP/IP header and
|
||||||
@ -1659,13 +1667,13 @@ static void pppInput(void *arg)
|
|||||||
}
|
}
|
||||||
/* Something's wrong so drop it. */
|
/* Something's wrong so drop it. */
|
||||||
PPPDEBUG((LOG_WARNING, "pppInput[%d]: Dropping VJ compressed\n", pd));
|
PPPDEBUG((LOG_WARNING, "pppInput[%d]: Dropping VJ compressed\n", pd));
|
||||||
#else
|
#else /* VJ_SUPPORT */
|
||||||
/* No handler for this protocol so drop the packet. */
|
/* No handler for this protocol so drop the packet. */
|
||||||
PPPDEBUG((LOG_INFO, "pppInput[%d]: drop VJ Comp in %d:%s\n", pd, nb->len, nb->payload));
|
PPPDEBUG((LOG_INFO, "pppInput[%d]: drop VJ Comp in %d:%s\n", pd, nb->len, nb->payload));
|
||||||
#endif /* VJ_SUPPORT > 0 */
|
#endif /* VJ_SUPPORT */
|
||||||
break;
|
break;
|
||||||
case PPP_VJC_UNCOMP: /* VJ uncompressed TCP */
|
case PPP_VJC_UNCOMP: /* VJ uncompressed TCP */
|
||||||
#if VJ_SUPPORT > 0
|
#if VJ_SUPPORT
|
||||||
PPPDEBUG((LOG_INFO, "pppInput[%d]: vj_un in pbuf len=%d\n", pd, nb->len));
|
PPPDEBUG((LOG_INFO, "pppInput[%d]: vj_un in pbuf len=%d\n", pd, nb->len));
|
||||||
/*
|
/*
|
||||||
* Process the TCP/IP header for VJ header compression and then pass
|
* Process the TCP/IP header for VJ header compression and then pass
|
||||||
@ -1677,12 +1685,12 @@ static void pppInput(void *arg)
|
|||||||
}
|
}
|
||||||
/* Something's wrong so drop it. */
|
/* Something's wrong so drop it. */
|
||||||
PPPDEBUG((LOG_WARNING, "pppInput[%d]: Dropping VJ uncompressed\n", pd));
|
PPPDEBUG((LOG_WARNING, "pppInput[%d]: Dropping VJ uncompressed\n", pd));
|
||||||
#else
|
#else /* VJ_SUPPORT */
|
||||||
/* No handler for this protocol so drop the packet. */
|
/* No handler for this protocol so drop the packet. */
|
||||||
PPPDEBUG((LOG_INFO,
|
PPPDEBUG((LOG_INFO,
|
||||||
"pppInput[%d]: drop VJ UnComp in %d:.*H\n",
|
"pppInput[%d]: drop VJ UnComp in %d:.*H\n",
|
||||||
pd, nb->len, LWIP_MIN(nb->len * 2, 40), nb->payload));
|
pd, nb->len, LWIP_MIN(nb->len * 2, 40), nb->payload));
|
||||||
#endif /* VJ_SUPPORT > 0 */
|
#endif /* VJ_SUPPORT */
|
||||||
break;
|
break;
|
||||||
case PPP_IP: /* Internet Protocol */
|
case PPP_IP: /* Internet Protocol */
|
||||||
PPPDEBUG((LOG_INFO, "pppInput[%d]: ip in pbuf len=%d\n", pd, nb->len));
|
PPPDEBUG((LOG_INFO, "pppInput[%d]: ip in pbuf len=%d\n", pd, nb->len));
|
||||||
@ -1751,9 +1759,9 @@ static void pppDrop(PPPControl *pc)
|
|||||||
pc->inHead = NULL;
|
pc->inHead = NULL;
|
||||||
pc->inTail = NULL;
|
pc->inTail = NULL;
|
||||||
}
|
}
|
||||||
#if VJ_SUPPORT > 0
|
#if VJ_SUPPORT
|
||||||
vj_uncompress_err(&pc->vjComp);
|
vj_uncompress_err(&pc->vjComp);
|
||||||
#endif
|
#endif /* VJ_SUPPORT */
|
||||||
|
|
||||||
#if LINK_STATS
|
#if LINK_STATS
|
||||||
lwip_stats.link.drop++;
|
lwip_stats.link.drop++;
|
||||||
|
@ -36,7 +36,9 @@
|
|||||||
|
|
||||||
#include "lwip/opt.h"
|
#include "lwip/opt.h"
|
||||||
|
|
||||||
#if PPP_SUPPORT > 0
|
#if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */
|
||||||
|
|
||||||
|
#include "lwip/def.h"
|
||||||
#include "lwip/sio.h"
|
#include "lwip/sio.h"
|
||||||
#include "lwip/api.h"
|
#include "lwip/api.h"
|
||||||
#include "lwip/sockets.h"
|
#include "lwip/sockets.h"
|
||||||
@ -210,9 +212,9 @@ enum NPmode {
|
|||||||
#define BZERO(s, n) memset(s, 0, n)
|
#define BZERO(s, n) memset(s, 0, n)
|
||||||
#if PPP_DEBUG
|
#if PPP_DEBUG
|
||||||
#define PRINTMSG(m, l) { m[l] = '\0'; ppp_trace(LOG_INFO, "Remote message: %s\n", m); }
|
#define PRINTMSG(m, l) { m[l] = '\0'; ppp_trace(LOG_INFO, "Remote message: %s\n", m); }
|
||||||
#else
|
#else /* PPP_DEBUG */
|
||||||
#define PRINTMSG(m, l)
|
#define PRINTMSG(m, l)
|
||||||
#endif
|
#endif /* PPP_DEBUG */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MAKEHEADER - Add PPP Header fields to a packet.
|
* MAKEHEADER - Add PPP Header fields to a packet.
|
||||||
@ -380,6 +382,8 @@ void pppSetAuth(enum pppAuthType authType, const char *user, const char *passwd)
|
|||||||
*/
|
*/
|
||||||
int pppOverSerialOpen(sio_fd_t fd, void (*linkStatusCB)(void *ctx, int errCode, void *arg), void *linkStatusCtx);
|
int pppOverSerialOpen(sio_fd_t fd, void (*linkStatusCB)(void *ctx, int errCode, void *arg), void *linkStatusCtx);
|
||||||
|
|
||||||
|
/* for source code compatibility */
|
||||||
|
#define pppOpen(fd,cb,ls) pppOverSerialOpen(fd,cb,ls)
|
||||||
/*
|
/*
|
||||||
* Open a new PPP Over Ethernet (PPPOE) connection.
|
* Open a new PPP Over Ethernet (PPPOE) connection.
|
||||||
*/
|
*/
|
||||||
|
@ -68,18 +68,21 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include "lwip/opt.h"
|
||||||
#include <stdio.h>
|
|
||||||
|
#if PPPOE_SUPPORT /* don't build if not configured for use in lwipopts.h */
|
||||||
|
|
||||||
#include "ppp.h"
|
#include "ppp.h"
|
||||||
|
#include "ppp_oe.h"
|
||||||
#include "pppdebug.h"
|
#include "pppdebug.h"
|
||||||
|
|
||||||
#include "netif/etharp.h"
|
#include "netif/etharp.h"
|
||||||
#include "queue.h"
|
|
||||||
#include "ppp_oe.h"
|
|
||||||
#include "lwip/sys.h"
|
#include "lwip/sys.h"
|
||||||
|
|
||||||
#if PPPOE_SUPPORT > 0
|
#include "queue.h"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
/* Add a 16 bit unsigned value to a buffer pointed to by PTR */
|
/* Add a 16 bit unsigned value to a buffer pointed to by PTR */
|
||||||
#define PPPOE_ADD_16(PTR, VAL) \
|
#define PPPOE_ADD_16(PTR, VAL) \
|
||||||
@ -1089,4 +1092,5 @@ pppoe_clear_softc(struct pppoe_softc *sc, const char *message)
|
|||||||
sc->sc_session = 0;
|
sc->sc_session = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* PPPOE_SUPPORT > 0 */
|
#endif /* PPPOE_SUPPORT */
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ typedef enum {
|
|||||||
*/
|
*/
|
||||||
void ppp_trace(int level, const char *format,...);
|
void ppp_trace(int level, const char *format,...);
|
||||||
|
|
||||||
#if PPP_DEBUG > 0
|
#if PPP_DEBUG
|
||||||
|
|
||||||
#define AUTHDEBUG(a) ppp_trace a
|
#define AUTHDEBUG(a) ppp_trace a
|
||||||
#define IPCPDEBUG(a) ppp_trace a
|
#define IPCPDEBUG(a) ppp_trace a
|
||||||
@ -71,7 +71,7 @@ void ppp_trace(int level, const char *format,...);
|
|||||||
|
|
||||||
#define TRACELCP 1
|
#define TRACELCP 1
|
||||||
|
|
||||||
#else
|
#else /* PPP_DEBUG */
|
||||||
|
|
||||||
#define AUTHDEBUG(a)
|
#define AUTHDEBUG(a)
|
||||||
#define IPCPDEBUG(a)
|
#define IPCPDEBUG(a)
|
||||||
@ -84,6 +84,6 @@ void ppp_trace(int level, const char *format,...);
|
|||||||
|
|
||||||
#define TRACELCP 0
|
#define TRACELCP 0
|
||||||
|
|
||||||
#endif
|
#endif /* PPP_DEBUG */
|
||||||
|
|
||||||
#endif /* PPPDEBUG_H */
|
#endif /* PPPDEBUG_H */
|
||||||
|
@ -31,15 +31,18 @@
|
|||||||
* Extracted from avos.
|
* Extracted from avos.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#include "ppp.h"
|
#include "lwip/opt.h"
|
||||||
#if PPP_SUPPORT > 0
|
|
||||||
|
#if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */
|
||||||
|
|
||||||
#include "md5.h"
|
#include "md5.h"
|
||||||
#include "randm.h"
|
#include "randm.h"
|
||||||
|
|
||||||
|
#include "ppp.h"
|
||||||
#include "pppdebug.h"
|
#include "pppdebug.h"
|
||||||
|
|
||||||
|
|
||||||
#if MD5_SUPPORT>0 /* this module depends on MD5 */
|
#if MD5_SUPPORT /* this module depends on MD5 */
|
||||||
#define RANDPOOLSZ 16 /* Bytes stored in the pool of randomness. */
|
#define RANDPOOLSZ 16 /* Bytes stored in the pool of randomness. */
|
||||||
|
|
||||||
/*****************************/
|
/*****************************/
|
||||||
@ -235,8 +238,6 @@ u32_t avRandom()
|
|||||||
return ((((u32_t)rand() << 16) + rand()) + avRandomSeed);
|
return ((((u32_t)rand() << 16) + rand()) + avRandomSeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* MD5_SUPPORT */
|
#endif /* MD5_SUPPORT */
|
||||||
#endif /* PPP_SUPPORT */
|
|
||||||
|
|
||||||
|
#endif /* PPP_SUPPORT */
|
||||||
|
@ -58,9 +58,9 @@ void avChurnRand(char *randData, u32_t randLen);
|
|||||||
*/
|
*/
|
||||||
#if MD5_SUPPORT
|
#if MD5_SUPPORT
|
||||||
#define avRandomize() avChurnRand(NULL, 0)
|
#define avRandomize() avChurnRand(NULL, 0)
|
||||||
#else
|
#else /* MD5_SUPPORT */
|
||||||
void avRandomize(void);
|
void avRandomize(void);
|
||||||
#endif
|
#endif /* MD5_SUPPORT */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Use the random pool to generate random data. This degrades to pseudo
|
* Use the random pool to generate random data. This degrades to pseudo
|
||||||
|
@ -28,13 +28,18 @@
|
|||||||
* for a 16 bit processor.
|
* for a 16 bit processor.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include "lwip/opt.h"
|
||||||
|
|
||||||
|
#if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */
|
||||||
|
|
||||||
#include "ppp.h"
|
#include "ppp.h"
|
||||||
#include "vj.h"
|
|
||||||
#include "pppdebug.h"
|
#include "pppdebug.h"
|
||||||
|
|
||||||
#if VJ_SUPPORT > 0
|
#include "vj.h"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#if VJ_SUPPORT
|
||||||
|
|
||||||
#if LINK_STATS
|
#if LINK_STATS
|
||||||
#define INCR(counter) ++comp->stats.counter
|
#define INCR(counter) ++comp->stats.counter
|
||||||
@ -579,7 +584,7 @@ int vj_uncompress_tcp(
|
|||||||
cs->cs_ip.ip_sum = (u_short)(~tmp);
|
cs->cs_ip.ip_sum = (u_short)(~tmp);
|
||||||
|
|
||||||
/* Remove the compressed header and prepend the uncompressed header. */
|
/* Remove the compressed header and prepend the uncompressed header. */
|
||||||
if(pbuf_header(n0, -vjlen)) {
|
if(pbuf_header(n0, -((s16_t)(vjlen)))) {
|
||||||
/* Can we cope with this failing? Just assert for now */
|
/* Can we cope with this failing? Just assert for now */
|
||||||
LWIP_ASSERT("pbuf_header failed\n", 0);
|
LWIP_ASSERT("pbuf_header failed\n", 0);
|
||||||
goto bad;
|
goto bad;
|
||||||
@ -641,6 +646,6 @@ bad:
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif /* VJ_SUPPORT */
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* PPP_SUPPORT */
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
#include "lwip/tcp.h"
|
#include "lwip/tcp.h"
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Structure of an internet header, naked of options.
|
* Structure of an internet header, naked of options.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user