[ofw][patch][WinVerbs tests] Re: fix IPv6 related connection problem
Leonid Keller
leonid at mellanox.co.il
Thu Mar 5 02:59:44 PST 2009
You are welcome.
The code, that gets connections in the server part of all the tests used
to bind to the first protocol, supported.
for (t = res; t; t = t->ai_next) {
sockfd = socket(t->ai_family, t->ai_socktype,
t->ai_protocol);
if (sockfd != INVALID_SOCKET) {
if (!bind(sockfd, t->ai_addr, t->ai_addrlen))
break;
closesocket(sockfd);
sockfd = INVALID_SOCKET;
}
}
On Vista, the first protocol is usually IPv6 and the server part of the
test binds itself to Ipv6 and is waiting for IPv6 address.
When you run a client with - as usually - IPv4 server address, the
client fails to make the connection to the server.
If you run the client with IPv6 address of the server, all is OK.
It is not too comfortable.
We'd like to have a possibility to use both IPv4 and IPv6 addresses.
The patch reaches that by setting a socket option to accept (in IPv6
socket) also IPv4 addresses:
for (t = res; t; t = t->ai_next) {
sockfd = socket(t->ai_family, t->ai_socktype,
t->ai_protocol);
if (sockfd != INVALID_SOCKET) {
/**/ n = 0;
/**/ setsockopt(sockfd,IPPROTO_IPV6,IPV6_V6ONLY,(char
*) &n, sizeof n);
if (!bind(sockfd, t->ai_addr, t->ai_addrlen))
break;
closesocket(sockfd);
sockfd = INVALID_SOCKET;
}
}
If the first protocol is IPv4, it won't hurt.
BTW, Sean, you've removed some common code into a separate module.
May be it's worth to add there also the connection handling code ?
(At least, pp_server_connect and pp_client_connect)
> -----Original Message-----
> From: Sean Hefty [mailto:sean.hefty at intel.com]
> Sent: Tuesday, March 03, 2009 11:39 PM
> To: Leonid Keller
> Cc: ofw at lists.openfabrics.org
> Subject: RE: [ofw][patch][WinVerbs tests] Re: fix IPv6
> related connection problem
>
> We got sidetracked for so long on the time stamping issue,
> can you explain the
> IPv6 problem being fixed again?
>
> - Sean
>
>
More information about the ofw
mailing list