mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 07:13:54 -06:00
slirp: Handle whole 127.0.0.0/8 network as local addresses.
Changes so translation of remote address to the host's ip address in the virtual network happens for all addresses in the 127.0.0.0/8 network, not just 127.0.0.1. This fixes so that hostfwd bound to addresses such as 127.0.0.2 works. Signed-off-by: Anders Waldenborg <anders@0x63.nu> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
parent
0f66998ff6
commit
648cd33e73
3 changed files with 9 additions and 2 deletions
|
@ -435,8 +435,11 @@ tcp_connect(struct socket *inso)
|
|||
so->so_fport = addr.sin_port;
|
||||
so->so_faddr = addr.sin_addr;
|
||||
/* Translate connections from localhost to the real hostname */
|
||||
if (so->so_faddr.s_addr == 0 || so->so_faddr.s_addr == loopback_addr.s_addr)
|
||||
so->so_faddr = slirp->vhost_addr;
|
||||
if (so->so_faddr.s_addr == 0 ||
|
||||
(so->so_faddr.s_addr & loopback_mask) ==
|
||||
(loopback_addr.s_addr & loopback_mask)) {
|
||||
so->so_faddr = slirp->vhost_addr;
|
||||
}
|
||||
|
||||
/* Close the accept() socket, set right state */
|
||||
if (inso->so_state & SS_FACCEPTONCE) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue