summaryrefslogtreecommitdiff
path: root/nuttx
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-09-29 14:13:04 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-09-29 14:13:04 +0000
commitf31bf9589ae92fde204cdb97e9e57b5a1f11d973 (patch)
tree6aaf796d9badf837309fab85bfcd77e79f3d12d1 /nuttx
parentec22796f1efef9a51fec0061cfdc3d9be81a9df0 (diff)
downloadnuttx-f31bf9589ae92fde204cdb97e9e57b5a1f11d973.tar.gz
nuttx-f31bf9589ae92fde204cdb97e9e57b5a1f11d973.tar.bz2
nuttx-f31bf9589ae92fde204cdb97e9e57b5a1f11d973.zip
Fix problem with ping that prevent ping from going outside local network (Darcy Gong)
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5204 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx')
-rw-r--r--nuttx/ChangeLog3
-rw-r--r--nuttx/configs/shenzhou/README.txt23
-rw-r--r--nuttx/configs/sim/README.txt6
-rw-r--r--nuttx/configs/stm3220g-eval/README.txt29
-rw-r--r--nuttx/configs/stm3220g-eval/nxwm/defconfig14
-rw-r--r--nuttx/configs/stm3240g-eval/README.txt29
-rw-r--r--nuttx/net/uip/uip_icmpping.c157
7 files changed, 143 insertions, 118 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog
index ed9962df0..526c8a335 100644
--- a/nuttx/ChangeLog
+++ b/nuttx/ChangeLog
@@ -3450,3 +3450,6 @@
original configuration had too much stuff turned on. Reducing
stack sizes, some features, and buffer sizes made the
configuration reliable (Reading from the LCD is still disabled).
+ * net/uip/uip_icmpping.c: Fix problem that prevented ping from
+ going outside of local network. Submitted by Darcy Gong
+
diff --git a/nuttx/configs/shenzhou/README.txt b/nuttx/configs/shenzhou/README.txt
index fcc39de74..1f3f254aa 100644
--- a/nuttx/configs/shenzhou/README.txt
+++ b/nuttx/configs/shenzhou/README.txt
@@ -716,11 +716,12 @@ Where <subdir> is one of the following:
nuttx-code/NxWidgets/UnitTests/README.txt
- Here is the quick summary of the build steps:
+ Here is the quick summary of the build steps (Assuming that all of
+ the required packages are available in a directory ~/nuttx-code):
1. Intall the nxwm configuration
- $ cd ~/nuttx/nuttx-code/tools
+ $ cd ~/nuttx-code/tools
$ ./configure.sh shenzhou/nxwm
2. Make the build context (only)
@@ -732,27 +733,27 @@ Where <subdir> is one of the following:
3. Install the nxwm unit test
- $ cd ~/nuttx/nuttx-code/NxWidgets
- $ tools/install.sh ~/nuttx/nuttx-code/apps nxwm
+ $ cd ~/nuttx-code/NxWidgets
+ $ tools/install.sh ~/nuttx-code/apps nxwm
Creating symbolic link
- - To ~/nuttx/nuttx-code/NxWidgets/UnitTests/nxwm
- - At ~/nuttx/nuttx-code/apps/external
+ - To ~/nuttx-code/NxWidgets/UnitTests/nxwm
+ - At ~/nuttx-code/apps/external
4. Build the NxWidgets library
- $ cd ~/nuttx/nuttx-code/NxWidgets/libnxwidgets
- $ make TOPDIR=~/nuttx/nuttx-code
+ $ cd ~/nuttx-code/NxWidgets/libnxwidgets
+ $ make TOPDIR=~/nuttx-code
...
5. Build the NxWM library
- $ cd ~/nuttx/nuttx-code/NxWidgets/nxwm
- $ make TOPDIR=~/nuttx/nuttx-code
+ $ cd ~/nuttx-code/NxWidgets/nxwm
+ $ make TOPDIR=~/nuttx-code
...
6. Built NuttX with the installed unit test as the application
- $ cd ~/nuttx/nuttx-code
+ $ cd ~/nuttx-code
$ make
NOTE: Reading from the LCD is not currently supported by this
diff --git a/nuttx/configs/sim/README.txt b/nuttx/configs/sim/README.txt
index 833ec58dc..b8a921e7f 100644
--- a/nuttx/configs/sim/README.txt
+++ b/nuttx/configs/sim/README.txt
@@ -409,15 +409,15 @@ nxwm
This is a special configuration setup for the NxWM window manager
UnitTest. The NxWM window manager can be found here:
- trunk/NxWidgets/nxwm
+ nuttx-code/NxWidgets/nxwm
The NxWM unit test can be found at:
- trunk/NxWidgets/UnitTests/nxwm
+ nuttx-code/NxWidgets/UnitTests/nxwm
Documentation for installing the NxWM unit test can be found here:
- trunk/NxWidgets/UnitTests/READEM.txt
+ nuttx-code/NxWidgets/UnitTests/READEM.txt
NOTE: There is an issue with running this example under the
simulation. In the default configuration, this example will
diff --git a/nuttx/configs/stm3220g-eval/README.txt b/nuttx/configs/stm3220g-eval/README.txt
index b3b7fd476..89c6b9233 100644
--- a/nuttx/configs/stm3220g-eval/README.txt
+++ b/nuttx/configs/stm3220g-eval/README.txt
@@ -947,21 +947,22 @@ Where <subdir> is one of the following:
This is a special configuration setup for the NxWM window manager
UnitTest. The NxWM window manager can be found here:
- trunk/NxWidgets/nxwm
+ nuttx-code/NxWidgets/nxwm
The NxWM unit test can be found at:
- trunk/NxWidgets/UnitTests/nxwm
+ nuttx-code/NxWidgets/UnitTests/nxwm
Documentation for installing the NxWM unit test can be found here:
- trunk/NxWidgets/UnitTests/README.txt
+ nuttx-code/NxWidgets/UnitTests/README.txt
- Here is the quick summary of the build steps:
+ Here is the quick summary of the build steps (Assuming that all of
+ the required packages are available in a directory ~/nuttx-code):
1. Intall the nxwm configuration
- $ cd ~/nuttx/trunk/nuttx/tools
+ $ cd ~/nuttx-code/nuttx/tools
$ ./configure.sh stm3220g-eval/nxwm
2. Make the build context (only)
@@ -973,27 +974,27 @@ Where <subdir> is one of the following:
3. Install the nxwm unit test
- $ cd ~/nuttx/trunk/NxWidgets
- $ tools/install.sh ~/nuttx/trunk/apps nxwm
+ $ cd ~/nuttx-code/NxWidgets
+ $ tools/install.sh ~/nuttx-code/apps nxwm
Creating symbolic link
- - To ~/nuttx/trunk/NxWidgets/UnitTests/nxwm
- - At ~/nuttx/trunk/apps/external
+ - To ~/nuttx-code/NxWidgets/UnitTests/nxwm
+ - At ~/nuttx-code/apps/external
4. Build the NxWidgets library
- $ cd ~/nuttx/trunk/NxWidgets/libnxwidgets
- $ make TOPDIR=~/nuttx/trunk/nuttx
+ $ cd ~/nuttx-code/NxWidgets/libnxwidgets
+ $ make TOPDIR=~/nuttx-code/nuttx
...
5. Build the NxWM library
- $ cd ~/nuttx/trunk/NxWidgets/nxwm
- $ make TOPDIR=~//nuttx/trunk/nuttx
+ $ cd ~/nuttx-code/NxWidgets/nxwm
+ $ make TOPDIR=~/nuttx-code/nuttx
...
6. Built NuttX with the installed unit test as the application
- $ cd ~/nuttx/trunk/nuttx
+ $ cd ~/nuttx-code/nuttx
$ make
ostest:
diff --git a/nuttx/configs/stm3220g-eval/nxwm/defconfig b/nuttx/configs/stm3220g-eval/nxwm/defconfig
index 7b7028cf8..83c2f4841 100644
--- a/nuttx/configs/stm3220g-eval/nxwm/defconfig
+++ b/nuttx/configs/stm3220g-eval/nxwm/defconfig
@@ -507,7 +507,7 @@ CONFIG_STMPE811_THRESHX=39
CONFIG_STMPE811_THRESHY=51
#
-# USB Device Configuration
+# STM32 USB OTG FS Device Configuration
#
CONFIG_USBDEV=n
CONFIG_USBDEV_ISOCHRONOUS=n
@@ -519,6 +519,18 @@ CONFIG_USBDEV_TRACE=n
CONFIG_USBDEV_TRACE_NRECORDS=128
#
+# STM32 USB OTG FS Host Configuration
+#
+CONFIG_USBHOST=n
+#CONFIG_STM32_OTGFS_RXFIFO_SIZE
+#CONFIG_STM32_OTGFS_NPTXFIFO_SIZE
+#CONFIG_STM32_OTGFS_PTXFIFO_SIZE
+#CONFIG_STM32_OTGFS_DESCSIZE
+CONFIG_STM32_OTGFS_SOFINTR=n
+CONFIG_STM32_USBHOST_REGDEBUG=n
+CONFIG_STM32_USBHOST_PKTDUMP=n
+
+#
# USB Serial Device Configuration
#
CONFIG_PL2303=n
diff --git a/nuttx/configs/stm3240g-eval/README.txt b/nuttx/configs/stm3240g-eval/README.txt
index 75ca1ea77..df98f087d 100644
--- a/nuttx/configs/stm3240g-eval/README.txt
+++ b/nuttx/configs/stm3240g-eval/README.txt
@@ -1226,21 +1226,22 @@ Where <subdir> is one of the following:
This is a special configuration setup for the NxWM window manager
UnitTest. The NxWM window manager can be found here:
- trunk/NxWidgets/nxwm
+ nuttx-code/NxWidgets/nxwm
The NxWM unit test can be found at:
- trunk/NxWidgets/UnitTests/nxwm
+ nuttx-code/NxWidgets/UnitTests/nxwm
Documentation for installing the NxWM unit test can be found here:
- trunk/NxWidgets/UnitTests/README.txt
+ nuttx-code/NxWidgets/UnitTests/README.txt
- Here is the quick summary of the build steps:
+ Here is the quick summary of the build steps (Assuming that all of
+ the required packages are available in a directory ~/nuttx-code):
1. Intall the nxwm configuration
- $ cd ~/nuttx/trunk/nuttx/tools
+ $ cd ~/nuttx-code/nuttx/tools
$ ./configure.sh stm3240g-eval/nxwm
2. Make the build context (only)
@@ -1252,27 +1253,27 @@ Where <subdir> is one of the following:
3. Install the nxwm unit test
- $ cd ~/nuttx/trunk/NxWidgets
- $ tools/install.sh ~/nuttx/trunk/apps nxwm
+ $ cd ~/nuttx-code/NxWidgets
+ $ tools/install.sh ~/nuttx-code/apps nxwm
Creating symbolic link
- - To ~/nuttx/trunk/NxWidgets/UnitTests/nxwm
- - At ~/nuttx/trunk/apps/external
+ - To ~/nuttx-code/NxWidgets/UnitTests/nxwm
+ - At ~/nuttx-code/apps/external
4. Build the NxWidgets library
- $ cd ~/nuttx/trunk/NxWidgets/libnxwidgets
- $ make TOPDIR=~/nuttx/trunk/nuttx
+ $ cd ~/nuttx-code/NxWidgets/libnxwidgets
+ $ make TOPDIR=~/nuttx-code/nuttx
...
5. Build the NxWM library
- $ cd ~/nuttx/trunk/NxWidgets/nxwm
- $ make TOPDIR=~//nuttx/trunk/nuttx
+ $ cd ~/nuttx-code/NxWidgets/nxwm
+ $ make TOPDIR=~/nuttx-code/nuttx
...
6. Built NuttX with the installed unit test as the application
- $ cd ~/nuttx/trunk/nuttx
+ $ cd ~/nuttx-code/nuttx
$ make
ostest:
diff --git a/nuttx/net/uip/uip_icmpping.c b/nuttx/net/uip/uip_icmpping.c
index 356187d09..e3ebf7252 100644
--- a/nuttx/net/uip/uip_icmpping.c
+++ b/nuttx/net/uip/uip_icmpping.c
@@ -148,122 +148,129 @@ static inline int ping_timeout(struct icmp_ping_s *pstate)
****************************************************************************/
static uint16_t ping_interrupt(struct uip_driver_s *dev, void *conn,
- void *pvpriv, uint16_t flags)
+ void *pvpriv, uint16_t flags)
{
struct icmp_ping_s *pstate = (struct icmp_ping_s *)pvpriv;
uint8_t *ptr;
- int failcode = -ETIMEDOUT;
int i;
nllvdbg("flags: %04x\n", flags);
if (pstate)
{
- /* Check if this device is on the same network as the destination device. */
-
- if (!uip_ipaddr_maskcmp(pstate->png_addr, dev->d_ipaddr, dev->d_netmask))
- {
- /* Destination address was not on the local network served by this
- * device. If a timeout occurs, then the most likely reason is
- * that the destination address is not reachable.
- */
+ /* Check if this is a ICMP ECHO reply. If so, return the sequence
+ * number to the caller. NOTE: We may not even have sent the
+ * requested ECHO request; this could have been the delayed ECHO
+ * response from a previous ping.
+ */
- nllvdbg("Not reachable\n");
- failcode = -ENETUNREACH;
- }
- else
+ if ((flags & UIP_ECHOREPLY) != 0 && conn != NULL)
{
- /* Check if this is a ICMP ECHO reply. If so, return the sequence
- * number to the caller. NOTE: We may not even have sent the
- * requested ECHO request; this could have been the delayed ECHO
- * response from a previous ping.
- */
+ struct uip_icmpip_hdr *icmp = (struct uip_icmpip_hdr *)conn;
+ nlldbg("ECHO reply: id=%d seqno=%d\n",
+ ntohs(icmp->id), ntohs(icmp->seqno));
- if ((flags & UIP_ECHOREPLY) != 0 && conn != NULL)
+ if (ntohs(icmp->id) == pstate->png_id)
{
- struct uip_icmpip_hdr *icmp = (struct uip_icmpip_hdr *)conn;
- nlldbg("ECHO reply: id=%d seqno=%d\n", ntohs(icmp->id), ntohs(icmp->seqno));
+ /* Consume the ECHOREPLY */
- if (ntohs(icmp->id) == pstate->png_id)
- {
- /* Consume the ECHOREPLY */
+ flags &= ~UIP_ECHOREPLY;
+ dev->d_len = 0;
- flags &= ~UIP_ECHOREPLY;
- dev->d_len = 0;
+ /* Return the result to the caller */
- /* Return the result to the caller */
-
- pstate->png_result = OK;
- pstate->png_seqno = ntohs(icmp->seqno);
- goto end_wait;
- }
+ pstate->png_result = OK;
+ pstate->png_seqno = ntohs(icmp->seqno);
+ goto end_wait;
}
+ }
- /* Check:
- * If the outgoing packet is available (it may have been claimed
- * by a sendto interrupt serving a different thread
- * -OR-
- * If the output buffer currently contains unprocessed incoming
- * data.
- * -OR-
- * If we have alread sent the ECHO request
- *
- * In the first two cases, we will just have to wait for the next
- * polling cycle.
- */
+ /* Check:
+ * If the outgoing packet is available (it may have been claimed
+ * by a sendto interrupt serving a different thread)
+ * -OR-
+ * If the output buffer currently contains unprocessed incoming
+ * data.
+ * -OR-
+ * If we have alread sent the ECHO request
+ *
+ * In the first two cases, we will just have to wait for the next
+ * polling cycle.
+ */
- if (dev->d_sndlen <= 0 && /* Packet available */
- (flags & UIP_NEWDATA) == 0 && /* No incoming data */
- !pstate->png_sent) /* Request not sent */
- {
- struct uip_icmpip_hdr *picmp = ICMPBUF;
+ if (dev->d_sndlen <= 0 && /* Packet available */
+ (flags & UIP_NEWDATA) == 0 && /* No incoming data */
+ !pstate->png_sent) /* Request not sent */
+ {
+ struct uip_icmpip_hdr *picmp = ICMPBUF;
- /* We can send the ECHO request now.
- *
- * Format the ICMP ECHO request packet
- */
+ /* We can send the ECHO request now.
+ *
+ * Format the ICMP ECHO request packet
+ */
- picmp->type = ICMP_ECHO_REQUEST;
- picmp->icode = 0;
+ picmp->type = ICMP_ECHO_REQUEST;
+ picmp->icode = 0;
#ifndef CONFIG_NET_IPv6
- picmp->id = htons(pstate->png_id);
- picmp->seqno = htons(pstate->png_seqno);
+ picmp->id = htons(pstate->png_id);
+ picmp->seqno = htons(pstate->png_seqno);
#else
# error "IPv6 ECHO Request not implemented"
#endif
- /* Add some easily verifiable data */
+ /* Add some easily verifiable data */
- for (i = 0, ptr = ICMPDAT; i < pstate->png_datlen; i++)
- {
- *ptr++ = i;
- }
+ for (i = 0, ptr = ICMPDAT; i < pstate->png_datlen; i++)
+ {
+ *ptr++ = i;
+ }
- /* Send the ICMP echo request. Note that d_sndlen is set to
- * the size of the ICMP payload and does not include the size
- * of the ICMP header.
- */
+ /* Send the ICMP echo request. Note that d_sndlen is set to
+ * the size of the ICMP payload and does not include the size
+ * of the ICMP header.
+ */
- nlldbg("Send ECHO request: seqno=%d\n", pstate->png_seqno);
+ nlldbg("Send ECHO request: seqno=%d\n", pstate->png_seqno);
- dev->d_sndlen = pstate->png_datlen + 4;
- uip_icmpsend(dev, &pstate->png_addr);
- pstate->png_sent = true;
- return flags;
- }
+ dev->d_sndlen = pstate->png_datlen + 4;
+ uip_icmpsend(dev, &pstate->png_addr);
+ pstate->png_sent = true;
+ return flags;
}
/* Check if the selected timeout has elapsed */
if (ping_timeout(pstate))
{
- /* Yes.. report the timeout */
+ int failcode;
+
+ /* Check if this device is on the same network as the destination
+ * device.
+ */
+
+ if (!uip_ipaddr_maskcmp(pstate->png_addr, dev->d_ipaddr, dev->d_netmask))
+ {
+ /* Destination address was not on the local network served by this
+ * device. If a timeout occurs, then the most likely reason is
+ * that the destination address is not reachable.
+ */
+
+ nlldbg("Not reachable\n");
+ failcode = -ENETUNREACH;
+ }
+ else
+ {
+ nlldbg("Ping timeout\n");
+ failcode = -ETIMEDOUT;
+ }
+
+ /* Report the failure */
- nlldbg("Ping timeout\n");
pstate->png_result = failcode;
goto end_wait;
}
/* Continue waiting */
}
+
return flags;
end_wait: