mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-05 22:29:49 +00:00
saved some bytes from PPPoE control block, improved PADI retries
This commit is contained in:
parent
d2b2ae09e6
commit
91af8878e1
@ -148,22 +148,22 @@ struct pppoe_softc {
|
||||
ppp_pcb *pcb; /* PPP PCB */
|
||||
void (*sc_link_status_cb)(ppp_pcb *pcb, int up);
|
||||
|
||||
int sc_state; /* discovery phase or session connected */
|
||||
struct eth_addr sc_dest; /* hardware address of concentrator */
|
||||
u16_t sc_session; /* PPPoE session id */
|
||||
u8_t sc_state; /* discovery phase or session connected */
|
||||
|
||||
#ifdef PPPOE_TODO
|
||||
char *sc_service_name; /* if != NULL: requested name of service */
|
||||
char *sc_concentrator_name; /* if != NULL: requested concentrator id */
|
||||
u8_t *sc_service_name; /* if != NULL: requested name of service */
|
||||
u8_t *sc_concentrator_name; /* if != NULL: requested concentrator id */
|
||||
#endif /* PPPOE_TODO */
|
||||
u8_t sc_ac_cookie[PPPOE_MAX_AC_COOKIE_LEN]; /* content of AC cookie we must echo back */
|
||||
size_t sc_ac_cookie_len; /* length of cookie data */
|
||||
u8_t sc_ac_cookie_len; /* length of cookie data */
|
||||
#ifdef PPPOE_SERVER
|
||||
u8_t *sc_hunique; /* content of host unique we must echo back */
|
||||
size_t sc_hunique_len; /* length of host unique */
|
||||
u8_t sc_hunique_len; /* length of host unique */
|
||||
#endif
|
||||
int sc_padi_retried; /* number of PADI retries already done */
|
||||
int sc_padr_retried; /* number of PADR retries already done */
|
||||
u8_t sc_padi_retried; /* number of PADI retries already done */
|
||||
u8_t sc_padr_retried; /* number of PADR retries already done */
|
||||
};
|
||||
|
||||
|
||||
|
@ -730,7 +730,8 @@ pppoe_send_padi(struct pppoe_softc *sc)
|
||||
static void
|
||||
pppoe_timeout(void *arg)
|
||||
{
|
||||
int retry_wait, err;
|
||||
u32_t retry_wait;
|
||||
int err;
|
||||
struct pppoe_softc *sc = (struct pppoe_softc*)arg;
|
||||
|
||||
PPPDEBUG(LOG_DEBUG, ("pppoe: %c%c%"U16_F": timeout\n", sc->sc_ethif->name[0], sc->sc_ethif->name[1], sc->sc_ethif->num));
|
||||
@ -746,15 +747,9 @@ pppoe_timeout(void *arg)
|
||||
* We only enter slow retry mode if IFF_LINK1 (aka autodial)
|
||||
* is not set.
|
||||
*/
|
||||
|
||||
/* initialize for quick retry mode */
|
||||
retry_wait = LWIP_MIN(PPPOE_DISC_TIMEOUT * (1 + sc->sc_padi_retried), PPPOE_SLOW_RETRY);
|
||||
|
||||
/* prevent sc_padi_retried integer overflow << ~2^31/PPPOE_DISC_TIMEOUT
|
||||
* FIXME: can be improved
|
||||
*/
|
||||
if(sc->sc_padi_retried < 100000)
|
||||
if (sc->sc_padi_retried < UCHAR_MAX) {
|
||||
sc->sc_padi_retried++;
|
||||
}
|
||||
if (!sc->pcb->settings.persist && sc->sc_padi_retried >= PPPOE_DISC_MAXPADI) {
|
||||
#if 0
|
||||
if ((sc->sc_sppp.pp_if.if_flags & IFF_LINK1) == 0) {
|
||||
@ -767,6 +762,8 @@ pppoe_timeout(void *arg)
|
||||
return;
|
||||
}
|
||||
}
|
||||
/* initialize for quick retry mode */
|
||||
retry_wait = LWIP_MIN(PPPOE_DISC_TIMEOUT * sc->sc_padi_retried, PPPOE_SLOW_RETRY);
|
||||
if ((err = pppoe_send_padi(sc)) != 0) {
|
||||
sc->sc_padi_retried--;
|
||||
PPPDEBUG(LOG_DEBUG, ("pppoe: %c%c%"U16_F": failed to transmit PADI, error=%d\n", sc->sc_ethif->name[0], sc->sc_ethif->name[1], sc->sc_ethif->num, err));
|
||||
|
Loading…
Reference in New Issue
Block a user