lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] [bug #17726] PPP: memory wasting with every reconnection by


From: anonymous
Subject: [lwip-devel] [bug #17726] PPP: memory wasting with every reconnection by pppClose/SIG
Date: Wed, 13 Sep 2006 19:02:06 +0000
User-agent: Opera/9.01 (Windows NT 5.1; U; pl)

URL:
  <http://savannah.nongnu.org/bugs/?17726>

                 Summary: PPP: memory wasting with every reconnection by
pppClose/SIG
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: None
            Submitted on: Wednesday 09/13/2006 at 19:02 UTC
                Category: None
                Severity: 3 - Normal
              Item Group: Crash Error
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open

    _______________________________________________________

Details:

description:
ppp.c consists a bug in pppMain(). When connection is lost (ppp thread dead)
allocated memory by pppInProc is not free. The memory is wasted every time
when pppOpen - pppClose sequence is done during data link is active and data
are still exchanging near time before true killing ppp. Finally it is
possible NO FREE MBUFS! message... There is necessery to free pbuf memory.

Solution:
pppDrop() at end of pppMain()

best regards
Janusz Uzycki

example the code:

static void pppMain(void *arg) 
{ 
err_t err; 
int pd = (int)arg; 
struct pbuf *p; 
PPPControl* pc; 
 
pc = &pppControl[pd]; 
 
p = pbuf_alloc(PBUF_RAW, PPP_MRU+PPP_HDRLEN, PBUF_RAM); 
PPPDEBUG((LOG_WARNING, "pppMain: pbuf alloc %08x\n", p)); //JU 
if(!p) { 
LWIP_ASSERT("p != NULL", p); 
pc->errCode = PPPERR_ALLOC; 
goto out; 
} 
 
/* 
* Start the connection and handle incoming events (packet or timeout). 
*/ 
PPPDEBUG((LOG_INFO, "pppMain: unit %d: Connecting\n", pd)); 
err = tcpip_callback(pppStartCB, arg); 
LWIP_ASSERT( "pppMain: can't install callback handler\n", err == ERR_OK ); 
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)); */ 
} 
} 
} 
PPPDEBUG((LOG_INFO, "pppMain: unit %d: PHASE_D EAD\n", pd)); 
pppDrop(pc); // or in line after PPPDEBUG((LOG_DEBUG, "pppMainWakeup: unit %d
sio_read len=%d returned %d\n", pd, p->len, c)); 
PPPDEBUG((LOG_WARNING, "pppMain: pbuf free %08x\n", p)); //JU 
pbuf_free(p); 
 
out: 
PPPDEBUG((LOG_DEBUG, "pppMain: unit %d: linkStatusCB=%lx errCode=%d\n", pd,
pc->linkStatusCB, pc->errCode)); 
if(pc->linkStatusCB) 
pc->linkStatusCB(pc->linkStatusCtx, pc->errCode ? pc->errCode :
PPPERR_PROTOCOL, NULL); 
 
pc->openFlag = 0; 
 
/* Remove this thread from the running ones. */ 
sys_arch_thread_remove( sys_arch_thread_current( ) ); 
LWIP_ASSERT( "pppMain: sys_arch_thread_remove did return\n", 0 ); 
}






    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?17726>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]