Ed Sutter wrote:
Folks,
I'm running with 1.3.0 and I have an HTTP server and a UDP-based
server running on my target for months.
Last night I accidentally sent that target a tftp packet (it does
not have a tftp server running) and I got an assertion failure...

Assertion "p->payload == iphdr" failed at line 293 in ./lwip/src/core/udp.c

The code looks like its trying to send back an ICMP error message (as it
should); however, something gets hosed.

Haven't dug too deep into this yet, but I figured I'd toss up
the question to the group to see if anyone else has seen this.

I have some more information...
Recently, I changed my input packet handler a bit (thinking I was
doing something more efficiently with pbufs, maybe I broke something).
My original code would receive the packet, then allocate a pbuf and
copy the packet into that pbuf...

    ....
    ipkt = (char *)ipacket;
    len = mon_recvenetpkt((char *)ipacket,sizeof(ipacket));
    if (len) {
        p = pbuf_alloc(PBUF_RAW, len, PBUF_POOL);
        if (p) {
            for(q = p; q != NULL; q = q->next) {
                memcpy(q->payload,ipkt, q->len);
                ipkt += q->len;
            }
            ethernet_input(p, mynetifp);
    ....

To be more efficient, I changed this by using PBUF_REF and
setting the payload pointer to the packet buffer...

    ....
    len = mon_recvenetpkt((char *)ipacket,sizeof(ipacket));
    if (len) {
        p = pbuf_alloc(PBUF_RAW, len, PBUF_REF);
        if (p) {
            p->payload = ipacket;
            ethernet_input(p, mynetifp);
    ....

This new code works ok with incoming expected packets.
The original code doesn't cause the assertion error above.
Is the "new" code above incorrect?

Thanks in advance
Ed


_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to