summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-11-21 23:29:14 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-11-21 23:29:14 +0000
commit7a8e90a29697e9e19ba4c27236be2061f8c6b734 (patch)
treeb7a6cc62181646f0718234dbbddd1b7a01701850
parentfcc35e8419c3dbf653c304886a827b52efdab402 (diff)
downloadnuttx-7a8e90a29697e9e19ba4c27236be2061f8c6b734.tar.gz
nuttx-7a8e90a29697e9e19ba4c27236be2061f8c6b734.tar.bz2
nuttx-7a8e90a29697e9e19ba4c27236be2061f8c6b734.zip
Fix leak in socket close
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@394 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r--nuttx/ChangeLog1
-rw-r--r--nuttx/Documentation/NuttX.html17
-rw-r--r--nuttx/TODO3
-rw-r--r--nuttx/net/net-close.c14
-rw-r--r--nuttx/net/net-sockets.c1
5 files changed, 26 insertions, 10 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog
index 6543fbad9..cab2ef203 100644
--- a/nuttx/ChangeLog
+++ b/nuttx/ChangeLog
@@ -233,4 +233,5 @@
* Add strcat() and strncat()
* Integrated uIP micro webserver
* Corrected a serious bug in TCP queue management
+ * Fix leak in socket close logic
diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html
index 2bee653cd..870918360 100644
--- a/nuttx/Documentation/NuttX.html
+++ b/nuttx/Documentation/NuttX.html
@@ -358,14 +358,24 @@ is available that be used to build a NuttX-compatible arm-elf toolchain.</blockq
53272 428 3568 57268 dfb4 nuttx
</pre>
<p><b>DM320 (ARM9)</b>
- This build for the ARM9 target includes a signficant subset of OS
- features, ethernet driver and full TCP/IP, UDP and (minimal) ICMP
- stacks (via uIP). (11/8/07)
+ This build for the ARM9 target includes a significant subset of OS
+ features, a filesystem, Ethernet driver, full TCP/IP, UDP and (minimal)
+ ICMP stacks (via uIP) and a small network test application: (11/8/07,
+ configuration netconfig, examples/nettest)
</p>
<pre>
text data bss dec hex filename
49472 296 3972 53740 d1ec nuttx
</pre>
+<p>
+ Another build for the ARM9 target includes a minimal OS feature
+ set, Ethernet driver, full TCP/IP and (minimal) ICMP stacks, and
+ a small webserver: (11/20/07, configuration uipconfig, examples/uip)
+</p>
+<pre>
+ text data bss dec hex filename
+ 52040 72 4148 56260 dbc4 nuttx
+</pre>
<p><b>87C52</b>
A reduced functionality OS test for the 8052 target requires only
about 18-19Kb:
@@ -694,6 +704,7 @@ Other memory:
* Add strcat() and strncat()
* Integrated uIP micro webserver
* Corrected a serious bug in TCP queue management
+ * Fix leak in socket close logic
</pre></ul>
<table width ="100%">
diff --git a/nuttx/TODO b/nuttx/TODO
index 48f489672..0b8220e00 100644
--- a/nuttx/TODO
+++ b/nuttx/TODO
@@ -31,8 +31,9 @@ o C++ Support
o Network
- Did not implement send() and sendto() timeouts. Option is setable via setsockopt,
but is not implemented.
-- netutils/telnetd (and maybe others) are seriously broken.
+- uIP's netutils/telnetd (and maybe others) are seriously broken.
Need to be re-written to use listen() and accept()
+- uIP's netutils/webserver does not work reliably
- Should implement SOCK_RAW
- accept() and recvfrom() need to return connection address
- Performance Improvements (uIP is not very fast):
diff --git a/nuttx/net/net-close.c b/nuttx/net/net-close.c
index ca28b510b..c06e635d1 100644
--- a/nuttx/net/net-close.c
+++ b/nuttx/net/net-close.c
@@ -79,12 +79,16 @@ int net_close(int sockfd)
goto errout;
}
- /* Perform the close depending on the protocol type */
+ /* Perform uIP side of the close depending on the protocol type */
switch (psock->s_type)
{
case SOCK_STREAM:
- uip_tcpfree(psock->s_conn);
+ {
+ struct uip_conn *conn = psock->s_conn;
+ uip_unlisten(conn);
+ uip_tcpfree(conn);
+ }
break;
#ifdef CONFIG_NET_UDP
@@ -97,11 +101,9 @@ int net_close(int sockfd)
goto errout;
}
- /* Save the protocol type */
-
- psock->s_type = 0;
- psock->s_conn = NULL;
+ /* Then release the socket structure containing the connection */
+ sockfd_release(sockfd);
return OK;
errout:
diff --git a/nuttx/net/net-sockets.c b/nuttx/net/net-sockets.c
index 98f9413bd..8be75def2 100644
--- a/nuttx/net/net-sockets.c
+++ b/nuttx/net/net-sockets.c
@@ -45,6 +45,7 @@
#include <assert.h>
#include <sched.h>
#include <errno.h>
+#include <debug.h>
#include <net/uip/uip.h>
#include <nuttx/net.h>