From 887d650efe447ce534cc36f92f9c07e25414e8f8 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Mon, 30 Apr 2007 09:08:20 +0300 Subject: [PATCH] Revert 2d6840b9, "Only set the socket protocol family on success." Revert commit 2d6840b9bd9d3a7a45a5ad92b4e98ff7224d6d97. It is causing passive FTP via IPv6 to fail on ftp.funet.fi. ELinks sends PASV and the server says "425 You cannot use PASV on IPv6 connections. Use EPSV instead." [ Backported from commit c0f488251fbb8ffc167cc0643a539dc18f2350c0 in ELinks 0.12.GIT. --KON ] --- src/network/socket.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/network/socket.c b/src/network/socket.c index 57b7cff3f..5b363d701 100644 --- a/src/network/socket.c +++ b/src/network/socket.c @@ -583,23 +583,24 @@ connect_socket(struct socket *csocket, enum connection_state state) * will fail, as we will use it only when it will be successfully * established. At least I hope that noone else will want to do * something else ;-). --pasky */ + /* And in fact we must set it early, because of EINPROGRESS. */ #ifdef CONFIG_IPV6 if (addr.sin6_family == AF_INET6) { + csocket->protocol_family = EL_PF_INET6; if (connect(sock, (struct sockaddr *) &addr, sizeof(struct sockaddr_in6)) == 0) { /* Success */ - csocket->protocol_family = EL_PF_INET6; complete_connect_socket(csocket, NULL, NULL); return; } } else #endif { + csocket->protocol_family = EL_PF_INET; if (connect(sock, (struct sockaddr *) &addr, sizeof(struct sockaddr_in)) == 0) { /* Success */ - csocket->protocol_family = EL_PF_INET; complete_connect_socket(csocket, NULL, NULL); return; }