[Ns-developers] NetDevice and ArpIpv4Interface

Gustavo Carneiro gjcarneiro at gmail.com
Fri May 16 14:35:09 PDT 2008


2008/5/16 Mathieu Lacage <mathieu.lacage at sophia.inria.fr>:

>
> On Thu, 2008-05-15 at 11:20 +0100, Gustavo Carneiro wrote:
> > NetDevice and ArpIpv4Interface look perfect candidates for merging into a
> > single virtual object via AddObject (aka AddInterface).  Right now:
> >
> >   1- ArpIpv4Interface "decorates" (or "wraps") NetDevice;
> >   2- The ArpIpv4Interface has one "interface index" at IP level,
> NetDevice
> > has another "interface index" at Node level, and they can be different (I
> > was surprised to find out recently);
>
> Yes, because it is possible to have multiple Ipv4 interfaces to map to a
> single NetDevice to support multihoming.
>
> >   3- There are two interface lists, one at IP level, one at Node level;
>
> Yes, again, this is by design to support multihoming.
>
> >   4- Checking if a NetDevice supports IP or not is not trivial, as my
> > GlobalRoutingManager patch demonstrates:
> >
> > +      // 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;
> > +        }
> > +
> >
> > I think this design predates the introduction of object interfaces in
> NS-3.
> > If we were designing it now, I think most of us would agree in a better
> > design:
> >
> >   1- ArpIpv4Interface becomes an optional interface of NetDevice
> > (AddObject);
> >   2- Thus there would be only one interface index for both, and only one
> > interface list at Node level (IP can filter out non-IP interfaces).
>
> I don't think that the above could be made to support IP-level
> multihoming correctly.


I did not know you could have multiple "IP interfaces" for the same
NetDevice.

Kind makes sense; it's how Linux handles IPv4 multihoming, by having eth0:0,
eth0:1, etc. interfaces.  OTOTH, in IPv6 all the addresses conceptually
appear on the same interface.

-- 
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