View | Details | Raw Unified | Return to bug 49
Collapse All | Expand All

(-)a/src/internet-node/ipv4-l3-protocol.cc (-5 / +32 lines)
 Lines 551-562   Ipv4L3Protocol::SetUp (uint32_t i) Link Here 
551
{
568
{
552
  Ipv4Interface *interface = GetInterface (i);
569
  Ipv4Interface *interface = GetInterface (i);
553
  interface->SetUp ();
570
  interface->SetUp ();
554
}
571
555
void 
572
  // If interface address and network mask have been set, add a route
556
Ipv4L3Protocol::SetDown (uint32_t i)
573
  // to the network of the interface (like e.g. ifconfig does on a
557
{
574
  // Linux box)
558
  Ipv4Interface *interface = GetInterface (i);
575
  if ((interface->GetAddress ()) != (Ipv4Address ())
576
      && (interface->GetNetworkMask ()) != (Ipv4Mask ()))
577
    {
578
      AddNetworkRouteTo (interface->GetAddress ().CombineMask (interface->GetNetworkMask ()),
579
                         interface->GetNetworkMask (), i);
580
    }
581
}
582
void 
583
Ipv4L3Protocol::SetDown (uint32_t ifaceIndex)
584
{
585
  Ipv4Interface *interface = GetInterface (ifaceIndex);
559
  interface->SetDown ();
586
  interface->SetDown ();
587
588
  // Remove all routes that are going through this interface
589
  bool modified = true;
590
  while (modified)
591
    {
592
      modified = false;
593
      for (uint32_t i = 0; i < GetNRoutes (); i++)
594
        {
595
          Ipv4Route *route = GetRoute (i);
596
          if (route->GetInterface () == ifaceIndex)
597
            {
598
              RemoveRoute (i);
599
              modified = true;
600
              break;
601
            }
602
        }
603
    }
560
}
604
}
561
605
562
606

Return to bug 49