DSDV协议分析

In this routing protocol routing messages are exchanged between neighboring mobilenodes (i.e mobilenodes that are within range of one another), not flooding (the route advertisements are not re-broad-casted....) Routing updates may be triggered or routine. Updates are triggered in case a routing information from one of the neighbors forces a change in the routing table. A packet for which the route to its destination is not known is cached if no routing entry in the routing table. w. There is a maximum buffer size for caching the pkts waiting for routing information beyond which pkts are dropped.

In the route-advertisement messages, for each new route, there are three data:

  • destination address
  • metric
  • sequence number which is originally stamped by the destination

All packets destined for the mobilenode are routed directly by the address dmux to its port dmux. The port dmux hands the packets to the respective destination agents. A port number of 255 is used to attach routing agent in mobilenodes. The mobilenodes also use a default-target in their classifier (or address demux). In the event a target is not found for the destination in the classifier (which happens when the destination of the packet is not the mobilenode itself), the pkts are handed to the default target which is the routing agent. The routing agent assigns the next hop for the packet and sends it down to the link layer.

The routing protocol is mainly implemented in C++. See dsdv directory and tcl/mobility/dsdv.tcl for all procedures related to DSDV protocol implementation

Implementation in ns-2

DSDV Packet format

It has a size of 9*N+1. N is the number of changed entries So, the first byte is N, then following 9 bytes in [dstnode:4 + metric:1 + seqno:4 ] and on and on.

HELLO Messages

There is no hello message in sourcecode. Actually, Update messages are real HELLO messages. because the update is default set to be periodic as much as 15 seconds. There are two kinds of updates:

  • Periodically triggered
  • Immediately triggered

How long would it take to discover a medium-size topology?

perup_ is set to 15 seconds.... It is not very long. Usually, the topology information should be propagated to each node at 0-2 seconds because those updates are immediately triggered. However, WIRELESS LINK IS NOT RELIABLE FOR BROADCASTING. Therefore, some updates are not heard by all neighbors. It is quite possible that some neighbor will be discovered until the end of another round of updates (10-15 seconds later).

Double IP header bug

The DSDV agent has a 5-packet queue to store packets whose route can not be determined yet.

 // see if we can send off any packets we've got queued
 if (rte.q && rte.metric != BIG)
 {
 Packet *queued_p;
 while ((queued_p = rte.q->deque())) 
 recv(queued_p, 0); // give the packets to ourselves to forward
 
 delete rte.q;
 rte.q = 0;
 table_->AddEntry(rte); // record the now zero'd queue
 }

So, the packet from the node itself, if queued, will be go to recv() function and add an IP header again. The "while loop" code shall be changed as:

 while ((queued_p = rte.q->deque())) 
 forwardPacket(queued_p); // give the packets to ourselves to forward

你可能感兴趣的:(网络模拟器(NS2),MANET路由协议)