Commit 3b084bff authored by Leigh B. Stoller's avatar Leigh B. Stoller

Write a little data file into /var/emulab/boot that gives the

interface to IP address assignment, and is trivially parsable.
This is less onerous then telling people to parse the output of
ifconfig with perl.
parent d1bf7d11
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2004 University of Utah and the Flux Group.
# Copyright (c) 2004, 2005 University of Utah and the Flux Group.
# All rights reserved.
#
use English;
......@@ -72,7 +72,8 @@ if (@ARGV) {
# Local goo
# After libsetup include; ifconfig is run outside vnode setup.
my $TMIFC = CONFDIR() . "/rc.ifc";
my $TMIFC = CONFDIR() . "/rc.ifc";
my $TMIFMAP = CONFDIR() . "/ifmap";
# Execute the action.
SWITCH: for ($action) {
......@@ -106,6 +107,7 @@ sub doboot()
my $upcmds = "";
my $downcmds = "";
my @ifacelist = ();
my @ifacemap = ();
print STDOUT "Checking Testbed interface configuration ... \n";
......@@ -165,6 +167,10 @@ sub doboot()
$upcmds .= TMROUTECONFIG . " $alias up\n ";
$downcmds .= TMROUTECONFIG . " $alias down\n ";
}
# Trivially parsable map for users, which associate an IP
# with a local interface.
push(@ifacemap, "$iface $inet $mac");
}
else {
my $inet = $ifconfig->{IPADDR};
......@@ -210,6 +216,17 @@ sub doboot()
if (defined($downline));
}
}
#
# The map file.
#
unlink $TMIFMAP;
if (open(IFMAP, ">$TMIFMAP")) {
foreach my $iface (@ifacemap) {
print IFMAP "$iface\n";
}
close(IFMAP);
}
#
# Local file into which we write ifconfig commands (as a shell script).
......@@ -270,4 +287,5 @@ sub doreconfig()
sub docleanup()
{
unlink $TMIFC;
unlink $TMIFMAP;
}
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