Skip to content
  • Leigh B. Stoller's avatar
    Add static routing support: · d881770b
    Leigh B. Stoller authored
    	# Turn on manual routing.
    	$ns rtproto Manual
    
    	# Set manual routes
    	$nodeA add-route $nodeC $nodeB
    	$nodeC add-route $nodeA $nodeB
    
    results in this information being returned from the tmcd routing
    command:
    
    	ROUTERTYPE=manual
    	ROUTE DEST=192.168.2.3 DESTTYPE=host DESTMASK=255.255.255.0 \
    		NEXTHOP=192.168.3.2 COST=0
    
    The reason for DESTTYPE and DESTMASK is so that we can also support
    routing to links and lans, since doing it on a per host basis if not
    only hugely tedious, but plain impossible if the destination node has
    multiple links; the add-route syntax takes a node, but we need the IP
    of the relevant link in order to run the route add commands on the
    nodes. So, I've "extended" the syntax of add-route so that you can
    give it a Link or a Lan as the dest:
    
    	$nodeA add-route $link0 $nodeB
    	$nodeA add-route [$ns link $nodeB $nodeC] $nodeB
    
    In this case, the DESTTYPE=net, and the netmask is no longer ignored;
    it is used in the route add command. Currently, the mask is hardwired
    in the DB to 255.255.255.0, but by providing it in the tmcd command,
    we change it later if needed.
    
    I did not implement add-route-to-adj-node since that is not really
    useful in our context, and we definitely do not want the user to
    change the default routes on his nodes. But, its easy to add if we
    need to.
    
    The client side stuff is not done yet.
    d881770b