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
 
Gustavo Carneiro  
View profile  
 More options Nov 24 2008, 6:51 am
From: "Gustavo Carneiro" <gjcarne...@gmail.com>
Date: Mon, 24 Nov 2008 11:51:43 +0000
Local: Mon, Nov 24 2008 6:51 am
Subject: Re: 32bit address issue (ns-3.2 stable)

2008/11/24 Norman <baz.nor...@yahoo.com>

> Hello,
> Does anybody know if it is possible to assign /32 address to node (not
> necessarily using a helper - I'm aware of that bug), that will act as
> RID (Router ID).
> I'm basically looking for a sort of Loopback 0 interface (in Cisco
> terminology).
> I tried to achieve this goal doing something like this:

> void makerid(char *ipaddr, Ptr<Node> n) {
>  ObjectFactory m_queueFactory;
>  m_queueFactory.SetTypeId ("ns3::DropTailQueue");
>  ObjectFactory m_deviceFactory;
>  m_deviceFactory.SetTypeId ("ns3::CsmaNetDevice");
>  ObjectFactory m_channelFactory;
>  m_channelFactory.SetTypeId ("ns3::CsmaChannel");

>  Ptr<CsmaChannel> channel = m_channelFactory.Create ()-
> >GetObject<CsmaChannel> ();
>  Ptr<CsmaNetDevice> csmadevice =
> m_deviceFactory.Create<CsmaNetDevice> ();
>  csmadevice->SetAddress (Mac48Address::Allocate ());
>  csmadevice->SetName("rid");
>  n->AddDevice (csmadevice);
>  Ptr<Queue> queue = m_queueFactory.Create<Queue> ();
>  csmadevice->SetQueue (queue);
>  csmadevice->Attach (channel);

>  Ptr<NetDevice> device;
>  for(uint32_t i=0; i < n->GetNDevices(); i++) {
>    device = n->GetDevice(i);
>    if(device->GetName() == "rid") {
>      Ptr<Node> node = device->GetNode ();
>      NS_ASSERT_MSG (node, "Ipv4AddressHelper::Allocate(): Bad node");
>      Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
>      NS_ASSERT_MSG (ipv4, "Ipv4AddressHelper::Allocate(): Bad ipv4");
>      int32_t ifIndex = ipv4->FindInterfaceForDevice (device);
>      if (ifIndex == -1) {
>        ifIndex = ipv4->AddInterface (device);
>      }
>      NS_ASSERT_MSG (ifIndex >= 0, "Ipv4AddressHelper::Allocate():
> Interface index not found");
>      Ipv4Address ip(ipaddr);
>      ipv4->SetAddress (ifIndex, ip);
>      ipv4->SetNetworkMask (ifIndex, 0xffffffff);
>      //ipv4->SetNetworkMask (ifIndex, 0xffffff00);
>      ipv4->SetMetric (ifIndex, 1);
>      ipv4->SetUp (ifIndex);
>    }
>  }
> }

> However such a approach doesn't work. In short I tried to create an
> extra interface that would act as loopback.
> What I noticed is that if interface is created (doesn't matter which
> one i.e. p2p or csma), and has only one "client" i.e. nobody else is
> connected to that interface it doesn't work.

> For testing I'm using modified version of "first.cc", and what to
> achieve (topology below) is to have a transmission from router's A
> loopback 5.2.0.4  to router's B loopback 5.2.0.2 (in a similar way
> like multihop BGP works).

> RouterA(RID: 5.2.0.4) .73 <= p2p: 1.0.1.72/30 => .74 RouterB (RID:
> 5.2.0.2)

> One more thing. I'm using global route manage to populate routing
> tables.

> Your input is highly appreciated!

Your code above seems awfully complicated.  I would suggest looking at
Ipv4L3Protocol::SetupLoopback in src/internet-stack/ipv4-l3-protocol.cc and
do the same thing that it does but with your custom address.  If it doesn't
work then look for other more complicated solutions, but at least try the
simple thing first.

Hope it helps.

--
Gustavo J. A. M. Carneiro
INESC Porto, Telecommunications and Multimedia Unit
"The universe is always one step beyond logic." -- Frank Herbert


 
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.