Bug 2129

Summary: DCE-Linux simulations with heterogeneous nodes crash (some DCE-Linux and some ns3)
Product: dce Reporter: Chip Webb <ns3>
Component: kernelAssignee: Hajime Tazaki <tazaki>
Status: RESOLVED FIXED    
Severity: normal CC: ns-bugs
Priority: P5    
Version: unspecified   
Hardware: PC   
OS: Linux   
Bug Depends on:    
Bug Blocks: 2074    
Attachments: Patch for simulations that mix DCE-Linux nodes and plain NS3 nodes
This is a test case for a DCE-Linux simulation that has a heterogeneous network of DCE-Linux nodes and plain NS3 nodes.

Description Chip Webb 2015-05-29 13:11:09 EDT
Created attachment 2051 [details]
Patch for simulations that mix DCE-Linux nodes and plain NS3 nodes

The code for populating the routing tables in linux-stack-helper.cc assumes that all nodes have Ipv4Linux objects attached. 

In other words, the code assumes that all nodes are running DCE Linux.

I have tried to simulate a case where there is a mix of node types -- some running plain NS3 network stack, and some running DCE Linux. I have called this a heterogeneous node type network.

Specifically, around line 112 in linux-stack-helper.cc there is code that searches for the Ipv4Linux object associated with a node, and then populates the routing tables for it. If the node in question is a plain NS3 node, the return value in "ipv4" will be NULL, and dereferencing the "ipv4" pointer causes the simulation to crash:

So I propose the following patch:

        Ptr<Node> node = *i;
        Ptr<Ipv4Linux> ipv4 = node->GetObject<Ipv4Linux> ();
        ipv4->PopulateRoutingTable ();

Change to the following:

        Ptr<Node> node = *i;
        Ptr<Ipv4Linux> ipv4 = node->GetObject<Ipv4Linux> ();
        if(ipv4)
          {
            ipv4->PopulateRoutingTable ();
          }

A test case and patch are attached.
Comment 1 Chip Webb 2015-05-29 13:12:37 EDT
Created attachment 2052 [details]
This is a test case for a DCE-Linux simulation that has a heterogeneous network of DCE-Linux nodes and plain NS3 nodes.
Comment 2 Hajime Tazaki 2015-05-30 03:12:28 EDT
Thanks Chip. 
The patch is definitely correct and will apply to ns-3-dce asap.

btw, do you mind if I include the attached example script into ns-3-dce release ?
Comment 3 Chip Webb 2015-05-30 10:50:58 EDT
Yes, it is fine to include this example!
Comment 4 Hajime Tazaki 2015-05-31 08:55:04 EDT
http://code.nsnam.org/ns-3-dce/rev/06b23f4d262c

the commit should fix this issue.
Comment 5 Hajime Tazaki 2015-06-01 19:44:23 EDT
(In reply to Hajime Tazaki from comment #4)
> http://code.nsnam.org/ns-3-dce/rev/06b23f4d262c
> 
> the commit should fix this issue.

follow-up fix for the issue in static-optimized build (missing dependencies).

http://code.nsnam.org/ns-3-dce/rev/10182d62e5ae