Commit 6dd5ffb661a4aec28c8296b1673abdf280038cf6
Committed by
Anthony Liguori
1 parent
f932b6ce
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>
Showing
3 changed files
with
4 additions
and
3 deletions
slirp/slirp.c
| ... | ... | @@ -793,11 +793,11 @@ int slirp_add_hostfwd(int is_udp, struct in_addr host_addr, int host_port, |
| 793 | 793 | } |
| 794 | 794 | if (is_udp) { |
| 795 | 795 | if (!udp_listen(host_addr.s_addr, htons(host_port), guest_addr.s_addr, |
| 796 | - htons(guest_port), 0)) | |
| 796 | + htons(guest_port), SS_HOSTFWD)) | |
| 797 | 797 | return -1; |
| 798 | 798 | } else { |
| 799 | 799 | if (!tcp_listen(host_addr.s_addr, htons(host_port), guest_addr.s_addr, |
| 800 | - htons(guest_port), 0)) | |
| 800 | + htons(guest_port), SS_HOSTFWD)) | |
| 801 | 801 | return -1; |
| 802 | 802 | } |
| 803 | 803 | return 0; | ... | ... |
slirp/socket.h
| ... | ... | @@ -72,6 +72,7 @@ struct socket { |
| 72 | 72 | #define SS_FACCEPTONCE 0x200 /* If set, the SS_FACCEPTCONN socket will die after one accept */ |
| 73 | 73 | |
| 74 | 74 | #define SS_PERSISTENT_MASK 0xf000 /* Unremovable state bits */ |
| 75 | +#define SS_HOSTFWD 0x1000 /* Socket describes host->guest forwarding */ | |
| 75 | 76 | |
| 76 | 77 | extern struct socket tcb; |
| 77 | 78 | ... | ... |
slirp/udp.c
| ... | ... | @@ -667,7 +667,7 @@ udp_listen(u_int32_t haddr, u_int hport, u_int32_t laddr, u_int lport, |
| 667 | 667 | so->so_expire = 0; |
| 668 | 668 | |
| 669 | 669 | so->so_state &= SS_PERSISTENT_MASK; |
| 670 | - so->so_state |= SS_ISFCONNECTED; | |
| 670 | + so->so_state |= SS_ISFCONNECTED | flags; | |
| 671 | 671 | |
| 672 | 672 | return so; |
| 673 | 673 | } | ... | ... |