Hello,
Is the attached patch enough to solve this problem or do you intend to do a
revamp on the functions?
BR
On 28 March 2014 16:51, Joao Pedro Almeida Pereira <[email protected]
> wrote:
> Hello,
> After i sent the email i looked in google and found the bug.
> Hmm, After reading it a looking into the code the only thing that is
> needed is to check the return from connect.
> For my case it solves the problem. But you think that it will bring other
> consequences because the call is non blocking??
>
> BR
>
>
> On 28 March 2014 16:29, Aris Adamantiadis <[email protected]> wrote:
>
>> Hi,
>>
>> I believe your problem is linked to this bug:
>> https://red.libssh.org/issues/101
>>
>> Could your try again with ./samplessh -p 10001 root@::1 ?
>>
>> Regards,
>>
>> Aris
>>
>> Le 28/03/14 16:24, Joao Pedro Almeida Pereira a écrit :
>> > Hello,
>> > Just created a tunnel using the following command:
>> > ssh -4 -L 10001:[::1]:22 root@other_machine -f -N
>> >
>> > using normal ssh on the console i can connect and don't have any
>> problem.
>> > Nevertheless when i try to use the samplessh application:
>> > ./samplessh -p 10001 root@localhost
>> > Connection failed : Connection refused
>> >
>> > Does the library do not support IPv6 over IPv4 tunnels?
>> >
>> > I am using the version 0.6.3 of the lib.
>> >
>> > Thanks
>> >
>> > BR
>> > --
>> > -----
>> > --------
>> > João Pereira
>> >
>> > Email: [email protected] <mailto:[email protected]>
>> > Web: http://www.bluetc.es <http://www.bluetc.es/>
>>
>>
>
>
> --
> --
> -----
> --------
> João Pereira
>
> Email: [email protected]
> Web: http://www.bluetc.es
>
--
--
-----
--------
João Pereira
Email: [email protected]
Web: http://www.bluetc.es
diff --git a/src/connect.c b/src/connect.c
index 5ddd149..1e3800e 100644
--- a/src/connect.c
+++ b/src/connect.c
@@ -382,8 +382,12 @@ socket_t ssh_connect_host_nonblocking(ssh_session session,
const char *host,
continue;
}
- connect(s, itr->ai_addr, itr->ai_addrlen);
- break;
+ rc = connect(s, itr->ai_addr, itr->ai_addrlen);
+ if( rc == 0){
+ break;
+ }
+ SSH_LOG(SSH_LOG_PACKET, "Unable to connect, trying next address!\n");
+
}
freeaddrinfo(ai);