lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] patch etharp


From: Andreas Becker
Subject: Re: [lwip-users] patch etharp
Date: Mon, 24 Jan 2005 11:58:55 +0100

Hi all, 

second try:
The for_us variable is used to check, if the requested IP matches our IP.

So we schould use an other check, like:

case ARP_REPLY:
    /* ARP reply. We already updated the ARP cache earlier. */
    LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("etharp_arp_input: incoming ARP 
reply\n"));
#if (LWIP_DHCP && DHCP_DOES_ARP_CHECK)
    /* DHCP wants to know about ARP replies to our wanna-have-address */
    if (memcmp(hdr->dhwaddr.addr, ethaddr->addr, netif->hwaddr_len) == 0)  
       dhcp_arp_reply(netif, &sipaddr);
#endif
    break;


Leave all other as it is.
Regards,

> Hi all,
>
> im working on a DHCP extension to make it more RFC2131 compatible and able
> to use DHCP-Reboot. ( Patch comming soon.)
>
> I noticed an wrong behavior, if we do an DHCP_DOES_ARP_CHECK with an
> unconfigured interface. First to assign an IP-number to our interface we
> have to (ARP-)check it. The answer is then "for_us" with an unconfigured
> Interface. But if we have an unconfigured Interface, the ARP-answer will
> not be processed.
>
> So I think it's better to check, if the Ethernet-MAC of the received packet
> matches our MAC-address.
>
> void
> etharp_arp_input(struct netif *netif, struct eth_addr *ethaddr, struct pbuf
> *p)
> {
> ....
>   /* this interface is not configured? */
> #if 0
>   if (netif->ip_addr.addr == 0) {
>     for_us = 0;
>   } else {
>      /* ARP packet directed to us? */
>     for_us = ip_addr_cmp(&dipaddr, &(netif->ip_addr));
>   }
> #else
>   if (memcmp(netif->hwaddr, ethaddr, netif->hwaddr_len) == 0 /*equal*/)
>   {
>     for_us = 1;
>   }
>   else
>   {
>     for_us = 0;
>   }
> #endif
>
>
> 

-- 
MEng Dipl.-Ing.(FH) Andreas Becker
Entwicklung

dSys e.K.
Soeflinger Str. 100
D-89077 Ulm
Tel:  +49.731.151579-1
Fax: +49.731.151579-9
web: www.dsys.de




reply via email to

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