|From:||Wei Bo-Er \(Jason\)|
|Subject:||[lwip-users] Bug of ARP?|
|Date:||Tue, 14 Dec 2004 15:01:22 +0800|
I'm using lwIP 1.0.0 and found a problem look like a lwIP's bug. I don't know if there is
anyone had mentioned it before(There seems to be many bugs fixing recently). I just explain
what I found here.
In gereral, LwIP will queue packets as there is no matching entry in the ARP table. It uses
p = pbuf_take(q) to copy sent packet 'q' to internal pbuf 'p' and make q=p.The 'p' will be
queued in arp_table[i].p and be freed after timeout or it can be sent out. This will cause some
problems in TCP. Since TCP needs to keep sent packets in unacked queue until ack is
arriving, those packets may be freed in ARP before ack is received by TCP. Except TCP,
ICMP and UDP will also free sent packets after return of sent-out function. It may also
causes packets in ARP queue be freed before timeout or they can be sent out.
I made some modification in pbuf_take which is shown as follow to resolve it.
828 struct pbuf *
829 pbuf_take(struct pbuf *p)
831 - struct pbuf *q , *prev, *head;
+ struct pbuf *q , *prev, *head, *ori_head;
836 - head = p;
+ head = ori_head = p;
841 - pbuf_free(p);
911 + p=ori_head;
912 return head;
This modification keeps 'p' as original one and doesn't free it. All sent packets will be freed by up layer
instead of ARP.
|[Prev in Thread]||Current Thread||[Next in Thread]|