Bug 1688 - Routers should advertise themselves from the link-local address

This commit is contained in:
Guowang Shi
2013-06-19 09:10:31 +02:00
parent ffd2a5f0b1
commit 70f2ea6e92
5 changed files with 10 additions and 5 deletions

View File

@@ -30,6 +30,7 @@ Bugs fixed
- Bug 1678 - C++11 compliance problem with std::pair" - Bug 1678 - C++11 compliance problem with std::pair"
- Bug 1683 - IPv6 autoconfigured don't use *infinite* lifetimes - Bug 1683 - IPv6 autoconfigured don't use *infinite* lifetimes
- Bug 1669 - ns-3 should support binding two and three (possibly more) arguments - Bug 1669 - ns-3 should support binding two and three (possibly more) arguments
- Bug 1688 - Routers should advertise themselves from the link-local address
- Bug 1689 - IPv6 shouldn't add a default gateway without checking the Router lifetime - 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 - Bug 1700 - Ipv6RawSocket does not honor the bound address when sending packets
- Bug 1701 - Ipv6StaticRouting: the source address should match the destination scope - Bug 1701 - Ipv6StaticRouting: the source address should match the destination scope

View File

@@ -155,7 +155,7 @@ int main (int argc, char **argv)
Ipv6InterfaceContainer iic2 = ipv6.Assign (ndc2); Ipv6InterfaceContainer iic2 = ipv6.Assign (ndc2);
iic2.SetRouter (0, true); iic2.SetRouter (0, true);
stackHelper.AddHostRouteTo (r1, iic2.GetAddress (1, 1), iic1.GetAddress (2, 1), iic1.GetInterfaceIndex (1)); stackHelper.AddHostRouteTo (r1, iic2.GetAddress (1, 1), iic1.GetAddress (2, 0), iic1.GetInterfaceIndex (1));
Simulator::Schedule (Seconds (0.0), &StackHelper::PrintRoutingTable, &stackHelper, r1); Simulator::Schedule (Seconds (0.0), &StackHelper::PrintRoutingTable, &stackHelper, r1);
Simulator::Schedule (Seconds (3.0), &StackHelper::PrintRoutingTable, &stackHelper, sta1); Simulator::Schedule (Seconds (3.0), &StackHelper::PrintRoutingTable, &stackHelper, sta1);

View File

@@ -88,7 +88,7 @@ void Ipv6InterfaceContainer::SetRouter (uint32_t i, bool router)
{ {
uint32_t other; uint32_t other;
/* assume first global address is index 1 (0 is link-local) */ /* assume first global address is index 1 (0 is link-local) */
Ipv6Address routerAddress = ipv6->GetAddress (m_interfaces[i].second, 1).GetAddress (); Ipv6Address routerAddress = ipv6->GetAddress (m_interfaces[i].second, 0).GetAddress ();
for (other = 0; other < m_interfaces.size (); other++) for (other = 0; other < m_interfaces.size (); other++)
{ {
@@ -109,7 +109,7 @@ void Ipv6InterfaceContainer::SetDefaultRoute (uint32_t i, uint32_t router)
{ {
Ptr<Ipv6> ipv6 = m_interfaces[i].first; Ptr<Ipv6> ipv6 = m_interfaces[i].first;
Ptr<Ipv6> ipv6Router = m_interfaces[router].first; Ptr<Ipv6> ipv6Router = m_interfaces[router].first;
Ipv6Address routerAddress = ipv6Router->GetAddress (m_interfaces[router].second, 1).GetAddress (); Ipv6Address routerAddress = ipv6Router->GetAddress (m_interfaces[router].second, 0).GetAddress ();
Ptr<Ipv6StaticRouting> routing = 0; Ptr<Ipv6StaticRouting> routing = 0;
Ipv6StaticRoutingHelper routingHelper; Ipv6StaticRoutingHelper routingHelper;

View File

@@ -97,6 +97,8 @@ Ipv6StaticRouting::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
void Ipv6StaticRouting::AddHostRouteTo (Ipv6Address dst, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse, uint32_t metric) void Ipv6StaticRouting::AddHostRouteTo (Ipv6Address dst, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse, uint32_t metric)
{ {
NS_LOG_FUNCTION (this << dst << nextHop << interface << prefixToUse << metric); NS_LOG_FUNCTION (this << dst << nextHop << interface << prefixToUse << metric);
NS_ASSERT_MSG(nextHop.IsLinkLocal(), "Ipv6StaticRouting::AddHostRouteTo - Next hop must be link-local");
AddNetworkRouteTo (dst, Ipv6Prefix::GetOnes (), nextHop, interface, prefixToUse, metric); AddNetworkRouteTo (dst, Ipv6Prefix::GetOnes (), nextHop, interface, prefixToUse, metric);
} }
@@ -117,6 +119,8 @@ void Ipv6StaticRouting::AddNetworkRouteTo (Ipv6Address network, Ipv6Prefix netwo
void Ipv6StaticRouting::AddNetworkRouteTo (Ipv6Address network, Ipv6Prefix networkPrefix, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse, uint32_t metric) void Ipv6StaticRouting::AddNetworkRouteTo (Ipv6Address network, Ipv6Prefix networkPrefix, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse, uint32_t metric)
{ {
NS_LOG_FUNCTION (this << network << networkPrefix << nextHop << interface << prefixToUse << metric); NS_LOG_FUNCTION (this << network << networkPrefix << nextHop << interface << prefixToUse << metric);
NS_ASSERT_MSG(nextHop.IsLinkLocal(), "Ipv6StaticRouting::AddNetworkRouteTo - Next hop must be link-local");
Ipv6RoutingTableEntry* route = new Ipv6RoutingTableEntry (); Ipv6RoutingTableEntry* route = new Ipv6RoutingTableEntry ();
*route = Ipv6RoutingTableEntry::CreateNetworkRouteTo (network, networkPrefix, nextHop, interface, prefixToUse); *route = Ipv6RoutingTableEntry::CreateNetworkRouteTo (network, networkPrefix, nextHop, interface, prefixToUse);
m_networkRoutes.push_back (std::make_pair (route, metric)); m_networkRoutes.push_back (std::make_pair (route, metric));

View File

@@ -74,7 +74,7 @@ public:
/** /**
* \brief Add route to host. * \brief Add route to host.
* \param dest destination address * \param dest destination address
* \param nextHop next hop address to route the packet * \param nextHop next hop address to route the packet. Must be a link-local address
* \param interface interface index * \param interface interface index
* \param prefixToUse prefix that should be used for source address for this destination * \param prefixToUse prefix that should be used for source address for this destination
* \param metric metric of route in case of multiple routes to same destination * \param metric metric of route in case of multiple routes to same destination
@@ -103,7 +103,7 @@ public:
* \brief Add route to network. * \brief Add route to network.
* \param network network address * \param network network address
* \param networkPrefix network prefix* * \param networkPrefix network prefix*
* \param nextHop next hop address to route the packet * \param nextHop next hop address to route the packet. Must be a link-local address
* \param interface interface index * \param interface interface index
* \param prefixToUse prefix that should be used for source address for this destination * \param prefixToUse prefix that should be used for source address for this destination
* \param metric metric of route in case of multiple routes to same destination * \param metric metric of route in case of multiple routes to same destination