Prevent internet stack helper from overwriting internet stack
authorTom Henderson <tomh@tomh.org>
Tue, 08 Apr 2008 23:10:39 -0700
changeset 2895 f8523d79a0b7
parent 2894 a65404754cb7
child 2896 cb77c96e6149
Prevent internet stack helper from overwriting internet stack
src/internet-node/internet-stack.cc
--- a/src/internet-node/internet-stack.cc	Tue Apr 08 23:10:11 2008 -0700
+++ b/src/internet-node/internet-stack.cc	Tue Apr 08 23:10:39 2008 -0700
@@ -36,6 +36,11 @@
 void 
 AddInternetStack (Ptr<Node> node)
 {
+  // This may be called on a node with a previously added stack
+  if (node->GetObject<Ipv4> ())
+    {
+      return;
+    }
   Ptr<Ipv4L3Protocol> ipv4 = CreateObject<Ipv4L3Protocol> ();
   Ptr<ArpL3Protocol> arp = CreateObject<ArpL3Protocol> ();
   ipv4->SetNode (node);