Bug 1700 - Ipv6RawSocket does not honor the bound address when sending packets
authorTommaso Pecorella <tommaso.pecorella@unifi.it>
Sun, 16 Jun 2013 08:58:39 +0200
changeset 9835 3efac978b3c9
parent 9834 0d35086abaaa
child 9836 d675eb43a62f
Bug 1700 - Ipv6RawSocket does not honor the bound address when sending packets
RELEASE_NOTES
src/internet/model/ipv6-raw-socket-impl.cc
src/internet/test/ipv6-raw-test.cc
--- a/RELEASE_NOTES	Sat Jun 15 15:34:38 2013 -0700
+++ b/RELEASE_NOTES	Sun Jun 16 08:58:39 2013 +0200
@@ -25,11 +25,13 @@
 Bugs fixed
 ----------
 - Bug 1643 - NdiscCache creation and existence checks
+- Bug 1646 - ICMPv6 Redirect are sent from global address instead of link-local
 - Bug 1662 - m_type not set for Ipv6OptionRouterAlertHeader
 - Bug 1678 - C++11 compliance problem with std::pair"
 - Bug 1683 - IPv6 autoconfigured don't use *infinite* lifetimes
 - Bug 1669 - ns-3 should support binding two and three (possibly more) arguments
 - Bug 1689 - IPv6 shouldn't add a default gateway without checking the Router lifetime
+- Bug 1700 - Ipv6RawSocket does not honor the bound address when sending packets
 
 Known issues
 ------------
--- a/src/internet/model/ipv6-raw-socket-impl.cc	Sat Jun 15 15:34:38 2013 -0700
+++ b/src/internet/model/ipv6-raw-socket-impl.cc	Sun Jun 16 08:58:39 2013 +0200
@@ -244,7 +244,14 @@
                 }
             }
 
-          ipv6->Send (p, route->GetSource (), dst, m_protocol, route);
+          if (m_src.IsAny ())
+            {
+              ipv6->Send (p, route->GetSource (), dst, m_protocol, route);
+            }
+          else
+            {
+              ipv6->Send (p, m_src, dst, m_protocol, route);
+            }
           // Return only payload size (as Linux does).
           return p->GetSize () - hdr.GetSerializedSize ();
         }
--- a/src/internet/test/ipv6-raw-test.cc	Sat Jun 15 15:34:38 2013 -0700
+++ b/src/internet/test/ipv6-raw-test.cc	Sun Jun 16 08:58:39 2013 +0200
@@ -121,7 +121,7 @@
   m_receivedPacket2 = socket->RecvFrom (std::numeric_limits<uint32_t>::max (), 0, addr);
   NS_ASSERT (availableData == m_receivedPacket2->GetSize ());
   Inet6SocketAddress v6addr = Inet6SocketAddress::ConvertFrom (addr);
-  NS_TEST_EXPECT_MSG_EQ (v6addr.GetIpv6 (),Ipv6Address ("fe80:0000:0000:0000:0200:00ff:fe00:0003"), "recvfrom");
+  NS_TEST_EXPECT_MSG_EQ (v6addr.GetIpv6 (),Ipv6Address ("2001:0db8:0000:0000:0000:0000:0000:0002"), "recvfrom");
 }
 
 void