Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion 32bit address issue (ns-3.2 stable)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Norman  
View profile  
 More options Nov 24 2008, 6:16 pm
From: Norman <baz.nor...@yahoo.com>
Date: Mon, 24 Nov 2008 15:16:03 -0800 (PST)
Local: Mon, Nov 24 2008 6:16 pm
Subject: Re: 32bit address issue (ns-3.2 stable)
Hi Mathieu,

I did as you advised with Gustavo and patched internet-stack.
The only thing I did was a small change i.e. I made method
SetupLoopback() (from Ipv4L3Protocol object) public,
and added an overloaded version of the same method, that takes
IPaddress as an argument and returns interface index
(for setting an alternative loopbacks).

<diff>
$ diff -u ns-3.2.orginal/src/internet-stack/ipv4-l3-protocol.cc ns-3.2/
src/internet-stack/ipv4-l3-protocol.cc
--- ns-3.2.orginal/src/internet-stack/ipv4-l3-protocol.cc       2008-11-16
01:08:43.000000000 +0100
+++ ns-3.2/src/internet-stack/ipv4-l3-protocol.cc       2008-11-24
23:48:39.000000000 +0100
@@ -117,7 +117,7 @@
 Ipv4L3Protocol::SetNode (Ptr<Node> node)
 {
   m_node = node;
-  SetupLoopback ();
+  //SetupLoopback (); //me
 }

 void
@@ -157,6 +157,23 @@
   interface->SetUp ();
 }

+uint32_t
+Ipv4L3Protocol::SetupLoopback (Ipv4Address ipaddr)
+{
+  NS_LOG_FUNCTION_NOARGS ();
+
+  Ptr<Ipv4LoopbackInterface> interface =
CreateObject<Ipv4LoopbackInterface> ();
+  interface->SetNode (m_node);
+  interface->SetAddress (ipaddr);
+  interface->SetNetworkMask (0xffffffff);
+  uint32_t index = AddIpv4Interface (interface);
+  AddHostRouteTo (ipaddr, index);
+  interface->SetUp ();
+  return index;
+}
+
+
+
 void
 Ipv4L3Protocol::SetDefaultTtl (uint8_t ttl)
 {
</diff>

Also I had to include functionality of internet stack helper and
"internet-stack.cc" files/classes into my program
so I copied all of the necessary functions as they were with a slight
modification to function AddInternetStack(), in which
I  basically added new version of AddIpv4Stack function called
AddIpv4Stack2().

void
AddInternetStack (Ptr<Node> node)
{
  AddArpStack (node);
  //AddIpv4Stack (node);
  AddIpv4Stack2 (node);
  AddUdpStack (node);
  AddTcpStack (node);

}

here how it looks:

static void
AddIpv4Stack2(Ptr<Node> node)
{
  Ptr<Ipv4L3Protocol> ipv4 = CreateObject<Ipv4L3Protocol> ();
  ipv4->SetNode (node);
  ipv4->SetupLoopback();

  Ipv4Address myloopback("1.2.3.4");
  uint32_t index = ipv4->SetupLoopback(myloopback);
  std::cout << "index: " << index << std::endl;

  node->AggregateObject (ipv4);
  Ptr<Ipv4Impl> ipv4Impl = CreateObject<Ipv4Impl> ();
  ipv4Impl->SetIpv4 (ipv4);
  node->AggregateObject (ipv4Impl);

  Ipv4Address ip("127.0.0.1");
  std::cout << "lo: " << ipv4->FindInterfaceForAddr (ip) << std::endl;
  Ptr<Ipv4Interface> ipv4intf = ipv4->GetInterface (ipv4-

>FindInterfaceForAddr(ip));

  Ipv4Address addr = ipv4intf->GetAddress();
  std::cout << "lo addr : " << addr << std::endl;

  Ipv4Address ip2("1.2.3.4");
  std::cout << "lo: " << ipv4->FindInterfaceForAddr (ip2) <<
std::endl;
  ipv4intf = ipv4->GetInterface (ipv4->FindInterfaceForAddr(ip2));
  addr = ipv4intf->GetAddress();
  std::cout << "lo addr : " << addr << std::endl;

}

Everything compiles nicely, output from program suggests that
everything works:
<output>
$ ./waf --run scratch/myfirst
Entering directory `/wrk/ns3/ns-3.2/build'
[469/513] cxx: scratch/myfirst.cc -> build/debug/scratch/myfirst_4.o
[511/513] cxx_link: build/debug/scratch/myfirst_4.o -> build/debug/
scratch/myfirst
Compilation finished successfully
index: 1
lo: 0
lo addr : 127.0.0.1
lo: 1
lo addr : 1.2.3.4
index: 1
lo: 0
lo addr : 127.0.0.1
lo: 1
lo addr : 1.2.3.4
index: 1
lo: 0
lo addr : 127.0.0.1
lo: 1
lo addr : 1.2.3.4
Sent 1024 bytes to 1.0.1.69
</output>
however routing doesn't work. I'm no longer able to send data between
source and destination.
Everything works without adding extra loopback:
lo: 0
lo addr : 127.0.0.1
lo: 0
lo addr : 127.0.0.1
lo: 0
lo addr : 127.0.0.1
Sent 1024 bytes to 1.0.1.69
Received 1024 bytes from 1.0.1.73
Received 1024 bytes from 1.0.1.69

Function AddIpv4Stack2() looks than like this:
static void
AddIpv4Stack2(Ptr<Node> node)
{
  Ptr<Ipv4L3Protocol> ipv4 = CreateObject<Ipv4L3Protocol> ();
  ipv4->SetNode (node);
  ipv4->SetupLoopback();

  //Ipv4Address myloopback("1.2.3.4");
  //uint32_t index = ipv4->SetupLoopback(myloopback);
  //std::cout << "index: " << index << std::endl;

  node->AggregateObject (ipv4);
  Ptr<Ipv4Impl> ipv4Impl = CreateObject<Ipv4Impl> ();
  ipv4Impl->SetIpv4 (ipv4);
  node->AggregateObject (ipv4Impl);

  Ipv4Address ip("127.0.0.1");
  std::cout << "lo: " << ipv4->FindInterfaceForAddr (ip) << std::endl;
  Ptr<Ipv4Interface> ipv4intf = ipv4->GetInterface (ipv4-

>FindInterfaceForAddr(ip));

  Ipv4Address addr = ipv4intf->GetAddress();
  std::cout << "lo addr : " << addr << std::endl;

  //Ipv4Address ip2("1.2.3.4");
  //std::cout << "lo: " << ipv4->FindInterfaceForAddr (ip2) <<
std::endl;
  //ipv4intf = ipv4->GetInterface (ipv4->FindInterfaceForAddr(ip2));
  //addr = ipv4intf->GetAddress();
  //std::cout << "lo addr : " << addr << std::endl;

}

My personal observation is that  the same type of symptom (lack of
routing) is same for three different (separate) type of
configurations:
1. Adding an extra loopback (as described above)
2. Adding second IP address to the same interface (this is unsupported
as you pointed out Mathieu)
3. Adding a sort of pseudo-interface (additional csma or p2p) to act
as loopback and addressing it with /32 (as I described in my initial
email).

All three scenarios are failing in the same way - routing is broken.

Is there anything else I can try?

Many Thanks,

--
Norman (Norbert) Baz


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.