cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
jonathan.ross
Adventurer
Adventurer
4,230 Views
Registered: ‎05-29-2009

lwIP udp_sendto ARP gratuitous request?

I'm implementing a UDP echo server in raw mode on an ML605 board. When I receive a UDP packet my receive function is called, I can see the received data, and I try to send data back out to the ip address and port I received from. Here's my code:

 

void recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, struct ip_addr *addr, u16_t port)

{

    if (p != NULL) {

        udp_sendto(pcb, p, addr, port);

        pbuf_free(p);

    }

}

 

The problem is that  after the udp_sendto function is called, instead of sending out a UDP packet the FPGA sends a gratuitous ARP request. When I try udp_send instead of udp_sendto it sends the correct packet out, but it broadcasts it to port 0 (I had assumed it would send it to the initiator of the packet the recv function was called to handle).

 

How do I correctly send out a packet?

0 Kudos
1 Reply
jonathan.ross
Adventurer
Adventurer
4,207 Views
Registered: ‎05-29-2009

FYI - udp_send works when you set the remote_ip and remote_port on the PCB to the value at addr and the value of port, respectively. The fact that my code below doesn't work is looking more and more like a bug.
Message Edited by jonathan.ross on 12-10-2009 08:32 AM
0 Kudos