Commit 109252b6 authored by Kirk Webb's avatar Kirk Webb

fixed static routing problem if no link on nodes, set up autoconf variables,

and addded parameter passing the daemon.

Also fixed up the makefile for compilation and installation (client).
parent b5341514
......@@ -867,6 +867,7 @@ fi
#
......@@ -911,6 +912,7 @@ PLABSUPPORT=0
PLAB_ROOTBALL="plabroot-8.tgz"
PLAB_SLICEPREFIX="emulab"
TBLOGFACIL="local5"
LINKTEST_NSPATH="/share/linktest-ns"
#
# Okay, I know this is improper usage of --with. Too bad.
......@@ -1295,7 +1297,7 @@ fi
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
echo "configure:1299: checking for a BSD compatible install" >&5
echo "configure:1301: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
......@@ -1645,6 +1647,7 @@ s%@PLABSUPPORT@%$PLABSUPPORT%g
s%@TBLOGFACIL@%$TBLOGFACIL%g
s%@PLAB_ROOTBALL@%$PLAB_ROOTBALL%g
s%@PLAB_SLICEPREFIX@%$PLAB_SLICEPREFIX%g
s%@LINKTEST_NSPATH@%$LINKTEST_NSPATH%g
s%@TBOPSEMAIL@%$TBOPSEMAIL%g
s%@TBOPSEMAIL_NOSLASH@%$TBOPSEMAIL_NOSLASH%g
s%@TBLOGSEMAIL@%$TBLOGSEMAIL%g
......
......@@ -60,6 +60,7 @@ AC_SUBST(PLABSUPPORT)
AC_SUBST(TBLOGFACIL)
AC_SUBST(PLAB_ROOTBALL)
AC_SUBST(PLAB_SLICEPREFIX)
AC_SUBST(LINKTEST_NSPATH)
#
# Offer both versions of the email addresses that have the @ escaped
......@@ -103,6 +104,7 @@ PLABSUPPORT=0
PLAB_ROOTBALL="plabroot-8.tgz"
PLAB_SLICEPREFIX="emulab"
TBLOGFACIL="local5"
LINKTEST_NSPATH="/share/linktest-ns"
#
# Okay, I know this is improper usage of --with. Too bad.
......
......@@ -8,12 +8,16 @@ SRCDIR = @srcdir@
TESTBED_SRCDIR = @top_srcdir@
OBJDIR = ../..
SUBDIR = event/linktest
LIBTBDIR = $(OBJDIR)/lib/libtb
LIBEVENTDIR = ../lib
DAEMON = linktest
SCRIPT = linktest.pl
SYSTEM := $(shell uname -s)
include $(OBJDIR)/Makeconf
all: script
all: $(DAEMON) $(SCRIPT)
include $(TESTBED_SRCDIR)/GNUmakerules
......@@ -23,28 +27,44 @@ CFLAGS += -I. -I${OBJDIR} -I$(SRCDIR)/../lib -I$(TESTBED_SRCDIR)/lib/libtb
CFLAGS += `elvin-config --cflags vin4c`
LDFLAGS += -static -L../lib -L${OBJDIR}/lib/libtb
LIBS += -levent -ltb -lcrypto
LIBS += -levent -lcrypto -lssl
LIBS += `elvin-config --libs vin4c`
ifeq ($(SYSTEM),Linux)
LIBS += -ldl
LOCAL_BINDIR = linux
endif
OBJS = linktest.o
TESTS = linktest
ifeq ($(SYSTEM),FreeBSD)
LOCAL_BINDIR = fbsd
endif
LIBTB_OBJS = $(LIBTBDIR)/log.o $(LIBTBDIR)/tbdefs.o
DAEMON_OBJS = linktest.o
# Rules to make sure that some libraries we need from other directories get
# built first
$(LIBTBDIR)/%.o:
@$(MAKE) -C $(LIBTBDIR) $(@F)
$(LIBEVENTDIR)/%.a:
@$(MAKE) -C $(LIBEVENTDIR) $(@F)
$(TESTS): $(OBJS) script
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
$(OBJS): linktest.h ../lib/libevent.a ../lib/event.h
$(DAEMON): $(DAEMON_OBJS) $(LIBTB_OBJS)
-mkdir $(LOCAL_BINDIR)
$(CC) $(LDFLAGS) $(DAEMON_OBJS) $(LIBTB_OBJS) $(LIBS) -o $(LOCAL_BINDIR)/$@
script: linktest.pl
chmod 755 linktest.pl
$(DAEMON_OBJS): linktest.h ../lib/libevent.a ../lib/event.h
install:
client-install:
$(INSTALL_TEST) $(TESTS) \
$(DESTDIR)$(CLIENT_BINDIR)/$(TESTS)
client-install:
$(INSTALL_PROGRAM) $(LOCAL_BINDIR)/$(DAEMON) \
$(DESTDIR)$(CLIENT_BINDIR)/$(DAEMON)
$(INSTALL_PROGRAM) $(SCRIPT) \
$(DESTDIR)$(CLIENT_BINDIR)/$(SCRIPT)
clean:
/bin/rm -f *.o $(TESTS)
/bin/rm -f $(LOCAL_BINDIR)/$(DAEMON)
......@@ -25,7 +25,7 @@ static void callback(event_handle_t handle,
event_notification_t notification, void *data);
static void
start_linktest(char *args);
start_linktest(char *args, int);
void
usage(char *progname)
......@@ -183,7 +183,7 @@ callback(event_handle_t handle, event_notification_t notification, void *data)
* Dispatch the event.
*/
if (strcmp(event, TBDB_EVENTTYPE_START) == 0)
start_linktest(args);
start_linktest(args, sizeof(args));
else {
error("Invalid event: %s\n", event);
return;
......@@ -191,18 +191,36 @@ callback(event_handle_t handle, event_notification_t notification, void *data)
}
/*
what does this do? take arguments from the tevc command and pass them
through to the linktest script.
*/
/* start one linktest at a time.
*/
#define MAX_ARGS 10
static void
start_linktest(char *args, int buflen) {
static int running = 0; /* is linktest currently running? */
pid_t lt_pid;
int status;
char *word;
char *argv[MAX_ARGS];
int i=0;
if(running) return;
running = 1;
static void
start_linktest(char *args) {
info("starting linktest.\n");
info(LINKTEST_SCRIPT);
word = strtok(args," \t");
do {
argv[i++] = word;
} while ((word = strtok(NULL," \t"))
&& (i<MAX_ARGS));
argv[i] = NULL;
info("starting linktest.\n");
lt_pid = fork();
if(!lt_pid) {
execv( LINKTEST_SCRIPT,argv);
}
waitpid(lt_pid, &status, 0);
running = 0;
}
#ifndef __LINKTEST_H_
#define __LINKTEST_H_
#define LINKTEST_SCRIPT "@LINKTEST_SCRIPT@"
#define LINKTEST_SCRIPT "@CLIENT_BINDIR@" "/linktest.pl"
#endif
......@@ -8,6 +8,9 @@ use Class::Struct;
use Getopt::Std;
use constant STATIC => "Static";
# path to linktest special ns
use constant LINKTEST_NSPATH => "@LINKTEST_NSPATH@";
# log files used by tests.
use constant CRUDE_DAT => "/tmp/crude.dat"; # binary data
use constant CRUDE_DEC => "/tmp/crude.dec"; # decoded binary data
......@@ -134,6 +137,19 @@ if(($cumulative && $testlevel >=BW_LEVEL)
# Test procedures
##############################################################################
# does the current node have a link?
# @return: 1 for yes, 0 else
sub linked_node {
my $node = shift @_;
foreach my $edge (@links) {
if($node eq $edge->src
|| $node eq $edge->dst) {
return 1;
}
}
return 0;
}
# Static routing test
#
......@@ -174,7 +190,9 @@ sub static_rt_test {
my @waitlist;
# fork processes to run the pings in parallel.
for(my $i=0;$i<@host_copy;$i++) {
if(defined($host_copy[$i])) {
if(defined($host_copy[$i])
&& linked_node($host_copy[$i])
) {
my $dst = $host_copy[$i];
my $pid = fork();
if(!$pid) {
......@@ -522,11 +540,10 @@ sub init {
$platform = $results[0];
chomp($platform);
# TODO: this should get a configure variable.
if($platform eq BSD) {
$ns_cmd = "/users/davidand/binf/ns";
$ns_cmd = LINKTEST_NSPATH ."/fbsd/ns";
} elsif ($platform eq LINUX) {
$ns_cmd = "/users/davidand/binl/ns";
$ns_cmd = LINKTEST_NSPATH ."/linux/ns";
} else {
die "unsupported platform!";
}
......
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