Commit fd424abe authored by Jonathon Duerig's avatar Jonathon Duerig
Browse files

Merge branch 'master' of git-public.flux.utah.edu:/flux/git/emulab-devel

parents d8fb5829 0913902e
......@@ -56,6 +56,15 @@ parse_cached_pxe_lease() {
mac="$value"; ;;
esac
done
# elab-in-elab hack: if nameserver is 1.1.1.1, this
# is outer boss's lease. we should ignore it and
# request a new one.
if [ -n "$nameservers" ]; then
for i in $nameservers; do
[ $i = 1.1.1.1 ] && return 0
done
fi
for a in /sys/class/net/*/address; do
addr=`cat $a`
......
......@@ -19,6 +19,19 @@ RESOLV_CONF="/etc/resolv.conf"
[ -n "$subnet" ] && NETMASK="netmask $subnet"
case "$1" in
selecting)
# XXX hack to check for inner boss vs. outer boss
# if the nameserver is 1.1.1.1, it's outer boss,
# and we should try again for a lease from the
# inner boss
if [ -n "$dns" ]; then
for i in $dns; do
if [ $i = 1.1.1.1 ]; then
exit 1
fi
done
fi
;;
deconfig)
/sbin/ifconfig $interface 0.0.0.0
;;
......@@ -57,10 +70,12 @@ case "$1" in
echo -n > $RESOLV_CONF
[ -n "$domain" ] && echo search $domain >> $RESOLV_CONF
for i in $dns ; do
echo adding dns $i
echo nameserver $i >> $RESOLV_CONF
done
if [ -n "$dns" ]; then
for i in $dns ; do
echo adding dns $i
echo nameserver $i >> $RESOLV_CONF
done
fi
if [ -n "$hostname" ]; then
hostname $hostname
......
......@@ -196,7 +196,8 @@ if (!defined($experiment)) {
my $special = ($pid eq "testbed" || $pid eq "tbres" || $pid eq "geni" ||
$pid eq "emulab-ops" || $pid eq "utahstud" ||
$pid eq "ClemsonGENI" ||
$pid eq "ResiliNets" || $pid eq "gec8tutorial");
$pid eq "ResiliNets" || $pid eq "gec8tutorial",
$pid eq "GPO-GENI" || $pid eq "gec9tutorial");
my $newsetup = $special;
my $syncvlans = ($pid eq "emulab-ops" || ($MAINSITE && $special));
......
......@@ -89,6 +89,19 @@ tweakmbr()
echo "Installing MBR version $new_mbr_ver ..."
dd if=$MBR_PATH/mbr${new_mbr_ver}.dd of=$disk bs=512 count=1
# Zero out the partition type bytes for FreeBSD and Linux partitions
# so that if the user tries to make a whole-disk image later it will
# work without imagezip complaining about filesystem-specific errors
# when the partition offsets have been adjusted. Frisbee/imagezip
# will write the correct type byte when it writes the image.
#
# The Linux swap partition is left alone because imagezip currently
# blindly includes just the first portion of the swap partition without
# checking to ensure it is valid.
for i in 0 1; do
dd if=/dev/zero of=$disk bs=1 count=1 seek=$(( $i * 16 + 450 )) > /dev/null 2>&1
done
# Linux won't re-read the partition table unless told to do so.
# hdparm could be used for this, but it may not be installed.
# fdisk tells the kernel to re-read the table after writing it
......
......@@ -11,6 +11,89 @@
# interface we were called with and return "cnet" if we are the control
# net. Otherwise we just return the physical interface name.
#
static_widearea_config()
{
local iface=$1
if [ -e /etc/emulab/isrem -a -e /etc/emulab/waconfig ]; then
echo "Found Emulab widearea config info..."
. /etc/emulab/waconfig
else
return 1
fi
# XXX check WA_MAC?
if [ "$WA_BOOTMETHOD" != static ]; then
return 1
fi
cnetif=`/sbin/ifconfig -a | \
sed -n 's/^\([^ ]*\) *Link encap:Ethernet *HWaddr '$WA_MAC' *$/\1/ip'`
if [ -z "$cnetif" ]; then
echo "Could not find iface with MAC $WA_MAC; trying DHCP!"
return 1
elif [ -z "$WA_HOSTNAME" -o -z "$WA_DOMAIN" -o \
-z "$WA_IP_ADDR" -o -z "$WA_IP_NETMASK" -o \
-z "$WA_IP_GATEWAY" -o -z "$WA_IP_DNS1" ]; then
echo "Missing static IP config vars; trying DHCP!"
return 1
fi
# Make sure ifup passed us the correct interface. If not,
# exit successfully so that the DHCP client isn't run
if [ "$cnetif" != "$iface" ]; then
return 0
fi
# We're going ahead with the static config
echo "Statically configuring control net on $cnetif ..."
/sbin/ifconfig "$cnetif" inet "$WA_IP_ADDR" netmask "$WA_IP_NETMASK" up
/sbin/route add default gateway "$WA_IP_GATEWAY"
# setup resolv.conf
echo "search $WA_DOMAIN" > /etc/resolv.conf
echo "nameserver $WA_IP_DNS1" >> /etc/resolv.conf
if [ -n "$WA_IP_DNS2" ]; then
echo "nameserver $WA_IP_DNS2" >> /etc/resolv.conf
fi
# set hostname
hosts_str="$WA_HOSTNAME"
if echo "$WA_HOSTNAME" | grep -q \\.; then
hostname "$WA_HOSTNAME"
else
hostname "${WA_HOSTNAME}.${WA_DOMAIN}"
hosts_str="${WA_HOSTNAME}.${WA_DOMAIN} ${hosts_str}"
fi
# setup hosts file
echo "$WA_IP_ADDR ${hosts_str}" >> /etc/hosts
# setup a few necessary emulab files...
echo "$cnetif" > $BOOTDIR/controlif
if [ -e "/etc/emulab/bossnode" ]; then
bossnode=`cat /etc/emulab/bossnode`
i = 0
while [ $i -lt 6 ]; do
bossip=`host -t A "$bossnode"`
[ $? -eq 0 ] && break
i=`expr $i + 1`
sleep 5
done
echo `echo "$bossip" | sed -n -e 's/.*has address\s*\(.*\)/\1/p'` \
> $BOOTDIR/bossip
fi
echo "$WA_HOSTNAME" > $BOOTDIR/realname
echo "$WA_IP_GATEWAY" > $BOOTDIR/routerip
echo "$WA_IP_ADDR" > $BOOTDIR/myip
echo "$WA_IP_NETMASK" > $BOOTDIR/mynetmask
return 0
}
export LANG=C
iface="$1"
......@@ -22,14 +105,20 @@ while ! mkdir $lockdir 2> /dev/null; do
sleep 1
done
cnetfile="/var/run/cnet"
cnetif=''
#
# We use /var/run to store the current idea of the cnet interface
# because we want it to go away on reboot.
#
cnetfile="/var/run/cnet"
cnetif=''
if [ -f $cnetfile ]; then
cnetif=`cat $cnetfile`
elif static_widearea_config $iface; then
echo $iface > $cnetfile
cnetif=`cat $cnetfile`
/sbin/initctl emit -n 'emulab-findcnet-done'
else
#
# Find a list of candidate interfaces
......
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