aboutsummaryrefslogtreecommitdiff
path: root/udp.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
commit1b4a91fe675c59d22e95b67b91603801e8bbe71f (patch)
treea64a380e0749009734d4bac8a6e1b14590d0324d /udp.c
parent0bca327c21750001cd21562743dc4d92eb00feb6 (diff)
downloadslirp-1b4a91fe675c59d22e95b67b91603801e8bbe71f.zip
slirp-1b4a91fe675c59d22e95b67b91603801e8bbe71f.tar.gz
slirp-1b4a91fe675c59d22e95b67b91603801e8bbe71f.tar.bz2
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 'udp.c')
-rw-r--r--udp.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/udp.c b/udp.c
index 38f3f55..2bceb08 100644
--- a/udp.c
+++ b/udp.c
@@ -48,6 +48,14 @@ void udp_init(Slirp *slirp)
slirp->udb.so_next = slirp->udb.so_prev = &slirp->udb;
slirp->udp_last_so = &slirp->udb;
}
+
+void udp_cleanup(Slirp *slirp)
+{
+ while (slirp->udb.so_next != &slirp->udb) {
+ udp_detach(slirp->udb.so_next);
+ }
+}
+
/* m->m_data points at ip packet header
* m->m_len length ip packet
* ip->ip_len length data (IPDU)