From: Jan Kiszka Date: Wed, 24 Jun 2009 12:42:28 +0000 (+0200) Subject: Revert "User networking: Show active connections" X-Git-Tag: v0.11.0-rc0~266 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=e15f4a992cd8c6fcec42bc00c85c2641a2fbcb14;p=qemu.git Revert "User networking: Show active connections" This reverts commit 1c6ed9f3379faac83da0ed3e95cbd49003ac0dd1. It's redundant to slirp statistics, which are going to be split up / reworked later on. Conflicts: monitor.c net.c Signed-off-by: Jan Kiszka Signed-off-by: Anthony Liguori --- diff --git a/net.c b/net.c index 4ca281759..21cf574d2 100644 --- a/net.c +++ b/net.c @@ -756,45 +756,6 @@ static int net_slirp_init(VLANState *vlan, const char *model, const char *name, return 0; } -static void net_slirp_redir_print(void *opaque, int is_udp, - struct in_addr *laddr, u_int lport, - struct in_addr *faddr, u_int fport) -{ - Monitor *mon = (Monitor *)opaque; - uint32_t h_addr; - uint32_t g_addr; - char buf[16]; - - h_addr = ntohl(faddr->s_addr); - g_addr = ntohl(laddr->s_addr); - - monitor_printf(mon, " %s |", is_udp ? "udp" : "tcp" ); - snprintf(buf, 15, "%d.%d.%d.%d", (h_addr >> 24) & 0xff, - (h_addr >> 16) & 0xff, - (h_addr >> 8) & 0xff, - (h_addr) & 0xff); - monitor_printf(mon, " %15s |", buf); - monitor_printf(mon, " %5d |", fport); - - snprintf(buf, 15, "%d.%d.%d.%d", (g_addr >> 24) & 0xff, - (g_addr >> 16) & 0xff, - (g_addr >> 8) & 0xff, - (g_addr) & 0xff); - monitor_printf(mon, " %15s |", buf); - monitor_printf(mon, " %5d\n", lport); - -} - -static void net_slirp_redir_list(Monitor *mon) -{ - if (!mon) - return; - - monitor_printf(mon, " Prot | Host Addr | HPort | Guest Addr | GPort\n"); - monitor_printf(mon, " | | | | \n"); - slirp_redir_loop(net_slirp_redir_print, mon); -} - static void net_slirp_redir_rm(Monitor *mon, const char *port_str) { int host_port; @@ -904,11 +865,6 @@ void net_slirp_redir(Monitor *mon, const char *redir_str, const char *redir_opt2 return; } - if (!strcmp(redir_str, "list")) { - net_slirp_redir_list(mon); - return; - } - slirp_redirection(mon, redir_str); } diff --git a/qemu-monitor.hx b/qemu-monitor.hx index fa4852728..090255bd2 100644 --- a/qemu-monitor.hx +++ b/qemu-monitor.hx @@ -538,8 +538,7 @@ ETEXI #ifdef CONFIG_SLIRP { "host_net_redir", "ss?", net_slirp_redir, "[tcp|udp]:host-port:[guest-host]:guest-port", "redirect TCP or UDP connections from host to guest (requires -net user)\n" - "host_net_redir remove [tcp:|udp:]host-port -- remove redirection\n" - "host_net_redir list -- show all redirections" }, + "host_net_redir remove [tcp:|udp:]host-port -- remove redirection" }, #endif STEXI @item host_net_redir diff --git a/slirp/libslirp.h b/slirp/libslirp.h index d0df24b2a..c04f3a272 100644 --- a/slirp/libslirp.h +++ b/slirp/libslirp.h @@ -18,10 +18,6 @@ void slirp_input(const uint8_t *pkt, int pkt_len); int slirp_can_output(void); void slirp_output(const uint8_t *pkt, int pkt_len); -void slirp_redir_loop(void (*func)(void *opaque, int is_udp, - struct in_addr *laddr, u_int lport, - struct in_addr *faddr, u_int fport), - void *opaque); int slirp_redir_rm(int is_udp, int host_port); int slirp_redir(int is_udp, int host_port, struct in_addr guest_addr, int guest_port); diff --git a/slirp/slirp.c b/slirp/slirp.c index 30d4ee2d2..b3db74223 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -734,30 +734,6 @@ void if_encap(const uint8_t *ip_data, int ip_data_len) } } -static void _slirp_redir_loop(void (*func)(void *opaque, int is_udp, - struct in_addr *laddr, u_int lport, - struct in_addr *faddr, u_int fport), - void *opaque, int is_udp) -{ - struct socket *head = (is_udp ? &udb : &tcb); - struct socket *so; - - for (so = head->so_next; so != head; so = so->so_next) { - func(opaque, is_udp, - &so->so_laddr, ntohs(so->so_lport), - &so->so_faddr, ntohs(so->so_fport)); - } -} - -void slirp_redir_loop(void (*func)(void *opaque, int is_udp, - struct in_addr *laddr, u_int lport, - struct in_addr *faddr, u_int fport), - void *opaque) -{ - _slirp_redir_loop(func, opaque, 0); - _slirp_redir_loop(func, opaque, 1); -} - /* Unlistens a redirection * * Return value: number of redirs removed */