lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fw: [lwip-users] ARP problem (CONFIRMED 0.7.0 BUG)


From: stephen
Subject: Fw: [lwip-users] ARP problem (CONFIRMED 0.7.0 BUG)
Date: Thu, 5 Feb 2004 09:33:49 +0800

Mr. Woestenberg

    Thank you for fixing it.
    Another behavior in etharp.c is that when a ARP packet not for us was
received.
    lwIP will update two arp entry :
        1. update_arp_entry(netif, &(hdr->sipaddr), &(hdr->shwaddr), 0);
        2. update_arp_entry(netif, &(hdr->dipaddr), &(hdr->dhwaddr), 0);
    The hdr->dhwaddr is usually 00:00:00:00:00:00 in an ARP Request packet.
    So, should we avoid updating destination address in the ARP request?
    Or this actually do no harm to the address resolution protocol.
    Thank you!

Best Regards,
Stephen Chen


----- Original Message -----
From: "Leon Woestenberg" <address@hidden>
To: "Mailing list for lwIP users" <address@hidden>
Sent: Wednesday, February 04, 2004 10:25 PM
Subject: Re: [lwip-users] ARP problem (CONFIRMED 0.7.0 BUG)


>
> 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.
>
>
> _______________________________________________
> lwip-users mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/lwip-users





reply via email to

[Prev in Thread] Current Thread [Next in Thread]