summary refs log tree commit diff stats
path: root/slirp/tcp_subr.c
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2012-02-29 19:14:23 +0100
committerJan Kiszka <jan.kiszka@siemens.com>2012-03-13 14:05:49 +0100
commita68adc220603baffc355ecea8865b3ea9707ab00 (patch)
treef2f2c89ddcae603aff1cb0bd44ab169f4d06f4c4 /slirp/tcp_subr.c
parentf37343197708d90f119007ce5ecc2503be9c04c1 (diff)
downloadfocaccia-qemu-a68adc220603baffc355ecea8865b3ea9707ab00.tar.gz
focaccia-qemu-a68adc220603baffc355ecea8865b3ea9707ab00.zip
slirp: Cleanup resources on instance removal
Close & free sockets when shutting down a slirp instance, also release
all buffers.

CC: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Diffstat (limited to 'slirp/tcp_subr.c')
-rw-r--r--slirp/tcp_subr.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c
index 143a2383c8..6f6585a10f 100644
--- a/slirp/tcp_subr.c
+++ b/slirp/tcp_subr.c
@@ -55,6 +55,13 @@ tcp_init(Slirp *slirp)
     slirp->tcp_last_so = &slirp->tcb;
 }
 
+void tcp_cleanup(Slirp *slirp)
+{
+    while (slirp->tcb.so_next != &slirp->tcb) {
+        tcp_close(sototcpcb(slirp->tcb.so_next));
+    }
+}
+
 /*
  * Create template to be used to send tcp packets on a connection.
  * Call after host entry created, fills