buglwIP - A Lightweight TCP/IP stack - Bugs: bug #17726, PPP: memory wasting with every...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #17726: PPP: memory wasting with every reconnection by pppClose/SIG

Submitter:  None
Submitted:  Wed 13 Sep 2006 07:02:05 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  Crash Error Status:  Duplicate
Privacy:  Public Assigned to:  None
Open/Closed:  Closed Planned Release:  None
lwIP version:  None

Sat 02 Jun 2007 05:03:38 PM UTC, comment #5: 

Closing this as duplicate (patch #5628 includes a patch to this problem).

Simon Goldschmidt <goldsimon>
Group administrator
Mon 19 Feb 2007 10:58:16 AM UTC, comment #4: 

I'm inclined to apply the patch that fixes this bug (https://savannah.nongnu.org/patch/index.php?5628), but I've no ability to test PPP.  Would anyone who is more interested in PPP than me like to volunteer to check it out?  It's a simple one line change.

Kieran Mansley <kieranm>
Group Member
Sat 09 Dec 2006 09:46:19 PM UTC, comment #3: 

the change was done in ppp.c 1.2.0 now:

--- ppp2.c Sat Dec  9 22:40:57 2006
+++ ppp.c Sat Dec  9 22:40:54 2006
@@ -1243,6 +1243,7 @@
         }
     }
  PPPDEBUG((LOG_INFO, "pppMain: unit %d: PHASE_DEAD\n", pd));
+ pppDrop(pc); // bug fix #17726
     pbuf_free(p);
 
 out:

best regards
JU

Anonymous
Thu 02 Nov 2006 12:32:25 PM UTC, comment #2: 

Please supply a proper patch (diff -urN) for this, me too lazy merging this stuff. zzz.

Christiaan Simons <christiaans>
Group Member
Sat 28 Oct 2006 11:09:09 PM UTC, comment #1: 
Anonymous
Wed 13 Sep 2006 07:02:05 PM UTC, original submission:  

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 );
}

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by goldsimon (Posted a comment)
  • -email is unavailable- added by kieranm (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2007-06-02 goldsimon StatusNone Duplicate
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code