[Ns-developers] Learning Bridge, NetDevice API changes

Tom Henderson tomh at tomh.org
Sun Jul 6 09:52:57 PDT 2008


After reviewing this repo more carefully, I had a few more comments:

Mathieu Lacage wrote:
> hi gustavo,
> 
> Very early comments below: I will review the code more carefully in a
> couple of days.
> 
> 1) BridgeNetDevice::GetChannel should be implemented correctly, that is,
> it should return a BridgeChannel which is created on the fly and
> references the channels of the underlying devices: it is important to
> implement as much as you can of the NetDevice API if it makes sense and,
> in this case, it makes perfect sense to make the bridge report as
> neighbors the neighbors of its underlying devices.

I'm fine with this suggestion.

> 
> 2) I really would like to avoid the extra cruft you have added for 'api
> compatibility'. This means that:
>   - we could re-use the rx callback in promisc mode
 >   - no need for the new Node::Register/Unregister methods you have added
 >   - need to add enable/disable methods for promisc mode

It also seems to me that the existing handlers can implement this and 
satisfy the expected use cases.

All that seems to be needed is to register a handler with protocol value 
0 and to set an interface flag in the net device to check for the 
promiscuous mode when deciding whether to handle a "not for me" frame.

The reuse seems backward compatible from an API perspective too.  If 
promiscuous mode is disabled, you get the current behavior.

> 
> 3) What is SupportsPromiscuousReceiveCallback used for ? When do you
> envision a device which could refuse to support this mode ?
> 
I don't think the above method would be needed, because I think we 
should just support it on all devices.


Also, a small ns-3 coding style question:

+          Ptr<NetDevice> dev = node->GetDevice (i);
+          if (dynamic_cast<CsmaNetDevice*> (PeekPointer (dev)))

Can't this dynamic cast be replaced by:

     if (dev->GetObject<CsmaNetDevice> ())

Tom



More information about the Ns-developers mailing list