Hi Stephen,
As suggested by you, I tried following things for IPv4 only but still facing
the issue.
1) char address[INET_ADDRSTRLEN+1] = "10.65.156.197";
2) int socket_desc = socket (AF_INET, SOCK_STREAM, 0);
if (socket_desc == INVALID_SOCKET)
{
cout << "The error retuned by socket is" << errno << endl;
}
cout << "The socket is created successfully" << endl;
3) struct sockaddr_in addrinfo;
addrinfo.sin_family = AF_INET;
addrinfo.sin_port = htons(80);
inet_pton(AF_INET, address, &(addrinfo.sin_addr.s_addr));
int retval = connect(socket_desc, (struct sockaddr *)&addrinfo, sizeof
(addrinfo));
if (retval != 0)
{
cout << " The error returned by socket connect is" << errno << endl;
}
cout << "The socket is connected successfully" << endl;
4) BIO * conn;
conn = BIO_new_socket(socket_desc,0);
if(!conn)
{
cout << " The Bio_new_socket failed" << endl;
}
5) BIO_set_nbio(conn, 1);
6) int retVal = BIO_do_connect(conn);
if(retVal <= 0)
{
cout << " The Bio_do_connect failed" << endl;
}
After executing the program, I am getting output as :
The socket is created successfully
The socket is connected successfully
Bio_do_connect failed
Now I am not sure what I am missing here due to which it is getting failed
for IPv4 itself. Please suggest. Though I wanted to have API's support for
both IPv4 and IPv6 but situation seems to be complex here. I am not able to
execute SSL API's successfully for both IPv4 and IPv6. I am facing same
error in both the cases.
I would request to please have a look and suggest something.
Thanks
Akanksha Shukla.
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Dr. Stephen Henson
Sent: Thursday, September 29, 2011 11:09 PM
To: [email protected]
Subject: Re: Open SSL API's Support For IPv6.
On Thu, Sep 29, 2011, Akanksha Shukla wrote:
> Hi All,
>
> I tried following things:
>
>
>
> 1) Made socket() system call with AF_INET6 family type.
>
> 2) Made connect() system call to get connected to destination address
> using the socket created above.
>
> 3) Then made call to Bio_new_socket() and passed the connected socket
> descriptor.
>
> 4) Thereafter made call to Bio_set_nbio() and Bio_do_connect() on the
> socket BIO, and this time I got error from the Bio_do_connect() call.
>
>
>
> Though I have added diags if Bio_new_socket() call gets failed. But those
> diags were not getting hit. So, I am assuming that step 1 to step 3 are
> working fine. Problem is coming at the time of Bio_do_connect().
>
>
>
> Now the next questions which come in my mind are:
>
>
>
> 1) Bio_set_nbio() and Bio_do_connect() API's are IPv6 compatible?
>
> 2) If yes, then what am I missing here because of which I am getting
> error from Bio_do_connect() API?
>
> 3) If no, then how can I proceed further because I need to use API
> which are both (IPv6 as well as IPv4) compatible.
>
What error are you getting? Have you tried exactly the same steps with an
IPv4
socket to see if it is a problem with you code and/or not specific to IPv6?
Steve.
--
Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.openssl.org
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [email protected]
Automated List Manager [email protected]