RE: [reSIProcate] IPv6 support bug (win32)
Getnameinfo has diff. params on windows and linux. Gettaddrinfo might be
better, but inet_ntop and inet_pton are built in to DnsUtil so are guarnteed
across all platforms. I'm working on merging your other changes in now.
--Derek
CONFIDENTIALITY NOTICE
This email and any files transmitted with it contains proprietary
information and, unless expressly stated otherwise, all contents and
attachments are confidential. This email is intended for the addressee(s)
only and access by anyone else is unauthorized. If you are not an addressee,
any disclosure, distribution, printing or copying of the contents of this
email or its attachments, or any action taken in reliance on it, is
unauthorized and may be unlawful. If you are not an addressee, please inform
the sender immediately and then delete this email and any copies of it.
Thank you for your co-operation.
> -----Original Message-----
> From: resiprocate-devel-bounces@xxxxxxxxxxxxxxxxxxx [mailto:resiprocate-
> devel-bounces@xxxxxxxxxxxxxxxxxxx] On Behalf Of Livio Torrero
> Sent: Monday, March 21, 2005 1:18 PM
> To: resiprocate-devel@xxxxxxxxxxxxxxxxxxx
> Subject: [reSIProcate] IPv6 support bug (win32)
>
> I found a bug in TransportSelector.cxx that makes the code fail when it is
> compiled under Windows enabling the IPv6 support. On line 491 of
> TransportSelector.cxx the "WinCompat::determineSourceInterface" is
> invoked. This function calls the "GetBestRoute" which only returns IPv4
> addresses. It is possible to fix the bug by simply replacing the
> "WinCompat::determineSourceInterface" invocation with this code:
>
>
> #ifdef USE_IPV6
> Data localAddress = SipStack::getHostAddress();
> Tuple
> tempTuple(localAddress, target.getPort(), target.getType());
> source =
> tempTuple;
> #else
> // will not work on ipv6
> source = WinCompat::determineSourceInterface(target);
> #endif
>
> To make everything work I've also rewritten the SipStack::getHostAddress()
> method:
>
> Data
> SipStack::getHostAddress()
> {
> char hostName[1024], addrA[1024];
> int err = gethostname( hostName, sizeof(hostName) );
> struct addrinfo hints, *results;
> memset(&hints, 0 , sizeof(struct addrinfo));
> #ifdef USE_IPV6
> hints.ai_family = AF_INET6;
> #else
> hints.ai_family = AF_INET;
> #endif
> getaddrinfo(hostName, NULL, &hints, &results);
> getnameinfo(results->ai_addr, results->ai_addrlen, addrA,
> sizeof(addrA), NULL, NI_MAXSERV, NI_NUMERICHOST);
> freeaddrinfo(results);
> Data ret(addrA);
> return ret;
> }
>
> I've also noticed that you often use inet_ntop and inet_pton instead of
> getaddrinfo and getnameinfo. Is there any particular reason for such a
> choice? (I've replaced inet_ntop with getnameinfo everywhere I found it
> in
> the Resiprocate code).
>
>
> Livio Torrero
>
> _________________________________________________________________
> Ricerche online più semplici e veloci con MSN Toolbar!
> http://toolbar.msn.it/
>
> _______________________________________________
> resiprocate-devel mailing list
> resiprocate-devel@xxxxxxxxxxxxxxxxxxx
> https://list.sipfoundry.org/mailman/listinfo/resiprocate-devel