[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] ARP problem (CONFIRMED 0.7.0 BUG)
From: |
Leon Woestenberg |
Subject: |
Re: [lwip-users] ARP problem (CONFIRMED 0.7.0 BUG) |
Date: |
Wed, 04 Feb 2004 15:25:48 +0100 |
On Wed, 4 Feb 2004 12:09:46 +0800, "stephen" <address@hidden> said:
> Hi:
>
> I am porting lwIP to a very compact RTOS.
> Is there document for porting guide or port instructions?
> Really appreciate if you can provide any information.
> I will make porting instructions if I can port lwIP to my platform
> successfully.
>
Check out the contrib ports. Unfortunately, documentation in lwIP is
either
absent, outdated.
The best documentation is to be found in the source code, as
JavaDoc/Doxygen
stuff.
We would welcome any specific or non-specific porting guide.
> One problem is about handling ARP request in etharp.c(lwIP version
> 0.7)
> line 550 => hdr->shwaddr.addr[i] = ethaddr->addr[i];
> line 586 => update_arp_entry(netif, &(hdr->sipaddr),
> &(hdr->shwaddr), ARP_INSERT_FLAG);
>
> Looks like "hdr->shwaddr" was changed before ARP table being update.
> Is that correct?
>
Wow. Yes. Bug Alert.
> Thank you!
>
I think you found a bug introduced through re-ordering the ARP workings.
This bug _may_ have caused the performance loss someone else noted.
The fix is as follows: Move this piece of etharp.c code above the switch
statement (directly above it).
---
/* add or update entries in the ARP cache */
if (for_us) {
/* insert IP address in ARP cache (assume requester wants to talk to
us)
* we might even send out a queued packet to this host */
update_arp_entry(netif, &(hdr->sipaddr), &(hdr->shwaddr),
ARP_INSERT_FLAG);
/* request was not directed to us, but snoop anyway */
} else {
/* update or insert the source IP address in the cache */
update_arp_entry(netif, &(hdr->sipaddr), &(hdr->shwaddr), 0);
/* update or insert the destination IP address pair in the cache */
update_arp_entry(netif, &(hdr->dipaddr), &(hdr->dhwaddr), 0);
}
---
I do not have development tools available here. I'll fix this if no-one
else has, tonight or tomorrow.
Thanks,
Leon.
--
http://www.fastmail.fm - Same, same, but differentÂ…