aboutsummaryrefslogtreecommitdiff
path: root/slirp/tcp_subr.c
diff options
context:
space:
mode:
Diffstat (limited to 'slirp/tcp_subr.c')
-rw-r--r--slirp/tcp_subr.c7
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) {