Bug 1700 - Ipv6RawSocket does not honor the bound address when sending packets

This commit is contained in:
Tommaso Pecorella
2013-06-16 08:58:39 +02:00
parent 88e80b4b9f
commit 8fcd718f03
3 changed files with 11 additions and 2 deletions

View File

@@ -25,11 +25,13 @@ New user-visible features
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
------------

View File

@@ -244,7 +244,14 @@ int Ipv6RawSocketImpl::SendTo (Ptr<Packet> p, uint32_t flags, const Address& toA
}
}
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 ();
}

View File

@@ -121,7 +121,7 @@ void Ipv6RawSocketImplTest::ReceivePkt2 (Ptr<Socket> socket)
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