Commit e15f4a992cd8c6fcec42bc00c85c2641a2fbcb14
Committed by
Anthony Liguori
1 parent
b35725c5
Revert "User networking: Show active connections"
This reverts commit 1c6ed9f3. 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 <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Showing
4 changed files
with
1 additions
and
74 deletions
net.c
| @@ -756,45 +756,6 @@ static int net_slirp_init(VLANState *vlan, const char *model, const char *name, | @@ -756,45 +756,6 @@ static int net_slirp_init(VLANState *vlan, const char *model, const char *name, | ||
| 756 | return 0; | 756 | return 0; |
| 757 | } | 757 | } |
| 758 | 758 | ||
| 759 | -static void net_slirp_redir_print(void *opaque, int is_udp, | ||
| 760 | - struct in_addr *laddr, u_int lport, | ||
| 761 | - struct in_addr *faddr, u_int fport) | ||
| 762 | -{ | ||
| 763 | - Monitor *mon = (Monitor *)opaque; | ||
| 764 | - uint32_t h_addr; | ||
| 765 | - uint32_t g_addr; | ||
| 766 | - char buf[16]; | ||
| 767 | - | ||
| 768 | - h_addr = ntohl(faddr->s_addr); | ||
| 769 | - g_addr = ntohl(laddr->s_addr); | ||
| 770 | - | ||
| 771 | - monitor_printf(mon, " %s |", is_udp ? "udp" : "tcp" ); | ||
| 772 | - snprintf(buf, 15, "%d.%d.%d.%d", (h_addr >> 24) & 0xff, | ||
| 773 | - (h_addr >> 16) & 0xff, | ||
| 774 | - (h_addr >> 8) & 0xff, | ||
| 775 | - (h_addr) & 0xff); | ||
| 776 | - monitor_printf(mon, " %15s |", buf); | ||
| 777 | - monitor_printf(mon, " %5d |", fport); | ||
| 778 | - | ||
| 779 | - snprintf(buf, 15, "%d.%d.%d.%d", (g_addr >> 24) & 0xff, | ||
| 780 | - (g_addr >> 16) & 0xff, | ||
| 781 | - (g_addr >> 8) & 0xff, | ||
| 782 | - (g_addr) & 0xff); | ||
| 783 | - monitor_printf(mon, " %15s |", buf); | ||
| 784 | - monitor_printf(mon, " %5d\n", lport); | ||
| 785 | - | ||
| 786 | -} | ||
| 787 | - | ||
| 788 | -static void net_slirp_redir_list(Monitor *mon) | ||
| 789 | -{ | ||
| 790 | - if (!mon) | ||
| 791 | - return; | ||
| 792 | - | ||
| 793 | - monitor_printf(mon, " Prot | Host Addr | HPort | Guest Addr | GPort\n"); | ||
| 794 | - monitor_printf(mon, " | | | | \n"); | ||
| 795 | - slirp_redir_loop(net_slirp_redir_print, mon); | ||
| 796 | -} | ||
| 797 | - | ||
| 798 | static void net_slirp_redir_rm(Monitor *mon, const char *port_str) | 759 | static void net_slirp_redir_rm(Monitor *mon, const char *port_str) |
| 799 | { | 760 | { |
| 800 | int host_port; | 761 | int host_port; |
| @@ -904,11 +865,6 @@ void net_slirp_redir(Monitor *mon, const char *redir_str, const char *redir_opt2 | @@ -904,11 +865,6 @@ void net_slirp_redir(Monitor *mon, const char *redir_str, const char *redir_opt2 | ||
| 904 | return; | 865 | return; |
| 905 | } | 866 | } |
| 906 | 867 | ||
| 907 | - if (!strcmp(redir_str, "list")) { | ||
| 908 | - net_slirp_redir_list(mon); | ||
| 909 | - return; | ||
| 910 | - } | ||
| 911 | - | ||
| 912 | slirp_redirection(mon, redir_str); | 868 | slirp_redirection(mon, redir_str); |
| 913 | } | 869 | } |
| 914 | 870 |
qemu-monitor.hx
| @@ -538,8 +538,7 @@ ETEXI | @@ -538,8 +538,7 @@ ETEXI | ||
| 538 | #ifdef CONFIG_SLIRP | 538 | #ifdef CONFIG_SLIRP |
| 539 | { "host_net_redir", "ss?", net_slirp_redir, | 539 | { "host_net_redir", "ss?", net_slirp_redir, |
| 540 | "[tcp|udp]:host-port:[guest-host]:guest-port", "redirect TCP or UDP connections from host to guest (requires -net user)\n" | 540 | "[tcp|udp]:host-port:[guest-host]:guest-port", "redirect TCP or UDP connections from host to guest (requires -net user)\n" |
| 541 | - "host_net_redir remove [tcp:|udp:]host-port -- remove redirection\n" | ||
| 542 | - "host_net_redir list -- show all redirections" }, | 541 | + "host_net_redir remove [tcp:|udp:]host-port -- remove redirection" }, |
| 543 | #endif | 542 | #endif |
| 544 | STEXI | 543 | STEXI |
| 545 | @item host_net_redir | 544 | @item host_net_redir |
slirp/libslirp.h
| @@ -18,10 +18,6 @@ void slirp_input(const uint8_t *pkt, int pkt_len); | @@ -18,10 +18,6 @@ void slirp_input(const uint8_t *pkt, int pkt_len); | ||
| 18 | int slirp_can_output(void); | 18 | int slirp_can_output(void); |
| 19 | void slirp_output(const uint8_t *pkt, int pkt_len); | 19 | void slirp_output(const uint8_t *pkt, int pkt_len); |
| 20 | 20 | ||
| 21 | -void slirp_redir_loop(void (*func)(void *opaque, int is_udp, | ||
| 22 | - struct in_addr *laddr, u_int lport, | ||
| 23 | - struct in_addr *faddr, u_int fport), | ||
| 24 | - void *opaque); | ||
| 25 | int slirp_redir_rm(int is_udp, int host_port); | 21 | int slirp_redir_rm(int is_udp, int host_port); |
| 26 | int slirp_redir(int is_udp, int host_port, | 22 | int slirp_redir(int is_udp, int host_port, |
| 27 | struct in_addr guest_addr, int guest_port); | 23 | struct in_addr guest_addr, int guest_port); |
slirp/slirp.c
| @@ -734,30 +734,6 @@ void if_encap(const uint8_t *ip_data, int ip_data_len) | @@ -734,30 +734,6 @@ void if_encap(const uint8_t *ip_data, int ip_data_len) | ||
| 734 | } | 734 | } |
| 735 | } | 735 | } |
| 736 | 736 | ||
| 737 | -static void _slirp_redir_loop(void (*func)(void *opaque, int is_udp, | ||
| 738 | - struct in_addr *laddr, u_int lport, | ||
| 739 | - struct in_addr *faddr, u_int fport), | ||
| 740 | - void *opaque, int is_udp) | ||
| 741 | -{ | ||
| 742 | - struct socket *head = (is_udp ? &udb : &tcb); | ||
| 743 | - struct socket *so; | ||
| 744 | - | ||
| 745 | - for (so = head->so_next; so != head; so = so->so_next) { | ||
| 746 | - func(opaque, is_udp, | ||
| 747 | - &so->so_laddr, ntohs(so->so_lport), | ||
| 748 | - &so->so_faddr, ntohs(so->so_fport)); | ||
| 749 | - } | ||
| 750 | -} | ||
| 751 | - | ||
| 752 | -void slirp_redir_loop(void (*func)(void *opaque, int is_udp, | ||
| 753 | - struct in_addr *laddr, u_int lport, | ||
| 754 | - struct in_addr *faddr, u_int fport), | ||
| 755 | - void *opaque) | ||
| 756 | -{ | ||
| 757 | - _slirp_redir_loop(func, opaque, 0); | ||
| 758 | - _slirp_redir_loop(func, opaque, 1); | ||
| 759 | -} | ||
| 760 | - | ||
| 761 | /* Unlistens a redirection | 737 | /* Unlistens a redirection |
| 762 | * | 738 | * |
| 763 | * Return value: number of redirs removed */ | 739 | * Return value: number of redirs removed */ |