Commit 2c0538c8 authored by Ryan Jackson's avatar Ryan Jackson

Oops. I didn't commit this to the Fedora-specific tree.

parent 8bb974e1
#/bin/sh - #/bin/sh -
# #
# EMULAB-COPYRIGHT # EMULAB-COPYRIGHT
# Copyright (c) 2004, 2005 University of Utah and the Flux Group. # Copyright (c) 2004, 2007 University of Utah and the Flux Group.
# All rights reserved. # All rights reserved.
# #
# #
# HACK: run dhclient on all interfaces, and do nothing else # HACK: run dhclient on all interfaces, and do nothing else
# (well, now also bring up a widearea node control net statically if asked)
# #
# Note that this file's name (eth99) cannot overlap with an actual # Note that this file's name (eth99) cannot overlap with an actual
# existing interface or dhclient will loop. dhclient-script invokes # existing interface or dhclient will loop. dhclient-script invokes
...@@ -20,108 +19,14 @@ ...@@ -20,108 +19,14 @@
. /etc/emulab/paths.sh . /etc/emulab/paths.sh
DEVICE="eth99" DEVICE="eth99"
IFACETYPES="3c59x e100 e1000 tulip e1000e tg3" IFACETYPES="3c59x eepro100 e1000 r8169 tulip"
# #
# First, probe for all our supported ethernet types # First, probe for all our supported ethernet types
# #
modprobe -qa $IFACETYPES modprobe -qa $IFACETYPES
# interfaces=`ifconfig -a -s | sed '1d;/^lo /d;s/ .*$//'`
# Check: are we a remote node? If so, possibly try static config in pref
# to dhcp.
#
if [ -e /etc/emulab/isrem -a -e /etc/emulab/waconfig ]; then
. /etc/emulab/waconfig
echo "Found Emulab widearea config info..."
_ifs=`ifconfig -s -a | awk '{ print $1 }' | grep -v 'Iface' | grep -v '^lo$'`
if [ "$WA_BOOTMETHOD" = "static" -a "$WA_MAC" != "" ]; then
# try to find an iface matching WA_MAC
cnetif=""
for _if in $_ifs; do
ifconfig $_if | grep HWaddr | sed -e 's/.*HWaddr\s*\(.*\)/\1/' \
| grep -q -i "$WA_MAC"
if [ "$?" = "0" ]; then
cnetif="$_if"
break
fi
done
if [ "$cnetif" = "" ]; then
echo "Could not find iface with MAC $WA_MAC; trying DHCP!"
WA_BOOTMETHOD="dhcp"
elif [ "$WA_HOSTNAME" = "" \
-o "$WA_DOMAIN" = "" \
-o "$WA_IP_ADDR" = "" \
-o "$WA_IP_NETMASK" = "" \
-o "$WA_IP_GATEWAY" = "" \
-o "$WA_IP_DNS1" = "" ]; then
echo "Missing static IP config vars; trying DHCP!"
WA_BOOTMETHOD="dhcp"
fi
fi
fi
#
# Try static config if all its constraints above are met...
#
if [ "$WA_BOOTMETHOD" = "static" ]; then
echo "Statically configuring control net on $cnetif ..."
ifconfig "$cnetif" inet "$WA_IP_ADDR" netmask "$WA_IP_NETMASK" up
route add default gateway "$WA_IP_GATEWAY"
# bring up lo too just to make sure it's up
ifconfig lo inet 127.0.0.1 up
route add -net 127.0.0.0/8 dev lo
# setup resolv.conf
echo "search $WA_DOMAIN" > /etc/resolv.conf
echo "nameserver $WA_IP_DNS1" >> /etc/resolv.conf
if [ x"$WA_IP_DNS2" != x ]; then
echo "nameserver $WA_IP_DNS2" >> /etc/resolv.conf
fi
# set hostname
hosts_str="$WA_HOSTNAME"
echo "$WA_HOSTNAME" | grep -q \\.
if [ $? = 0 ]; 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`
bossip=`host -t A "$bossnode"`
retval="$?"
i=0
while [ "$retval" != "0" -a $i -lt 6 ]; do
bossip=`host -t A "$bossnode"`
retval="$?"
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
exit 0
fi
#
# else default to dhclient...
#
# #
# If dhclient returns success, then it has configured the first interface # If dhclient returns success, then it has configured the first interface
...@@ -130,8 +35,7 @@ fi ...@@ -130,8 +35,7 @@ fi
# dhclient will leave "up") and set ONBOOT=no to prevent ifup (our caller) # dhclient will leave "up") and set ONBOOT=no to prevent ifup (our caller)
# from doing any further configuration on this fake interface. # from doing any further configuration on this fake interface.
# #
echo "Discovering control net via dhcp ..." if [ -x /sbin/dhclient ] && /sbin/dhclient -q $interfaces; then
if [ -x /sbin/dhclient ] && /sbin/dhclient -q ; then
killall dhclient killall dhclient
if [ -e $BOOTDIR/controlif ]; then if [ -e $BOOTDIR/controlif ]; then
...@@ -144,18 +48,6 @@ if [ -x /sbin/dhclient ] && /sbin/dhclient -q ; then ...@@ -144,18 +48,6 @@ if [ -x /sbin/dhclient ] && /sbin/dhclient -q ; then
ifconfig $_if down ifconfig $_if down
fi >>$LOGDIR/dhclient.log 2>&1 fi >>$LOGDIR/dhclient.log 2>&1
done done
#
# Now probe for wifi interfaces. We don't want to
# do this before dhcp'ing on the wired interfaces since
# there is a possibility that the wifi interface will
# grab an address and become the control net!
#
# This expects to load the madwifi-ng driver; the param states
# that no "virtual AP" device is to be created on module load.
# This is deferred until Emulab interface configuration time.
#
modprobe -q ath_pci autocreate=none
fi fi
ONBOOT="no" ONBOOT="no"
else else
......
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