Bug 1891 - UdpSocketImpl::GetSockName doesn't return the IPv6 address
authorTommaso Pecorella <tommaso.pecorella@unifi.it>
Wed, 26 Mar 2014 23:08:28 +0100
changeset 10681 42d060863f5d
parent 10680 ace43d9baa17
child 10682 20ce79766233
Bug 1891 - UdpSocketImpl::GetSockName doesn't return the IPv6 address
RELEASE_NOTES
src/internet/model/udp-socket-impl.cc
--- a/RELEASE_NOTES	Wed Mar 26 14:51:14 2014 +0400
+++ b/RELEASE_NOTES	Wed Mar 26 23:08:28 2014 +0100
@@ -62,6 +62,7 @@
 - Bug 1882 - int64x64 tests trigger valgrind bug
 - Bug 1883 - IPv6 don't consider the prefix and network when choosing output address
 - Bug 1887 - Point-to-point traces should contain PPP headers
+- Bug 1891 - UdpSocketImpl::GetSockName doesn't return the IPv6 address
 
 Release 3.19
 =============
--- a/src/internet/model/udp-socket-impl.cc	Wed Mar 26 14:51:14 2014 +0400
+++ b/src/internet/model/udp-socket-impl.cc	Wed Mar 26 23:08:28 2014 +0100
@@ -872,10 +872,14 @@
     {
       address = InetSocketAddress (m_endPoint->GetLocalAddress (), m_endPoint->GetLocalPort ());
     }
-  else
+  else if (m_endPoint6 != 0)
     {
-      // It is possible to call this method on a socket without a name
+      address = Inet6SocketAddress (m_endPoint6->GetLocalAddress (), m_endPoint6->GetLocalPort ());
+    }
+  else
+    { // It is possible to call this method on a socket without a name
       // in which case, behavior is unspecified
+      // Should this return an InetSocketAddress or an Inet6SocketAddress?
       address = InetSocketAddress (Ipv4Address::GetZero (), 0);
     }
   return 0;