Author Topic: bug fixed in ARPIsResolved()  (Read 3399 times)

Jean-Marc DELPRAT

  • Sr. Member
  • ****
  • Posts: 36
    • View Profile
bug fixed in ARPIsResolved()
« on: August 01, 2005, 07:31:08 AM »
This bug only appears when the stack is used in CLIENT mode.
And when more than one distant computer has to be contacted in turn.

conditions :

when connecting to a distant computer, ARPIsResolved() would wrongly return TRUE if the gateway macadress had been resolved before !!!

note: thanks to the marvel of TCPIP the gateway would redirect all the messages to the right destination, but this is not the correct way !!!

here is the fixed ARPIsResolved() routine :

BOOL ARPIsResolved(IP_ADDR *IPAddr, MAC_ADDR *MACAddr)
{
//    if ( (Cache.IPAddr.Val == IPAddr->Val) ||            //$$$ JMD bug fix 01/08/05
//         (Cache.IPAddr.v[0] == MY_GATE_BYTE1 &&         // why compare also
//          Cache.IPAddr.v[1] == MY_GATE_BYTE2 &&         // with the gateway ????
//          Cache.IPAddr.v[2] == MY_GATE_BYTE3 &&
//          Cache.IPAddr.v[3] == MY_GATE_BYTE4) )

    if (Cache.IPAddr.Val == IPAddr->Val) {                             // fixed comparison
        *MACAddr = Cache.MACAddr;
        return TRUE;
    }
    return FALSE;
}


If someone knows why there was a "hard" test with the Gateway adress, please explain me !

regards,
JMD

Administrator

  • Hero Member
  • *****
  • Posts: 171
    • View Profile
    • http://www.modtronix.com
Re: bug fixed in ARPIsResolved()
« Reply #1 on: August 04, 2005, 10:13:17 PM »
Hello Jean-Marc

Thanks a lot for the bug report and fix. I will check the code, and work your modifications into the next version. If you have made any other bug fixes, please post them on this forum seeing that all suggestions and fixes will be worked into the next stack release.

Regards,
David
*** Modtronix Engineering Support ***

sparkcatcher

  • Sr. Member
  • ****
  • Posts: 31
    • View Profile
Re: bug fixed in ARPIsResolved()
« Reply #2 on: December 13, 2007, 07:48:48 PM »
This is just to update this old post.

The original code appears to be correct. 

If the ARP request is for an IP address not on the local network, the ARP request goes through the gateway to the Internet, the arp response will come back to the board from the gateway, and so the remote address in that response packet will be that of the gateway and not that of the original remote IP address.  The remote MAC address will however be the MAC address associated with the originally requested remote IP address.


sparckcatcher,

certeza

  • Sr. Member
  • ****
  • Posts: 31
    • View Profile
Re: bug fixed in ARPIsResolved()
« Reply #3 on: December 16, 2007, 12:17:20 AM »
If I am not mistaken the Modtronix firmware is based on Microchip Stack version 3.75.
If you check the latest version from Microchip (4.18) you will find that a lot of issues like
this one have been solved.

I think it's time for Modtronix to sync their firmware with the latest Microchip version or
at least version 4.16.