diff options
author | Anders Waldenborg <anders@0x63.nu> | 2012-07-13 22:54:17 +0200 |
---|---|---|
committer | Jan Kiszka <jan.kiszka@siemens.com> | 2012-08-03 23:31:52 +0200 |
commit | 648cd33e73cbbbf19e278101e6a9e071cb154c05 (patch) | |
tree | fd62d07953885b56d252c9a904f5566b7367cce4 /slirp/tcp_subr.c | |
parent | 0f66998ff6d5d2133b9b08471a44e13b11119e50 (diff) |
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>
Diffstat (limited to 'slirp/tcp_subr.c')
-rw-r--r-- | slirp/tcp_subr.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c index 0a545c41e7..025b374367 100644 --- a/slirp/tcp_subr.c +++ b/slirp/tcp_subr.c @@ -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) { |