Bug 1821 - Setting an interface to Down state will cause various asserts in IPv6
This commit is contained in:
@@ -29,6 +29,7 @@ New user-visible features
|
||||
|
||||
Bugs fixed
|
||||
----------
|
||||
- Bug 1821 - Setting an interface to Down state will cause various asserts in IPv6
|
||||
|
||||
|
||||
Release 3.19
|
||||
|
||||
@@ -627,17 +627,16 @@ Ipv4StaticRouting::NotifyInterfaceDown (uint32_t i)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << i);
|
||||
// Remove all static routes that are going through this interface
|
||||
uint32_t j = 0;
|
||||
while (j < GetNRoutes ())
|
||||
for (NetworkRoutesI it = m_networkRoutes.begin (); it != m_networkRoutes.end (); )
|
||||
{
|
||||
Ipv4RoutingTableEntry route = GetRoute (j);
|
||||
if (route.GetInterface () == i)
|
||||
if (it->first->GetInterface () == i)
|
||||
{
|
||||
RemoveRoute (j);
|
||||
delete it->first;
|
||||
it = m_networkRoutes.erase (it);
|
||||
}
|
||||
else
|
||||
{
|
||||
j++;
|
||||
it++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -672,15 +671,19 @@ Ipv4StaticRouting::NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress
|
||||
Ipv4Mask networkMask = address.GetMask ();
|
||||
// Remove all static routes that are going through this interface
|
||||
// which reference this network
|
||||
for (uint32_t j = 0; j < GetNRoutes (); j++)
|
||||
for (NetworkRoutesI it = m_networkRoutes.begin (); it != m_networkRoutes.end (); )
|
||||
{
|
||||
Ipv4RoutingTableEntry route = GetRoute (j);
|
||||
if (route.GetInterface () == interface &&
|
||||
route.IsNetwork () &&
|
||||
route.GetDestNetwork () == networkAddress &&
|
||||
route.GetDestNetworkMask () == networkMask)
|
||||
if (it->first->GetInterface () == interface
|
||||
&& it->first->IsNetwork ()
|
||||
&& it->first->GetDestNetwork () == networkAddress
|
||||
&& it->first->GetDestNetworkMask () == networkMask)
|
||||
{
|
||||
RemoveRoute (j);
|
||||
delete it->first;
|
||||
it = m_networkRoutes.erase (it);
|
||||
}
|
||||
else
|
||||
{
|
||||
it++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,6 +183,7 @@ void Ipv6Interface::SetDown ()
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
m_ifup = false;
|
||||
m_addresses.clear ();
|
||||
m_ndCache->Flush ();
|
||||
}
|
||||
|
||||
bool Ipv6Interface::IsForwarding () const
|
||||
|
||||
@@ -684,21 +684,18 @@ void Ipv6StaticRouting::NotifyInterfaceUp (uint32_t i)
|
||||
void Ipv6StaticRouting::NotifyInterfaceDown (uint32_t i)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << i);
|
||||
uint32_t j = 0;
|
||||
uint32_t max = GetNRoutes ();
|
||||
|
||||
/* remove all static routes that are going through this interface */
|
||||
while (j < max)
|
||||
for (NetworkRoutesI it = m_networkRoutes.begin (); it != m_networkRoutes.end (); )
|
||||
{
|
||||
Ipv6RoutingTableEntry route = GetRoute (j);
|
||||
|
||||
if (route.GetInterface () == i)
|
||||
if (it->first->GetInterface () == i)
|
||||
{
|
||||
RemoveRoute (j);
|
||||
delete it->first;
|
||||
it = m_networkRoutes.erase (it);
|
||||
}
|
||||
else
|
||||
{
|
||||
j++;
|
||||
it++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -731,16 +728,19 @@ void Ipv6StaticRouting::NotifyRemoveAddress (uint32_t interface, Ipv6InterfaceAd
|
||||
|
||||
// Remove all static routes that are going through this interface
|
||||
// which reference this network
|
||||
for (uint32_t j = 0; j < GetNRoutes (); j++)
|
||||
for (NetworkRoutesI it = m_networkRoutes.begin (); it != m_networkRoutes.end (); )
|
||||
{
|
||||
Ipv6RoutingTableEntry route = GetRoute (j);
|
||||
|
||||
if (route.GetInterface () == interface
|
||||
&& route.IsNetwork ()
|
||||
&& route.GetDestNetwork () == networkAddress
|
||||
&& route.GetDestNetworkPrefix () == networkMask)
|
||||
if (it->first->GetInterface () == interface
|
||||
&& it->first->IsNetwork ()
|
||||
&& it->first->GetDestNetwork () == networkAddress
|
||||
&& it->first->GetDestNetworkPrefix () == networkMask)
|
||||
{
|
||||
RemoveRoute (j);
|
||||
delete it->first;
|
||||
it = m_networkRoutes.erase (it);
|
||||
}
|
||||
else
|
||||
{
|
||||
it++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user