[Ns-developers] NetDevice::SetAddress

Mathieu Lacage mathieu.lacage at sophia.inria.fr
Thu Jun 25 00:17:57 PDT 2009


hi,

While reviewing recent changesets for API changes in the ns-3.5 release,
I stumbled upon:

changeset:   4578:88434ff8f0a5
summary:     Finally make tap bridge work with VMs (bug 569)

which adds NetDevice::SetAddress in src/node/net-device.h

I can't comment on how this thing relates to the tap bridge (I did not
look carefully at bug 569) but, I wanted to point out a couple of things
about this change which make it look a bit fishy without more
information. Hopefully, someone can chime in and comment on my concerns.

NetDevice::SetAddress requires that the caller knows the address format
of the underlying NetDevice. This means that, as a caller, you have to
know the exact type of the underlying NetDevice to construct the needed
Address object. If this is the case, I don't understand why the caller
can't just DynamicCast and call the appropriate SetAddress method on the
subclass.

i.e., I am concerned that, so far, the NetDevice API was designed to
make it possible for a caller to ignore the underlying address format to
call any method defined in this class and SetAddress is breaking this
design assumption. The methods we currently have which take an Address
as argument are expected to pass an address coming from somewhere else
so, until now, we never had to know the address format of an underlying
device to call any method defined in the NetDevice base class. 

Mathieu



More information about the Ns-developers mailing list