Install RSTP protocol on Ethernet bridges
authorRichard Whitehouse <github@richardwhiuk.com>
Sun, 8 May 2011 16:27:46 +0000 (17:27 +0100)
committerRichard Whitehouse <github@richardwhiuk.com>
Sun, 8 May 2011 16:27:46 +0000 (17:27 +0100)
src/devices/bridge/helper/ethernet-bridge-helper.cc

index afce12ed4d09d18c09cc6081302ac12d25b25f00..b59ea2b37559cd2dc8f6e451e3462b89be53c152 100644 (file)
@@ -42,6 +42,8 @@ EthernetBridgeHelper::SetDeviceAttribute (std::string n1, const AttributeValue &
 NetDeviceContainer
 EthernetBridgeHelper::Install (Ptr<Node> node, NetDeviceContainer c, std::map<Ptr<NetDevice>, bool> portsEnabled)
 {
+  // Static Routing
+
   NS_LOG_FUNCTION_NOARGS ();
   NS_LOG_LOGIC ("**** Install bridge device on node " << node->GetId ());
 
@@ -65,6 +67,8 @@ EthernetBridgeHelper::Install (Ptr<Node> node, NetDeviceContainer c, std::map<Pt
 NetDeviceContainer
 EthernetBridgeHelper::Install (Ptr<Node> node, NetDeviceContainer c)
 {
+  // Static Routing
+
   NS_LOG_FUNCTION_NOARGS ();
   NS_LOG_LOGIC ("**** Install bridge device on node " << node->GetId ());
 
@@ -73,6 +77,11 @@ EthernetBridgeHelper::Install (Ptr<Node> node, NetDeviceContainer c)
   devs.Add (dev);
   node->AddDevice (dev);
 
+  ObjectFactory factory;
+  factory.SetTypeId ("ns3::RstpL3Protocol");
+  Ptr<Object> protocol = factory.Create<Object>();
+  node->AggregateObject(protocol);
+
   for (NetDeviceContainer::Iterator i = c.Begin (); i != c.End (); ++i)
     {
       NS_LOG_LOGIC ("**** Add BridgePort "<< *i);