[Ns-developers] GlobalRoutingManager and virtual interfaces

Gustavo Carneiro gjcarneiro at gmail.com
Thu May 15 03:07:41 PDT 2008


2008/5/15 Tom Henderson <tomh at tomh.org>:

> Gustavo Carneiro wrote:
>
>> 2008/5/14 Mathieu Lacage <mathieu.lacage at sophia.inria.fr>:
>>
>>  On Wed, 2008-05-14 at 15:05 +0100, Gustavo Carneiro wrote:
>>>
>>>> Hello, I am working on a VirtualNetDevice in ns-3.0.11, which is
>>>>
>>> something
>>>
>>>> similar to Linux "tap" interfaces.
>>>>
>>>> GlobalRoutingManager::PopulateRoutingTables () is segfaulting or
>>>>
>>> aborting in
>>>
>>>> this simulated network that I have.  Maybe someone can give me some
>>>>
>>> advice
>>>
>>>> here.
>>>>
>>>> If I configure the virtual interface with EnableBroadcast() or
>>>> EnablePointToPoint(), GlobalRoutingManager will assume the netdevice has
>>>>
>>> a
>>>
>>>> channel and try to do something with it.  Obviously it doesn't have any
>>>> channel, so GRM will just segfault.
>>>>
>>> Can't you just make your virtual device return a "virtual" channel which
>>> implements the Channel API correctly ?
>>>
>>
>>
>> I could, but on the other hand adapting GlobalRoutingManager to cope with
>> with no-channel netdevice was trivial after all:
>>
>> diff -r d39382729adb src/routing/global-routing/global-router-interface.cc
>> --- a/src/routing/global-routing/global-router-interface.cc    Thu May 08
>> 14:50:16 2008 +0100
>> +++ b/src/routing/global-routing/global-router-interface.cc    Wed May 14
>> 16:23:42 2008 +0100
>> @@ -625,6 +640,10 @@ GlobalRouter::DiscoverLSAs (void)
>>  // router (to use OSPF lingo) is running.
>>  //
>>           Ptr<Channel> ch = ndLocal->GetChannel();
>> +          if (ch == NULL)
>> +            {
>> +              continue;
>> +            }
>>           Ptr<NetDevice> ndRemote = GetAdjacent(ndLocal, ch);
>>  //
>>  // The adjacent net device is aggregated to a node.  We need to ask that
>> net
>>
>> Would it be ok to commit the above patch instead?
>>
>> I think this is a similar situation to the "Loopback" interface of IPv4,
>> which has no associated NetDevice (it is NULL), when the alternative would
>> be to provide a "dummy" NetDevice was not pursued.  So, I think this
>> counts
>> as prior art, in favor of my simpler solution. :-)
>>
>> The other part, coping with non-IP NetDevices, has also been fixed in my
>> tree, like this:
>>
>> diff -r d39382729adb src/routing/global-routing/global-router-interface.cc
>> --- a/src/routing/global-routing/global-router-interface.cc    Thu May 08
>> 14:50:16 2008 +0100
>> +++ b/src/routing/global-routing/global-router-interface.cc    Wed May 14
>> 16:23:42 2008 +0100
>> @@ -535,6 +535,21 @@ GlobalRouter::DiscoverLSAs (void)
>>     {
>>       Ptr<NetDevice> ndLocal = node->GetDevice(i);
>>
>> +      // Check if it is an IP interface (could be a pure L2 NetDevice)
>> +      bool isIp = false;
>> +      for (uint32_t i = 0; i < ipv4Local->GetNInterfaces (); ++i )
>> +        {
>> +          if (ipv4Local->GetNetDevice (i) == ndLocal)
>> +            {
>> +              isIp = true;
>> +              break;
>> +            }
>> +        }
>> +      if (!isIp)
>> +        {
>> +          continue;
>> +        }
>> +
>>       if (ndLocal->IsBroadcast () && !ndLocal->IsPointToPoint () )
>>         {
>>           NS_LOG_LOGIC ("Broadcast link");
>>
>>
>>
> I would be fine with both of your patches.  However, these still do not
> account for the case when there is an IP interface but the next hop at L2 is
> a L2 device such as a switch (see bug 114).  So, I am fine with your fixes
> for now but we still need to fix bug 114 too.


Sure, we need to fix bug 114, but since we don't really have such a thing as
a "switch" in NS-3 yet (right?) it's kind of hard to fix it since there's
nothing to test against.  It also is not trivial and it brings me some
question regarding the internet-node architecture that I have been meaning
to ask... :-)

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


More information about the Ns-developers mailing list