Commit 14591c5e authored by Leigh B. Stoller's avatar Leigh B. Stoller

A bunch of little fixes to make the ddijk routing stuff work right,

and in jails especially.
parent bd2b2373
......@@ -22,7 +22,7 @@ SCRIPTS = $(addprefix $(SRCDIR)/, \
rc.tunnels rc.ifconfig rc.delays rc.hostnames \
rc.syncserver rc.linkagent \
rc.keys rc.trafgen rc.tarfiles rc.rpms rc.progagent \
rc.startcmd rc.simulator)
rc.startcmd rc.simulator rc.topomap)
include $(OBJDIR)/Makeconf
......
......@@ -84,7 +84,8 @@ if (MFS()) {
"rc.rpms", "rc.startcmd");
}
else {
@bootscripts = ("rc.misc", "rc.keys", "rc.mounts", "rc.accounts",
@bootscripts = ("rc.misc", "rc.keys", "rc.mounts", "rc.topomap",
"rc.accounts",
"rc.route", "rc.tunnels", "rc.ifconfig", "rc.delays",
"rc.hostnames", "rc.syncserver", "rc.trafgen",
"rc.tarfiles", "rc.rpms", "rc.progagent", "rc.linkagent",
......
......@@ -85,7 +85,6 @@ exit(0);
# More protos
sub donodeid();
sub dotopomap();
#
# Boot Action.
......@@ -95,9 +94,6 @@ sub doboot()
# Handled elsewhere for other node types.
donodeid()
if (!PLAB() && !JAILED() && !IXP());
dotopomap()
if (!PLAB() && !JAILED() && !IXP());
}
#
......@@ -123,7 +119,6 @@ sub doreconfig()
sub docleanup()
{
unlink TMNODEID();
unlink TMTOPOMAP();
}
#
......@@ -154,24 +149,3 @@ sub donodeid()
return 0;
}
#
# Get topomap
#
sub dotopomap()
{
my ($pid, $eid, $vname) = check_nickname();
#
# Copy over the topomap so that it is locally resident. We will eventually
# get this via a tarfile instead of NFS.
#
my $topomap = "/proj/$pid/exp/$eid/tbdata/topomap";
if (-e "${topomap}.gz") {
system("cat ${topomap}.gz | gunzip > " . TMTOPOMAP());
}
elsif (-e $topomap) {
system("cp -fp $topomap ". TMTOPOMAP());
}
}
......@@ -352,11 +352,12 @@ sub ddijkstra ($)
{
my ($rptr) = @_;
my @routes = ();
my $linkmap = "$BOOTDIR/linkmap";
my $linkmap = CONFDIR() . "/linkmap"; # Happens outside jail.
my $topomap;
my ($pid, $eid, $vname) = check_nickname();
my ($pid, $eid, $myname) = check_nickname();
if (gettopomap(\$topomap)) {
warn("*** WARNING: Could not get topomap!\n");
return -1;
}
......@@ -444,7 +445,7 @@ sub ddijkstra ($)
#
# Now run the dijkstra program on the input.
#
if (!open(DIJK, "cat $linkmap | $BINDIR/dijkstra $vname |")) {
if (!open(DIJK, "cat $linkmap | $BINDIR/dijkstra $myname |")) {
warn("*** WARNING: Could not invoke dijkstra on linkmap!\n");
@$rptr = ();
return -1;
......
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2004 University of Utah and the Flux Group.
# All rights reserved.
#
use English;
use Getopt::Std;
sub usage()
{
print "Usage: " .
scriptname() . " [-j vnodeid] boot|shutdown|reconfig|reset\n";
exit(1);
}
my $optlist = "j:";
my $action = "boot";
# Turn off line buffering on output
$| = 1;
# Drag in path stuff so we can find emulab stuff.
BEGIN { require "/etc/emulab/paths.pm"; import emulabpaths; }
# Only root.
if ($EUID != 0) {
die("*** $0:\n".
" Must be root to run this script!\n");
}
#
# Load the OS independent support library. It will load the OS dependent
# library and initialize itself.
#
use libsetup;
use libtmcc;
use librc;
#
# Not all clients support this.
#
exit(0)
if (MFS());
# Protos.
sub doboot();
sub doshutdown();
sub doreconfig();
sub docleanup();
# Parse command line.
if (! getopts($optlist, \%options)) {
usage();
}
if (defined($options{'j'})) {
my $vnodeid = $options{'j'};
libsetup_setvnodeid($vnodeid);
}
# Allow default above.
if (@ARGV) {
$action = $ARGV[0];
}
# Execute the action.
SWITCH: for ($action) {
/^boot$/i && do {
doboot();
last SWITCH;
};
/^shutdown$/i && do {
doshutdown();
last SWITCH;
};
/^reconfig$/i && do {
doreconfig();
last SWITCH;
};
/^reset$/i && do {
docleanup();
last SWITCH;
};
fatal("Invalid action: $action\n");
}
exit(0);
# More protos
sub dotopomap();
#
# Boot Action.
#
sub doboot()
{
# Handled elsewhere for other node types.
dotopomap()
if (!PLAB() && !JAILED() && !IXP());
}
#
# Shutdown Action.
#
sub doshutdown()
{
# Nothing to do
}
#
# Node Reconfig Action (without rebooting).
#
sub doreconfig()
{
doshutdown();
return doboot();
}
#
# Node cleanup action (node is reset to completely clean state).
#
sub docleanup()
{
unlink TMTOPOMAP();
}
#
# Get topomap
#
sub dotopomap()
{
my ($pid, $eid, $vname) = check_nickname();
#
# Copy over the topomap so that it is locally resident. We will eventually
# get this via a tarfile instead of NFS.
#
my $topomap = "/proj/$pid/exp/$eid/tbdata/topomap";
if (-e "${topomap}.gz") {
system("cat ${topomap}.gz | gunzip > " . TMTOPOMAP());
}
elsif (-e $topomap) {
system("cp -fp $topomap ". TMTOPOMAP());
}
}
......@@ -166,6 +166,7 @@ sub FINDIF() { "$BINDIR/findif"; }
sub TMUSESFS() { "$BOOTDIR/usesfs"; }
sub ISSIMTRAFGEN() { "$BOOTDIR/simtrafgen"; }
sub ISDELAYNODE() { "$BOOTDIR/isdelaynode"; }
sub TMTOPOMAP() { "$BOOTDIR/topomap";}
#
# This path is valid only *outside* the jail when its setup.
......@@ -214,7 +215,6 @@ sub TMEVENTKEY() { CONFDIR() . "/eventkey";}
sub TMNODEID() { CONFDIR() . "/nodeid";}
sub TMROLE() { CONFDIR() . "/role";}
sub TMSIMRC() { CONFDIR() . "/rc.simulator";}
sub TMTOPOMAP() { CONFDIR() . "/topomap";}
#
# This is a debugging thing for my home network.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment