Author Topic: ARP broadcast problem  (Read 4995 times)

zodd

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
ARP broadcast problem
« on: March 23, 2006, 08:01:47 AM »
Hi,

I try to do an UDP client.. When I send a broadcast and resolve the ARP I allways have mac adress equal to00.00.00.00.00.00

If someone can help me..

Regards
« Last Edit: March 23, 2006, 08:05:39 AM by zodd »

modtro2

  • Administrator
  • Hero Member
  • *****
  • Posts: 564
    • View Profile
Re: ARP broadcast problem
« Reply #1 on: March 27, 2006, 04:55:22 PM »
I think this is when your ARP request has not been resolved. Have you looked at the network traffic with Ethereal (www.ethereal.com) yet?

zodd

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
Re: ARP broadcast problem
« Reply #2 on: March 28, 2006, 01:28:07 AM »
Hi,

I had a look with ethereal.. And I've got the mac adress in the ARP response.. but the stack doesn't resolve it..

Regards

modtro2

  • Administrator
  • Hero Member
  • *****
  • Posts: 564
    • View Profile
Re: ARP broadcast problem
« Reply #3 on: March 28, 2006, 03:22:14 PM »
You have to get the resolved MAC address yourself and insert it into your TCP or UDP packets. Look at the UDP and TCP client examples in the SBC65EC and SBC68EC documentation. See http://www.modtronix.com/products/sbc65ec/websrvr65_v303/mainpage.php?mainpagehtml=examples&mainpageName=

fragnet

  • Jr. Member
  • **
  • Posts: 7
    • View Profile
Re: ARP broadcast problem
« Reply #4 on: August 24, 2006, 12:56:31 PM »
If you put this in your code just before UDPFlush() it will fix the problem. Somewhere in the code the MAC address for the destination ends up with zeros sometimes. There is still a bug that occurs when an ARP is generated for the given IP just after DHCP and there is no reply to the ARP or there was a previous reply so the controller does not generate a new ARP.


//place just after main( )
   NODE_INFO   remoteNode;
       NODE_INFO udpServerNode;



//place just before UDPFlush();
   p->remoteNode.MACAddr.v[0] = udpServerNode.MACAddr.v[0] ;
   p->remoteNode.MACAddr.v[1] = udpServerNode.MACAddr.v[1] ;
   p->remoteNode.MACAddr.v[2] = udpServerNode.MACAddr.v[2] ;
   p->remoteNode.MACAddr.v[3] = udpServerNode.MACAddr.v[3] ;
   p->remoteNode.MACAddr.v[4] = udpServerNode.MACAddr.v[4] ;
   p->remoteNode.MACAddr.v[5] = udpServerNode.MACAddr.v[5] ;

Dan

  • Jr. Member
  • **
  • Posts: 7
    • View Profile
Re: ARP broadcast problem
« Reply #5 on: January 08, 2007, 01:42:27 PM »
Hi everybody

modtro2, I disagree with your option of getting the resolved MAC Address by ourself.

As an example, in the source ex_udp_client2.c, the code is not correct. You have to do the ARPResolve before the call to UDPOpen

see by yourself: line 40 must be inserted is the ARPIsResolved returns true:

00062        case SM_UDP_WAIT_RESOLVE:
00063             //The IP address has been resolved, we now have the MAC address of the
00064             //node at 10.1.0.101
00065             if (ARPIsResolved(&udpServerNode.IPAddr, &udpServerNode.MACAddr)) {
00040                 udpSocketUser = UDPOpen(54123, &udpServerNode, 54124);
00066                 smUdp = SM_UDP_RESOLVED;
00067             }
00068             //If not resolved after 2 seconds, send next request
00069             else {
00070                 if (TickGetDiff8bitSec(tsecArpRequested) >= 2) {
00071                     smUdp = SM_UDP_SEND_ARP;
00072                 }
00073             }
00074             break;

The problem is that the UDPOpen function creates your UDP frame header, with a destination mac address still unknown, so 00:00:00:00:00:00
But if the ARPIsResolved returns true, then you have the destination mac address which corresponds to the server. Doing the call to UDPOpen after will fill the UDP header with the good destination mac address.

Hope this helps

Regards