mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-08-04 21:44:38 +08:00
PPP, improved fsm_sconfreq() allocated buffer size
This commit is contained in:
parent
045ee53468
commit
a1c87f7c49
@ -706,7 +706,17 @@ static void fsm_sconfreq(fsm *f, int retransmit) {
|
|||||||
|
|
||||||
f->seen_ack = 0;
|
f->seen_ack = 0;
|
||||||
|
|
||||||
p = pbuf_alloc(PBUF_RAW, (u16_t)(PBUF_POOL_BUFSIZE), PBUF_POOL);
|
/*
|
||||||
|
* Make up the request packet
|
||||||
|
*/
|
||||||
|
if( f->callbacks->cilen && f->callbacks->addci ){
|
||||||
|
cilen = (*f->callbacks->cilen)(f);
|
||||||
|
if( cilen > pcb->peer_mru - HEADERLEN )
|
||||||
|
cilen = pcb->peer_mru - HEADERLEN;
|
||||||
|
} else
|
||||||
|
cilen = 0;
|
||||||
|
|
||||||
|
p = pbuf_alloc(PBUF_RAW, (u16_t)(cilen + HEADERLEN + PPP_HDRLEN), PBUF_POOL);
|
||||||
if(NULL == p)
|
if(NULL == p)
|
||||||
return;
|
return;
|
||||||
if(p->tot_len != p->len) {
|
if(p->tot_len != p->len) {
|
||||||
@ -714,27 +724,16 @@ static void fsm_sconfreq(fsm *f, int retransmit) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Make up the request packet
|
|
||||||
*/
|
|
||||||
outp = (u_char*)p->payload + PPP_HDRLEN + HEADERLEN;
|
|
||||||
if( f->callbacks->cilen && f->callbacks->addci ){
|
|
||||||
cilen = (*f->callbacks->cilen)(f);
|
|
||||||
if( cilen > pcb->peer_mru - HEADERLEN )
|
|
||||||
cilen = pcb->peer_mru - HEADERLEN;
|
|
||||||
if (f->callbacks->addci)
|
|
||||||
(*f->callbacks->addci)(f, outp, &cilen);
|
|
||||||
} else
|
|
||||||
cilen = 0;
|
|
||||||
|
|
||||||
/* send the request to our peer */
|
/* send the request to our peer */
|
||||||
outp = p->payload;
|
outp = p->payload;
|
||||||
MAKEHEADER(outp, f->protocol);
|
MAKEHEADER(outp, f->protocol);
|
||||||
PUTCHAR(CONFREQ, outp);
|
PUTCHAR(CONFREQ, outp);
|
||||||
PUTCHAR(f->reqid, outp);
|
PUTCHAR(f->reqid, outp);
|
||||||
PUTSHORT(cilen + HEADERLEN, outp);
|
PUTSHORT(cilen + HEADERLEN, outp);
|
||||||
|
if (cilen != 0) {
|
||||||
|
(*f->callbacks->addci)(f, outp, &cilen);
|
||||||
|
}
|
||||||
|
|
||||||
pbuf_realloc(p, cilen + HEADERLEN + PPP_HDRLEN);
|
|
||||||
ppp_write(pcb, p);
|
ppp_write(pcb, p);
|
||||||
|
|
||||||
/* start the retransmit timer */
|
/* start the retransmit timer */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user