If CONFIG_NET_ARP_SEND is enabled, then all ICMP, TCP, and UDP send operations will call arp_send() before attempting the real send operation. arp_send() will check if the the IP address mapping is in the ARP table and, if not send ARP requests periodically until it is. This eliminates losing the first outgoing message because there is not mapping in the ARP table.

This commit is contained in:
Gregory Nutt
2014-08-18 16:22:14 -06:00
parent 7f862bd381
commit 6e04518e4a
5 changed files with 98 additions and 12 deletions
+13
View File
@@ -58,6 +58,7 @@
#include "netdev/netdev.h"
#include "devif/devif.h"
#include "arp/arp.h"
#include "icmp/icmp.h"
/****************************************************************************
@@ -331,6 +332,18 @@ int icmp_ping(net_ipaddr_t addr, uint16_t id, uint16_t seqno,
{
struct icmp_ping_s state;
net_lock_t save;
#ifdef CONFIG_NET_ARP_SEND
int ret;
/* Make sure that the IP address mapping is in the ARP table */
ret = arp_send(addr);
if (ret < 0)
{
ndbg("ERROR: Not reachable\n");
return -ENETUNREACH;
}
#endif
/* Initialize the state structure */