This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

lwIP TCP/IP stack assertion problem


Hello,

I just compiled an eCos image with lwIP TCP/IP stack and executed the
lwIP tests without any problems. Then I enabled eCos assertions and
turned on lwIP assertions and recompiled the image. Then I started the
socket.c test and as soon as the stack received the first character an
assertion hits:

ASSERT FAIL: <3>pbuf.c[548]pbuf_free() p != NULL

I run the test on two completely different platforms with different
ethernet hardware (EDOSK2674 with SMSC LAN91C96 and Motorola Coldfire
MCF5272 with builtin ethernet module) with the same result. So I think
this is not a platform or ethernet driver specific problem.

I examined the function pbuf_free() in pbuf.c and found the following
code:

...
LWIP_ASSERT("p != NULL", p != NULL);
  /* if assertions are disabled, proceed with debug output */
  if (p == NULL) {
    LWIP_DEBUGF(PBUF_DEBUG | DBG_TRACE | 2,
               ("pbuf_free(p == NULL) was called.\n"));
    return 0;
  }
...

That means if p is not NULL the assertion hits and if it is NULL the
function simply returns 0. So this function seems to be quite useless.
Some lines further in this function the following code appears:

...
/* de-allocate all consecutive pbufs from the head of the chain that
 * obtain a zero reference count after decrementing*/
while (p != NULL) {
    /* all pbufs in a chain are referenced at least once */
    LWIP_ASSERT("pbuf_free: p->ref > 0", p->ref > 0);
    /* decrease reference count (number of pointers to pbuf) */
    p->ref--;
    ...

If assertions are enabled this part of the function will never be
reached. So I really do not understand the meaning of this assertion.
Is this an eCos specific problem or should I post this question to the
lwIP list.

I know the truth is out there. Are there any lwIP insiders out there
that could bring some light into my darkness.

Thank you very much.

Regards, Uwe


-- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]