diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h index 70e0d2d9..c20435ee 100644 --- a/src/include/lwip/opt.h +++ b/src/include/lwip/opt.h @@ -1888,18 +1888,30 @@ #define UPAP_DEFTIMEOUT 6 /* Timeout (seconds) for retransmitting req */ #endif +#ifndef UPAP_DEFTRANSMITS +#define UPAP_DEFTRANSMITS 10 /* Maximum number of auth-reqs to send */ +#endif + +#if PPP_SERVER #ifndef UPAP_DEFREQTIME #define UPAP_DEFREQTIME 30 /* Time to wait for auth-req from peer */ #endif +#endif /* PPP_SERVER */ #ifndef CHAP_DEFTIMEOUT -#define CHAP_DEFTIMEOUT 6 /* Timeout time in seconds */ +#define CHAP_DEFTIMEOUT 6 /* Timeout (seconds) for retransmitting req */ #endif #ifndef CHAP_DEFTRANSMITS #define CHAP_DEFTRANSMITS 10 /* max # times to send challenge */ #endif +#if PPP_SERVER +#ifndef CHAP_DEFREQTIME +#define CHAP_DEFREQTIME 30 /* Time to wait for auth-req from peer */ +#endif +#endif /* PPP_SERVER */ + /* Default number of times we receive our magic number from the peer before deciding the link is looped-back. */ #ifndef LCP_DEFLOOPBACKFAIL diff --git a/src/include/netif/ppp/ppp.h b/src/include/netif/ppp/ppp.h index 4676ae63..f589cd18 100644 --- a/src/include/netif/ppp/ppp.h +++ b/src/include/netif/ppp/ppp.h @@ -225,9 +225,11 @@ typedef struct ppp_settings_s { #endif /* PPP_REMOTENAME */ #if CHAP_SUPPORT - u8_t chap_timeout_time; - u8_t chap_max_transmits; - u8_t chap_rechallenge_time; + u8_t chap_timeout_time; /* Timeout (seconds) for retransmitting req */ + u8_t chap_max_transmits; /* max # times to send challenge */ +#if PPP_SERVER + u8_t chap_rechallenge_time; /* Time to wait for auth-req from peer */ +#endif /* PPP_SERVER */ #endif /* CHAP_SUPPPORT */ u8_t lcp_loopbackfail; /* Number of times we receive our magic number from the peer diff --git a/src/include/netif/ppp/upap.h b/src/include/netif/ppp/upap.h index d6185da9..940f01d0 100644 --- a/src/include/netif/ppp/upap.h +++ b/src/include/netif/ppp/upap.h @@ -110,7 +110,9 @@ typedef struct upap_state { u8_t us_timeouttime; /* Timeout (seconds) for auth-req retrans. */ u8_t us_transmits; /* Number of auth-reqs sent */ u8_t us_maxtransmits; /* Maximum number of auth-reqs to send */ +#if PPP_SERVER u8_t us_reqtimeout; /* Time to wait for auth-req from peer */ +#endif /* PPP_SERVER */ } upap_state; #endif /* PAP_SUPPORT */ diff --git a/src/netif/ppp/ppp.c b/src/netif/ppp/ppp.c index 880bb4e6..a63779e7 100644 --- a/src/netif/ppp/ppp.c +++ b/src/netif/ppp/ppp.c @@ -260,6 +260,9 @@ ppp_pcb *ppp_new(void) { #if CHAP_SUPPORT pcb->settings.chap_timeout_time = CHAP_DEFTIMEOUT; pcb->settings.chap_max_transmits = CHAP_DEFTRANSMITS; +#if PPP_SERVER + pcb->settings.chap_rechallenge_time = CHAP_DEFREQTIME; +#endif /* PPP_SERVER */ #endif /* CHAP_SUPPPORT */ pcb->settings.lcp_loopbackfail = LCP_DEFLOOPBACKFAIL; pcb->settings.lcp_echo_interval = LCP_ECHOINTERVAL; diff --git a/src/netif/ppp/upap.c b/src/netif/ppp/upap.c index 5e61a76c..5c8b53c2 100644 --- a/src/netif/ppp/upap.c +++ b/src/netif/ppp/upap.c @@ -144,8 +144,10 @@ static void upap_init(ppp_pcb *pcb) { #endif /* PPP_SERVER */ pcb->upap.us_id = 0; pcb->upap.us_timeouttime = UPAP_DEFTIMEOUT; - pcb->upap.us_maxtransmits = 10; + pcb->upap.us_maxtransmits = UPAP_DEFTRANSMITS; +#if PPP_SERVER pcb->upap.us_reqtimeout = UPAP_DEFREQTIME; +#endif /* PPP_SERVER */ }