< Previous by Date Date Index Next by Date >
< Previous in Thread Thread Index  

Re: [reSIProcate] GenericIPAddress and ipv6


Hi Bjorn,

Thanks!  I have committed this patch.

Regards,
Scott


On Thu, May 8, 2014 at 10:26 AM, Björn Andersson <bjorn.andersson@xxxxxxxxxx> 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@xxxxxxxxxxxxxxx
https://list.resiprocate.org/mailman/listinfo/resiprocate-devel