[Ns-developers] Comments on recent IPv4 routing core API changes

Gustavo Carneiro gjcarneiro at gmail.com
Wed Sep 12 11:13:23 PDT 2007


  Hi, I noticed a couple changes in the IPv4 routing framework, which may
have been discussed already, in which case sorry for missing those
discussions.  But I'd like to give some feedback on these changes.

1. A new virtual method in Ipv4RoutingProtocol:

  virtual bool RequestIfIndex (Ipv4Address destination,
                                                uint32_t& ifIndex) = 0;

I take that this new method was used fix the problem of packets being
transmitted without a valid source address.  There is a small problem with
this approach in that it essentially requires two routing table lookups for
every packet (except packets being just forwarded).

Tell me if I am missing something (I didn't test this) but  I could suggest
an alternative way to solve the problem.  The Ipv4RoutingProtocol is already
returning a possibly modified Ipv4Header to the RouteReply callback.
Conceivably, the routing protocol could simply look at the source address,
and if it is 0.0.0.0 then modify it to the address of the outgoing
interface.  Doing this I think we could simply remove RequestIfIndex and
instead document the new obligation of the routing protocol to set the
packet's source address when needed.

2. Multicast is static/non-modular

I personally don't need modular multicast any time soon, I would suggest to
make multicast modular like unicast, as part of the Ipv4RoutingProtocol.
The interface could be very similar to the unicast one.  For unicast we
have:

  // void (*RouteReply) (bool found, Ipv4Route route, Packet packet,
Ipv4Header const &ipHeader);
  typedef Callback<void, bool, const Ipv4Route&, Packet, const Ipv4Header&>
RouteReplyCallback;

  virtual bool RequestRoute (uint32_t ifIndex,
                             const Ipv4Header &ipHeader,
                             Packet packet,
                             RouteReplyCallback routeReply) = 0;


  Multicast could become something like:

  // void (*MulticastRouteReply) (bool found, const
std::vector<Ipv4Route>routeList, Packet packet, Ipv4Header const
&ipHeader);
  typedef Callback<void, bool, const std::vector<Ipv4Route>, Packet, const
Ipv4Header&> MulticastRouteReplyCallback;

  virtual bool RequestMulticastRoute (uint32_t ifIndex,
                             const Ipv4Header &ipHeader,
                             Packet packet,
                             RouteReplyCallback routeReply) = 0;

  Anyway, just a suggestion; I don't plan to "champion" this... :P

  Cheers,

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