diff --git a/src/netif/ppp/fsm.c b/src/netif/ppp/fsm.c index 84d7ccaf..b022e312 100644 --- a/src/netif/ppp/fsm.c +++ b/src/netif/ppp/fsm.c @@ -70,9 +70,6 @@ static void fsm_sconfreq(fsm *f, int retransmit); #define PROTO_NAME(f) ((f)->callbacks->proto_name) -int peer_mru[NUM_PPP]; - - /* * fsm_init - Initialize fsm. * @@ -714,8 +711,8 @@ static void fsm_sconfreq(fsm *f, int retransmit) { outp = outpacket_buf + PPP_HDRLEN + HEADERLEN; if( f->callbacks->cilen && f->callbacks->addci ){ cilen = (*f->callbacks->cilen)(f); - if( cilen > peer_mru[pcb->unit] - HEADERLEN ) - cilen = peer_mru[pcb->unit] - HEADERLEN; + if( cilen > pcb->peer_mru - HEADERLEN ) + cilen = pcb->peer_mru - HEADERLEN; if (f->callbacks->addci) (*f->callbacks->addci)(f, outp, &cilen); } else @@ -742,8 +739,8 @@ void fsm_sdata(fsm *f, u_char code, u_char id, u_char *data, int datalen) { /* Adjust length to be smaller than MTU */ outp = outpacket_buf; - if (datalen > peer_mru[pcb->unit] - HEADERLEN) - datalen = peer_mru[pcb->unit] - HEADERLEN; + if (datalen > pcb->peer_mru - HEADERLEN) + datalen = pcb->peer_mru - HEADERLEN; if (datalen && data != outp + PPP_HDRLEN + HEADERLEN) MEMCPY(outp + PPP_HDRLEN + HEADERLEN, data, datalen); outlen = datalen + HEADERLEN; diff --git a/src/netif/ppp/fsm.h b/src/netif/ppp/fsm.h index 217521fc..d02301ab 100644 --- a/src/netif/ppp/fsm.h +++ b/src/netif/ppp/fsm.h @@ -168,10 +168,5 @@ void fsm_protreject(fsm *f); void fsm_sdata(fsm *f, u_char code, u_char id, u_char *data, int datalen); -/* - * Variables - */ -extern int peer_mru[]; /* currently negotiated peer MRU (per unit) */ - #endif /* FSM_H */ #endif /* PPP_SUPPORT */ diff --git a/src/netif/ppp/lcp.c b/src/netif/ppp/lcp.c index e30af511..c46ee2bb 100644 --- a/src/netif/ppp/lcp.c +++ b/src/netif/ppp/lcp.c @@ -495,7 +495,7 @@ void lcp_lowerup(ppp_pcb *pcb) { || ppp_recv_config(pcb, PPP_MRU, (lax_recv? 0: 0xffffffff), wo->neg_pcompression, wo->neg_accompression) < 0) return; - peer_mru[pcb->unit] = PPP_MRU; + pcb->peer_mru = PPP_MRU; #if PPPOS_SUPPORT ao->asyncmap = (u_long)xmit_accm[pcb->unit][0] @@ -707,7 +707,7 @@ static void lcp_resetci(fsm *f) { #endif /* HAVE_MULTILINK */ if (noendpoint) ao->neg_endpoint = 0; - peer_mru[pcb->unit] = PPP_MRU; + pcb->peer_mru = PPP_MRU; auth_reset(pcb); } @@ -2242,7 +2242,7 @@ static void lcp_up(fsm *f) { go->neg_pcompression, go->neg_accompression); if (ho->neg_mru) - peer_mru[pcb->unit] = ho->mru; + pcb->peer_mru = ho->mru; lcp_echo_lowerup(f->pcb); /* Enable echo messages */ @@ -2267,7 +2267,7 @@ static void lcp_down(fsm *f) { ppp_recv_config(pcb, PPP_MRU, (go->neg_asyncmap? go->asyncmap: 0xffffffff), go->neg_pcompression, go->neg_accompression); - peer_mru[pcb->unit] = PPP_MRU; + pcb->peer_mru = PPP_MRU; } diff --git a/src/netif/ppp/ppp.h b/src/netif/ppp/ppp.h index 752f0c30..94b8e86e 100644 --- a/src/netif/ppp/ppp.h +++ b/src/netif/ppp/ppp.h @@ -443,6 +443,8 @@ typedef struct ppp_pcb_s { eap_state eap; #endif /* EAP_SUPPORT */ + int peer_mru; /* currently negotiated peer MRU (per unit) */ + fsm lcp_fsm; /* LCP fsm structure */ lcp_options lcp_wantoptions; /* Options that we want to request */ lcp_options lcp_gotoptions; /* Options that peer ack'd */