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

Submitted by:  None
Submitted on:  Wed 13 Sep 2006 07:02:05 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: Crash ErrorStatus: Duplicate
Privacy: PublicAssigned to: None
Open/Closed: ClosedPlanned 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>
Project 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>
Project Administrator
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>
Project Member
Sat 28 Oct 2006 11:09:09 PM UTC, comment #1:

http://sourceforge.net/forum/forum.php?thread_id=1559455&forum_id=382005

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

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 02 Jun 2007 05:03:38 PM UTCgoldsimonStatusNone=>Duplicate
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1