aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2009-06-24 14:42:29 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-06-29 08:52:45 -0500
commit63c095805f5e355ad599b7134e6c5380a31eb6ee (patch)
tree098ac4a371fbf4572cf03ab272b4524bd27be07d
parent5449e7627641fdede09e6e8585faabbb3d71e198 (diff)
downloadslirp-63c095805f5e355ad599b7134e6c5380a31eb6ee.zip
slirp-63c095805f5e355ad599b7134e6c5380a31eb6ee.tar.gz
slirp-63c095805f5e355ad599b7134e6c5380a31eb6ee.tar.bz2
slirp: Explicitely mark host-forwarding sockets
Mark sockets that describe host forwardings. This is required for their (and only their) proper deletion and for pretty-printing. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r--slirp.c4
-rw-r--r--socket.h1
-rw-r--r--udp.c2
3 files changed, 4 insertions, 3 deletions
diff --git a/slirp.c b/slirp.c
index 33f1031..eb196a1 100644
--- a/slirp.c
+++ b/slirp.c
@@ -794,11 +794,11 @@ int slirp_add_hostfwd(int is_udp, struct in_addr host_addr, int host_port,
}
if (is_udp) {
if (!udp_listen(host_addr.s_addr, htons(host_port), guest_addr.s_addr,
- htons(guest_port), 0))
+ htons(guest_port), SS_HOSTFWD))
return -1;
} else {
if (!tcp_listen(host_addr.s_addr, htons(host_port), guest_addr.s_addr,
- htons(guest_port), 0))
+ htons(guest_port), SS_HOSTFWD))
return -1;
}
return 0;
diff --git a/socket.h b/socket.h
index 07eab1d..7cb9314 100644
--- a/socket.h
+++ b/socket.h
@@ -79,6 +79,7 @@ struct socket {
0x200 /* If set, the SS_FACCEPTCONN socket will die after one accept */
#define SS_PERSISTENT_MASK 0xf000 /* Unremovable state bits */
+#define SS_HOSTFWD 0x1000 /* Socket describes host->guest forwarding */
extern struct socket tcb;
diff --git a/udp.c b/udp.c
index 8527e3e..4c74952 100644
--- a/udp.c
+++ b/udp.c
@@ -661,7 +661,7 @@ struct socket *udp_listen(u_int32_t haddr, u_int hport, u_int32_t laddr,
so->so_expire = 0;
so->so_state &= SS_PERSISTENT_MASK;
- so->so_state |= SS_ISFCONNECTED;
+ so->so_state |= SS_ISFCONNECTED | flags;
return so;
}