[reSIProcate] GenericIPAddress and ipv6

Scott Godin sgodin at sipspectrum.com
Tue May 20 11:03:40 CDT 2014


Hi Bjorn,

Thanks!  I have committed this patch.

Regards,
Scott


On Thu, May 8, 2014 at 10:26 AM, Björn Andersson <bjorn.andersson at aastra.com
> wrote:

> If you create a GenericIPAddress from a sockaddr that contains an ipv6
> address, then the ipv6 address will not be fully copied. I've made a
> patch for this:
>
> *** GenericIPAddress.hxx.orig   Thu May  8 16:14:01 2014
> --- GenericIPAddress.hxx        Thu May  8 16:14:52 2014
> *************** struct GenericIPAddress
> *** 26,33 ****
>         {
>         }
>
> !       GenericIPAddress(const sockaddr& addr) : address(addr)
>         {
>         }
>
>         GenericIPAddress(const sockaddr_in& v4) : v4Address(v4)
> --- 26,43 ----
>         {
>         }
>
> !       GenericIPAddress(const sockaddr& addr)
>         {
> + #ifdef IPPROTO_IPV6
> +          if (addr.sa_family == AF_INET6)
> +          {
> +             v6Address = reinterpret_cast<const sockaddr_in6&>(addr);
> +          }
> +          else
> + #endif
> +          {
> +             v4Address = reinterpret_cast<const sockaddr_in&>(addr);
> +          }
>         }
>
>         GenericIPAddress(const sockaddr_in& v4) : v4Address(v4)
>
>
> Best Regards,
> Björn
>
>
> _______________________________________________
> resiprocate-devel mailing list
> resiprocate-devel at resiprocate.org
> https://list.resiprocate.org/mailman/listinfo/resiprocate-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.resiprocate.org/pipermail/resiprocate-devel/attachments/20140520/4a607943/attachment.htm>


More information about the resiprocate-devel mailing list