I’ve instrumented my software to send UDP debugging packets to a remote computer to capture.
I’ve not been receiving a number of packets sent.
I wait until I have an IP address from DHCP before I attempt to send it.
What I found by tracing thru the IP code is that your IP code checks the destination address with its ARP table. If it not found … does not get sent.
That FIRST msg – establishes an entry into the ARP table. … That message is dropped.
Several of my messages are being sent before your IP has acquired an ARP reply. All messages sent prior to acquiring an ARP reply are disgarded.
That process is OK for the stack … but for me, it causes issues as debug packets are not being received.
Does a capability exist to ask the IP stack to acquire an ARP response for an IP address and then a way to verify that the response has been acquired?
If NOT, I will need to implement one. The current behavior is terrible as packets are just being dropped. I would rather issue an ARP IP request, poll for acquisition, and then send my debug packets.
I wrote my own version of checking the ARP table. It does return a MAC. It returns 0 id IP address is in the ARP table, 1 if NOT, 2 if in table but MAC not acquired.
If I get a 1 … not in table – I just issue a dummy UDP message – which will kick off the ARP process. I tthen wait for ARP to acquire the MAC.
Works great … all my debug messages are now getting transmitted.
while(1)
{
r = CheckIP_InARPTable(DestinationAddress.sin_addr);
if(r == 1) // not in ARP table
Send_Dummy_MSG_To_Load_ARP_Table(S, &DestinationAddress);
if(r == 0)
break;
vTaskDelay(2); // 2 time tics
}
I’ve instrumented my software to send UDP debugging packets to a remote computer to capture.
There are some file in FreeRTOS+TCP that does this too, and FreeRTOS_printf() and FreeRTOS_debugprintf() can be defined to use the UDP logging.
What I found by tracing thru the IP code is that your IP code checks the destination address with its ARP table. If it not found … does not get sent.
Correct, if it is not in the ARP table it does not know where to send it, so there is no possibility to send the packet. Either an ARP will get sent in its place, or if an ARP is already outstanding for the IP address, the UDP packet will get dropped.
Does a capability exist to ask the IP stack to acquire an ARP response for an IP address and then a way to verify that the response has been acquired?
If you want to know that ARP has completed before sending your UDP data you can send a ping request to the remote address first. One of the UDP echo examples does just that (from memory).
The current behavior is terrible as packets are just being dropped.
It is valid behaviour for UDP - especially if the stack has no possibility to send data because an ARP reply is never received. If you don’t want packets to be dropped use TCP.
Question … I use buffer allocation #1. Does the stack automatically release THAT buffer?
There should be no difference in how the buffer is freed again (zero copy or non zero copy).