mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
slirp: Bind support for host forwarding rules
Extend the hostfwd rule format so that the user can specify on which host interface qemu should listen for incoming connections. If omitted, binding will takes place against all interfaces. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
f3546deb07
commit
3c6a05803c
11 changed files with 73 additions and 47 deletions
|
@ -586,17 +586,17 @@ sosendto(struct socket *so, struct mbuf *m)
|
|||
}
|
||||
|
||||
/*
|
||||
* XXX This should really be tcp_listen
|
||||
* Listen for incoming TCP connections
|
||||
*/
|
||||
struct socket *
|
||||
solisten(u_int port, u_int32_t laddr, u_int lport, int flags)
|
||||
tcp_listen(u_int32_t haddr, u_int hport, u_int32_t laddr, u_int lport, int flags)
|
||||
{
|
||||
struct sockaddr_in addr;
|
||||
struct socket *so;
|
||||
int s, opt = 1;
|
||||
socklen_t addrlen = sizeof(addr);
|
||||
|
||||
DEBUG_CALL("solisten");
|
||||
DEBUG_CALL("tcp_listen");
|
||||
DEBUG_ARG("port = %d", port);
|
||||
DEBUG_ARG("laddr = %x", laddr);
|
||||
DEBUG_ARG("lport = %d", lport);
|
||||
|
@ -625,8 +625,8 @@ solisten(u_int port, u_int32_t laddr, u_int lport, int flags)
|
|||
so->so_laddr.s_addr = laddr; /* Ditto */
|
||||
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_addr.s_addr = INADDR_ANY;
|
||||
addr.sin_port = port;
|
||||
addr.sin_addr.s_addr = haddr;
|
||||
addr.sin_port = hport;
|
||||
|
||||
if (((s = socket(AF_INET,SOCK_STREAM,0)) < 0) ||
|
||||
(setsockopt(s,SOL_SOCKET,SO_REUSEADDR,(char *)&opt,sizeof(int)) < 0) ||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue