Bug 1353 - wrong routing table (multipath)
wrong routing table (multipath)
Status: NEW
Product: ns-3
Classification: Unclassified
Component: global-routing
ns-3.12
Mac Intel Mac OS
: P5 major
Assigned To: Tom Henderson
: bug
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-01-31 06:05 UTC by posco.tso
Modified: 2012-02-03 02:04 UTC (History)
1 user (show)

See Also:


Attachments
source code reproduces the bug (2.30 KB, application/octet-stream)
2012-02-01 06:12 UTC, posco.tso
Details

Note You need to log in before you can comment on or make changes to this bug.
Description posco.tso 2012-01-31 06:05:18 UTC
Hi All,

I constructed a very simple experimental topology as follows. All
nodes are connected by CSMA ethernet. After running
Ipv4GlobalRoutingHelper::PopulateRoutingTables (), as shown in routing
table that n1 has two (iface 2 & 2) outgoing interfaces for 10.0.5.0
(n5-n6 subnet), but it only uses one interface (iface 2) to go to
10.0.6.0 subnet, which is obviously incorrect as iface 3 should have
been included. Do you know how to fix it?

********** topology *******************

            /------n2------\
n0 --- n1                   n3----n5----n6
            \------n4------/

********* routing table for n1 ************

Node: 1 Time: 2s Ipv4ListRouting table
  Priority: 0 Protocol: ns3::Ipv4StaticRouting
Destination     Gateway         Genmask         Flags Metric Ref
Use Iface
127.0.0.0       0.0.0.0         255.0.0.0       U     -      -
-   0
10.0.0.0        0.0.0.0         255.255.255.0   U     -      -
-   1
10.0.1.0        0.0.0.0         255.255.255.0   U     -      -
-   2
10.0.4.0        0.0.0.0         255.255.255.0   U     -      -
-   3
  Priority: -10 Protocol: ns3::Ipv4GlobalRouting
Destination     Gateway         Genmask         Flags Metric Ref
Use Iface
10.0.0.0        0.0.0.0         255.255.255.0   U     -      -
-   1
10.0.1.0        0.0.0.0         255.255.255.0   U     -      -
-   2
10.0.4.0        0.0.0.0         255.255.255.0   U     -      -
-   3
10.0.2.0        10.0.1.2        255.255.255.0   UG    -      -
-   2
10.0.3.0        10.0.4.1        255.255.255.0   UG    -      -
-   3
10.0.5.0        10.0.1.2        255.255.255.0   UG    -      -
-   2
10.0.5.0        10.0.4.1        255.255.255.0   UG    -      -
-   3
10.0.6.0        10.0.1.2        255.255.255.0   UG    -      -
-   2
127.0.0.0       10.0.0.1        255.0.0.0       UG    -      -
-   1
127.0.0.0       10.0.1.2        255.0.0.0       UG    -      -
-   2
127.0.0.0       10.0.1.2        255.0.0.0       UG    -      -
-   2
127.0.0.0       10.0.4.1        255.0.0.0       UG    -      -
-   3
127.0.0.0       10.0.1.2        255.0.0.0       UG    -      -
-   2
127.0.0.0       10.0.1.2        255.0.0.0       UG    -      -
-   2
127.0.0.0       10.0.4.1        255.0.0.0       UG    -      -
-   3

********* source code ************

        NodeContainer c;
        c.Create(7);

        //add nodes to their containers
        NodeContainer n0n1 = NodeContainer(c.Get(0),c.Get(1));
        NodeContainer n1n2 = NodeContainer(c.Get(1),c.Get(2));
        NodeContainer n2n3 = NodeContainer(c.Get(2),c.Get(3));
        NodeContainer n3n4 = NodeContainer(c.Get(3),c.Get(4));
        NodeContainer n4n1 = NodeContainer(c.Get(4),c.Get(1));
        NodeContainer n3n5 = NodeContainer(c.Get(3),c.Get(5));
        NodeContainer n5n6 = NodeContainer(c.Get(5),c.Get(6));

        InternetStackHelper internet;
        internet.Install(c);

        CsmaHelper csma;
        csma.SetChannelAttribute("DataRate",StringValue("100Mbps"));
        csma.SetChannelAttribute("Delay",StringValue("2ms"));

        NetDeviceContainer d0d1 = csma.Install(n0n1);
        NetDeviceContainer d1d2 = csma.Install(n1n2);
        NetDeviceContainer d2d3 = csma.Install(n2n3);
        NetDeviceContainer d3d4 = csma.Install(n3n4);
        NetDeviceContainer d4d1 = csma.Install(n4n1);
        NetDeviceContainer d3d5 = csma.Install(n3n5);
        NetDeviceContainer d5d6 = csma.Install(n5n6);

        Ipv4AddressHelper ipv4;

        ipv4.SetBase("10.0.0.0","255.255.255.0");
        ipv4.Assign(d0d1);
        ipv4.SetBase("10.0.1.0","255.255.255.0");
        ipv4.Assign(d1d2);
        ipv4.SetBase("10.0.2.0","255.255.255.0");
        ipv4.Assign(d2d3);
        ipv4.SetBase("10.0.3.0","255.255.255.0");
        ipv4.Assign(d3d4);
        ipv4.SetBase("10.0.4.0","255.255.255.0");
        ipv4.Assign(d4d1);
        ipv4.SetBase("10.0.5.0","255.255.255.0");
        ipv4.Assign(d3d5);
        ipv4.SetBase("10.0.6.0","255.255.255.0");
        ipv4.Assign(d5d6);

        Ipv4GlobalRoutingHelper::PopulateRoutingTables ();

Cheers,
Posco
Comment 1 Tom Henderson 2012-01-31 13:45:45 UTC
By default, this is the expected behavior.  If there is equal cost multipath to a destination, only one path is used.

Someone added support for equal-cost multipath a while back (where packets are distributed randomly across the multipaths), but no tests/examples were provided.  You will see a long-open bug on this:
https://www.nsnam.org/bugzilla/﷒0﷓

Can you try adding this statement to your program and see if it works?

Config::SetDefault ("ns3::Ipv4GlobalRouting::RandomEcmpRouting", BooleanValue (true));

If so, would you consider to attach your program to this bug report and we could add it as an example program?

If it doesn't work, we can work on fixing it (similarly, a contributed test case program would help).
Comment 2 posco.tso 2012-02-01 06:10:33 UTC
(In reply to comment #1)
> By default, this is the expected behavior.  If there is equal cost multipath to
> a destination, only one path is used.
> 
> Someone added support for equal-cost multipath a while back (where packets are
> distributed randomly across the multipaths), but no tests/examples were
> provided.  You will see a long-open bug on this:
> https://www.nsnam.org/bugzilla/﷒0﷓
> 
> Can you try adding this statement to your program and see if it works?
> 
> Config::SetDefault ("ns3::Ipv4GlobalRouting::RandomEcmpRouting", BooleanValue
> (true));
> 
> If so, would you consider to attach your program to this bug report and we
> could add it as an example program? 
> 
> If it doesn't work, we can work on fixing it (similarly, a contributed test
> case program would help).

Yes, I had included the following statement when I tested the captioned topology.

Config::SetDefault("ns3::Ipv4GlobalRouting::RandomEcmpRouting", BooleanValue(true));

Apparently with correct routing table n1 must have two equal-cost paths to n5 and n6, turns out n1 correctly installs two paths for n5 but has only one path to n6. Source code attached!
Comment 3 posco.tso 2012-02-01 06:12:01 UTC
Created attachment 1323 [details]
source code reproduces the bug
Comment 4 Tom Henderson 2012-02-03 02:04:37 UTC
(In reply to comment #3)
> Created attachment 1323 [details]
> source code reproduces the bug

Thank you, I will have a closer look.