summaryrefslogtreecommitdiff
path: root/net.c
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:46 -0500
commit9c12a6f24d8bfd0e0d81a4a77f515e32d15547c1 (patch)
treea53e06d779f761417aa6ec1325047bfb7c317725 /net.c
parent6dd5ffb661a4aec28c8296b1673abdf280038cf6 (diff)
slirp: Do not allow to remove non-hostfwd sockets
Prevent that the users accidentally shoots down dynamic sockets. This allows to remove looping for removals as there can now only be one match. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'net.c')
-rw-r--r--net.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/net.c b/net.c
index ee321ab47..603e77cae 100644
--- a/net.c
+++ b/net.c
@@ -880,7 +880,7 @@ void net_slirp_hostfwd_remove(Monitor *mon, const char *src_str)
char buf[256] = "";
const char *p = src_str;
int is_udp = 0;
- int n;
+ int err;
if (!slirp_inited) {
monitor_printf(mon, "user mode network stack not in use\n");
@@ -909,10 +909,10 @@ void net_slirp_hostfwd_remove(Monitor *mon, const char *src_str)
host_port = atoi(p);
- n = slirp_remove_hostfwd(is_udp, host_addr, host_port);
+ err = slirp_remove_hostfwd(is_udp, host_addr, host_port);
- monitor_printf(mon, "removed %d host forwarding rules for %s\n", n,
- src_str);
+ monitor_printf(mon, "host forwarding rule for %s %s\n", src_str,
+ err ? "removed" : "not found");
return;
fail_syntax: