summaryrefslogtreecommitdiff
path: root/nuttx/net/send.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2010-11-27 23:15:39 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2010-11-27 23:15:39 +0000
commit7f5b9991bf8580a9c155dfd42423430c11c62fd8 (patch)
tree3c8ab897b5851ba12934cfca006588767786c474 /nuttx/net/send.c
parent2268aea37d7eca8d6aeeaa6c3f540088329ed3b1 (diff)
downloadpx4-nuttx-7f5b9991bf8580a9c155dfd42423430c11c62fd8.tar.gz
px4-nuttx-7f5b9991bf8580a9c155dfd42423430c11c62fd8.tar.bz2
px4-nuttx-7f5b9991bf8580a9c155dfd42423430c11c62fd8.zip
Fix missing ARP entry problem
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3139 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/net/send.c')
-rw-r--r--nuttx/net/send.c34
1 files changed, 27 insertions, 7 deletions
diff --git a/nuttx/net/send.c b/nuttx/net/send.c
index 480627a14..515c350e4 100644
--- a/nuttx/net/send.c
+++ b/nuttx/net/send.c
@@ -51,6 +51,10 @@
#include <nuttx/clock.h>
#include <net/uip/uip-arch.h>
+#ifndef CONFIG_NET_ARP_IPIN
+# include <net/uip/uip-arp.h>
+#endif
+
#include "net_internal.h"
#include "uip/uip_internal.h"
@@ -255,21 +259,37 @@ static uint16_t send_interrupt(struct uip_driver_s *dev, void *pvconn,
nllvdbg("SEND: sndseq %08x->%08x\n", conn->sndseq, seqno);
uip_tcpsetsequence(conn->sndseq, seqno);
- /* Then send that amount of data */
+ /* Then set-up to send that amount of data. (this won't actually
+ * happen until the polling cycle completes).
+ */
uip_send(dev, &pstate->snd_buffer[pstate->snd_sent], sndlen);
- /* And update the amount of data sent (but not necessarily ACKed) */
+ /* Check if the destination IP address is in the ARP table. If not,
+ * then the send won't actually make it out... it will be replaced with
+ * an ARP request.
+ *
+ * NOTE: If we are actually harvesting IP addresses on incomming IP
+ * packets, then this check should be necessary; the MAC mapping should
+ * already be in the ARP table.
+ */
- pstate->snd_sent += sndlen;
- nllvdbg("SEND: acked=%d sent=%d buflen=%d\n",
- pstate->snd_acked, pstate->snd_sent, pstate->snd_buflen);
+#ifndef CONFIG_NET_ARP_IPIN
+ if (uip_arp_find(conn->ripaddr) != NULL)
+#endif
+ {
+ /* Update the amount of data sent (but not necessarily ACKed) */
- /* Update the send time */
+ pstate->snd_sent += sndlen;
+ nllvdbg("SEND: acked=%d sent=%d buflen=%d\n",
+ pstate->snd_acked, pstate->snd_sent, pstate->snd_buflen);
+
+ /* Update the send time */
#if defined(CONFIG_NET_SOCKOPTS) && !defined(CONFIG_DISABLE_CLOCK)
- pstate->snd_time = g_system_timer;
+ pstate->snd_time = g_system_timer;
#endif
+ }
}
/* All data has been send and we are just waiting for ACK or re-tranmist