diff options
author | Matthias Thomae <matthias.thomae@teleca.com> | 2011-08-05 14:13:58 +0200 |
---|---|---|
committer | Matthias Thomae <matthias.thomae@teleca.com> | 2011-08-10 13:49:38 +0200 |
commit | b3a1f0ce7f8bdee02949f7294751949910ae0b8a (patch) | |
tree | 56967609a4c934842efb29ecc70aab07d8852a5a /slirp-android | |
parent | 3fe03a7e7337d1be3a71ca1cb6018666490c7111 (diff) | |
download | external_qemu-b3a1f0ce7f8bdee02949f7294751949910ae0b8a.zip external_qemu-b3a1f0ce7f8bdee02949f7294751949910ae0b8a.tar.gz external_qemu-b3a1f0ce7f8bdee02949f7294751949910ae0b8a.tar.bz2 |
Fix internet connectivity of emulator over proxy
When trying to connect to a host on the internet using a proxy, the
socket address was passed uninitialized to the proxy manager. The
effects were similar to the ones described in Issue 18715. The change
adds the socket address to the proxy manager after it has been
initialized.
Diffstat (limited to 'slirp-android')
-rw-r--r-- | slirp-android/tcp_subr.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/slirp-android/tcp_subr.c b/slirp-android/tcp_subr.c index cfcc3cb..a679013 100644 --- a/slirp-android/tcp_subr.c +++ b/slirp-android/tcp_subr.c @@ -413,6 +413,7 @@ int is_qemu_special_address(unsigned long dst_addr, unsigned long *redir_addr) int tcp_fconnect(struct socket *so) { int ret=0; + int try_proxy = 0; SockAddress sockaddr; unsigned long sock_ip; int sock_port; @@ -518,13 +519,7 @@ int tcp_fconnect(struct socket *so) /* A normal connection - keep the original destination addr/port */ else { - if (!proxy_manager_add(&sockaddr, SOCKET_STREAM, - (ProxyEventFunc) tcp_proxy_event, so)) { - soisfconnecting(so); - so->s = -1; - so->so_state |= SS_PROXIFIED; - return 0; - } + try_proxy = 1; sock_ip = so->so_faddr_ip; /* original dst addr */ sock_port= so->so_faddr_port; /* original dst port */ @@ -536,6 +531,16 @@ int tcp_fconnect(struct socket *so) sock_address_init_inet( &sockaddr, sock_ip, sock_port ); + if (try_proxy) { + if (!proxy_manager_add(&sockaddr, SOCKET_STREAM, + (ProxyEventFunc) tcp_proxy_event, so)) { + soisfconnecting(so); + so->s = -1; + so->so_state |= SS_PROXIFIED; + return 0; + } + } + /* We don't care what port we get */ socket_connect(s, &sockaddr); |