Commit 58c30eb2 authored by Mike Hibler's avatar Mike Hibler

Even more nits.

parent 2fa61efa
......@@ -4543,6 +4543,7 @@ outfiles="Makeconf GNUmakefile setversion \
tmcc/freebsd7/GNUmakefile tmcc/freebsd7/netif-emulab \
tmcc/freebsd9/GNUmakefile tmcc/freebsd9/netif-emulab \
tmcc/freebsd10/GNUmakefile tmcc/freebsd10/netif-emulab \
tmcc/freebsd11/GNUmakefile tmcc/freebsd11/netif-emulab \
tmcc/freenas8/GNUmakefile tmcc/freenas9/GNUmakefile \
tmcc/cygwinxp/GNUmakefile tmcc/dp/GNUmakefile \
tmcc/openbsd/GNUmakefile tmcc/ron/GNUmakefile \
......
......@@ -280,6 +280,7 @@ outfiles="Makeconf GNUmakefile setversion \
tmcc/freebsd7/GNUmakefile tmcc/freebsd7/netif-emulab \
tmcc/freebsd9/GNUmakefile tmcc/freebsd9/netif-emulab \
tmcc/freebsd10/GNUmakefile tmcc/freebsd10/netif-emulab \
tmcc/freebsd11/GNUmakefile tmcc/freebsd11/netif-emulab \
tmcc/freenas8/GNUmakefile tmcc/freenas9/GNUmakefile \
tmcc/cygwinxp/GNUmakefile tmcc/dp/GNUmakefile \
tmcc/openbsd/GNUmakefile tmcc/ron/GNUmakefile \
......
#
# Copyright (c) 2000-2013 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
# This file is part of the Emulab network testbed software.
#
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
#
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
# License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this file. If not, see <http://www.gnu.org/licenses/>.
#
# }}}
#
#
# XXX ONLY RUN THIS INSTALL ON A FREEBSD 6 TESTBED NODE!
#
# Trivial. These things just need to be installed into the right place
# on a testbed node before cutting an image.
#
#
SRCDIR = @srcdir@
TESTBED_SRCDIR = @top_srcdir@
OBJDIR = @top_builddir@
SUBDIR = $(subst $(TESTBED_SRCDIR)/,,$(SRCDIR))
include $(OBJDIR)/Makeconf
SCRIPTS =
#
# Force dependencies on the scripts so that they will be rerun through
# configure if the .in file is changed.
#
all: netif-emulab $(SCRIPTS)
include $(TESTBED_SRCDIR)/GNUmakerules
SYSETCDIR = $(DESTDIR)/etc
JAILDIR = $(SYSETCDIR)/jail
ETCDIR = $(DESTDIR)$(CLIENT_ETCDIR)
BINDIR = $(DESTDIR)$(CLIENT_BINDIR)
VARDIR = $(DESTDIR)$(CLIENT_VARDIR)
RCDIR = $(DESTDIR)/usr/local/etc/rc.d
ISMFS = $(ETCDIR)/ismfs
INSTALL = /usr/bin/install -c
destdircheck:
@if [ -z "$(DESTDIR)" ]; then \
echo "You must define DESTDIR for this target!"; \
false; \
fi
@if [ "$(DESTDIR)" = "/" ]; then \
echo "DESTDIR is '/', really really bad idea!"; \
false; \
fi
install client-install: bincheck basefbsd-install etc-install \
sup-install script-install bin-install
subboss-install: bincheck basefbsd-subboss-install etc-install \
sup-install script-install bin-install
simple-install: script-install bin-install
bincheck:
@if [ ! -x /usr/local/sbin/dhclient ]; then \
echo "Need to install net/isc-dhcp3-client port"; \
false; \
fi
dir-install:
$(INSTALL) -m 755 -o root -g wheel -d $(DESTDIR)/boot
$(INSTALL) -m 755 -o root -g wheel -d $(SYSETCDIR)
$(INSTALL) -m 755 -o root -g wheel -d $(SYSETCDIR)/rc.d
$(INSTALL) -m 755 -o root -g wheel -d $(SYSETCDIR)/rc.conf.d
$(INSTALL) -m 755 -o root -g wheel -d $(ETCDIR)
$(INSTALL) -m 755 -o root -g wheel -d $(BINDIR)
$(INSTALL) -m 755 -o root -g wheel -d $(RCDIR)
$(INSTALL) -m 755 -o root -g wheel -d $(VARDIR)
$(INSTALL) -m 755 -o root -g wheel -d $(VARDIR)/db
$(INSTALL) -m 755 -o root -g wheel -d $(VARDIR)/jails
$(INSTALL) -m 755 -o root -g wheel -d $(VARDIR)/logs
$(INSTALL) -m 755 -o root -g wheel -d $(VARDIR)/sup
$(INSTALL) -m 755 -o root -g wheel -d $(VARDIR)/boot
$(INSTALL) -m 755 -o root -g wheel -d $(VARDIR)/lock
-rm -rf $(DESTDIR)/etc/testbed
ln -s emulab $(DESTDIR)/etc/testbed
-rm -rf $(DESTDIR)/usr/local/etc/testbed
ln -s emulab $(DESTDIR)/usr/local/etc/testbed
basefbsd-install: dir-install
(cd ../freebsd5; $(MAKE) all install)
rm -rf $(SYSETCDIR)/rc.conf.d
rm -f $(DESTDIR)/usr/local/etc/dhclient*
ln -s /etc/dhclient-enter-hooks $(DESTDIR)/usr/local/etc/
ln -s /etc/dhclient-exit-hooks $(DESTDIR)/usr/local/etc/
basefbsd-subboss-install: dir-install
(cd ../freebsd5; $(MAKE) all subboss-install)
rm -rf $(SYSETCDIR)/rc.conf.d
rm -f $(DESTDIR)/usr/local/etc/dhclient*
ln -s /etc/dhclient-enter-hooks $(DESTDIR)/usr/local/etc/
ln -s /etc/dhclient-exit-hooks $(DESTDIR)/usr/local/etc/
tweak-syslog:
@if [ -f $(SYSETCDIR)/newsyslog.conf ]; then \
if `grep -q 'Added by Emulab' $(SYSETCDIR)/newsyslog.conf`; then \
sed -i .preemulab -e '/Added by Emulab/,$$d' $(SYSETCDIR)/newsyslog.conf; \
fi; \
cat $(SRCDIR)/newsyslog.conf.tail >> $(SYSETCDIR)/newsyslog.conf; \
fi
# Do not even pretend to do cvsup anymore
sup-install: dir-install
rm -f $(ETCDIR)/supfile
bin-install: dir-install
etc-install: dir-install sysetc-install
$(INSTALL) -m 644 $(SRCDIR)/group $(ETCDIR)/group
$(INSTALL) -m 600 $(SRCDIR)/master.passwd $(ETCDIR)/master.passwd
$(INSTALL) -m 444 $(SRCDIR)/hosts $(ETCDIR)/hosts
sysetc-install: dir-install netif-emulab tweak-syslog
$(INSTALL) -m 444 $(SRCDIR)/rc.conf $(SYSETCDIR)/rc.conf
$(INSTALL) -m 444 $(SRCDIR)/sysctl.conf $(SYSETCDIR)/sysctl.conf
$(INSTALL) -m 555 ./netif-emulab $(SYSETCDIR)/rc.d/netif-emulab
rm -f $(SYSETCDIR)/rc.early
$(INSTALL) -m 644 $(SRCDIR)/loader.conf $(DESTDIR)/boot/loader.conf
$(INSTALL) -m 755 $(SRCDIR)/dhclient-exit-hooks \
$(SYSETCDIR)/dhclient-exit-hooks
script-install: dir-install
$(INSTALL) -m 755 $(SRCDIR)/rc.freebsd $(BINDIR)/rc
#
# XXX we still do this like freebsd5!
#
frisbee-mfs-install: destdircheck
(cd ../freebsd5; $(MAKE) all frisbee-mfs-install)
rm -f $(SYSETCDIR)/testbed/dhclient
rm -f $(DESTDIR)/usr/local/etc/dhclient*
ln -s /etc/dhclient-enter-hooks $(DESTDIR)/usr/local/etc/
ln -s /etc/dhclient-exit-hooks $(DESTDIR)/usr/local/etc/
@if [ -r $(SRCDIR)/master.passwd ]; then \
$(INSTALL) -m 600 $(SRCDIR)/master.passwd $(SYSETCDIR); \
pwd_mkdb -d $(SYSETCDIR) $(SYSETCDIR)/master.passwd; \
fi
@if [ -r $(SRCDIR)/group ]; then \
$(INSTALL) -m 644 $(SRCDIR)/group $(SYSETCDIR); \
fi
mfs-install:
(cd ../freebsd5; $(MAKE) all mfs-install)
rm -f $(SYSETCDIR)/testbed/dhclient
rm -f $(DESTDIR)/usr/local/etc/dhclient*
ln -s /etc/dhclient-enter-hooks $(DESTDIR)/usr/local/etc/
ln -s /etc/dhclient-exit-hooks $(DESTDIR)/usr/local/etc/
@if [ -r $(SRCDIR)/master.passwd ]; then \
$(INSTALL) -m 600 $(SRCDIR)/master.passwd $(SYSETCDIR); \
pwd_mkdb -d $(SYSETCDIR) $(SYSETCDIR)/master.passwd; \
fi
@if [ -r $(SRCDIR)/group ]; then \
$(INSTALL) -m 644 $(SRCDIR)/group $(SYSETCDIR); \
fi
#!/bin/sh
#
# Copyright (c) 2000-2013 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
# This file is part of the Emulab network testbed software.
#
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
#
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
# License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this file. If not, see <http://www.gnu.org/licenses/>.
#
# }}}
#
. /etc/emulab/paths.sh
echo "`date`: ${interface}: ${reason}" >>$LOGDIR/dhclient-exit.log 2>&1
if [ x$reason != xREBOOT -a x$reason != xBOUND -a x$reason != xRENEW -a x$reason != xREBIND ]
then
exit 0
fi
date >$LOGDIR/dhclient.log 2>&1
#
# ElabinElab support (inner boss and ops)
#
if [ -e "$ETCDIR/outer_bossnode" ]; then
#
# Inner boss or ops. The outer network has now been configured.
# Call rc.inelab to get the inner control network configured (we
# have to ask outer boss in the usual manner).
#
$BINDIR/rc/rc.inelab >>$LOGDIR/dhclient.log 2>&1
# Then kill as we normally do.
killall dhclient >>$LOGDIR/dhclient.log 2>&1
exit 0
fi
#
# ElabinElab support
#
# The enter-hooks script should weed out outer boss calls, so there
# should be nothing to do here. However, just in case we smack em down
# again here.
#
if [ x"$new_domain_name_servers" = "x1.1.1.1" ]; then
exit_status=1
exit 1
fi
#
# Remember our server IP, real hostname, router IP, etc.
#
echo $new_dhcp_server_identifier > $BOOTDIR/bossip
echo $new_host_name > $BOOTDIR/realname
echo $new_routers > $BOOTDIR/routerip
echo $new_ip_address > $BOOTDIR/myip
echo $new_subnet_mask > $BOOTDIR/mynetmask
echo $new_domain_name > $BOOTDIR/mydomain
if [ -n "$interface" ]; then
echo $interface > $BOOTDIR/controlif
fi
#
# For Xen-based vnodes we record the vnode name where the scripts expect it.
# XXX this works because only Xen-based vnodes DHCP.
#
case "$new_host_name" in
pcvm*)
echo $new_host_name > $BOOTDIR/vmname
;;
esac
#
# If this is a newnode boot, boss (inner or outer) will have returned with
# no hostname. We don't need to record anything in this case, so skip it.
#
if [ x"$new_host_name" = x ]; then
exit 0
fi
#
# Since we have our IP address, let's kill off all dhclient instances
# so they don't interfere and shutdown all the other interfaces dhclient
# was working on.
#
# I'd love to use the dhclient.pid file, but it helpfully has not been
# created at this point
#
killall dhclient >>$LOGDIR/dhclient.log 2>&1
for _if in `ifconfig -lu`
do
if [ $_if != "lo0" -a x$_if != x$interface ]
then
echo "taking $_if down"
ifconfig $_if down remove
fi >>$LOGDIR/dhclient.log 2>&1
done
#
# XXX compenstate for a stupid long time bug in the dhclient-script
#
curhname=`hostname`
if [ $reason = BOUND -a -z "$curhname" -a -n "$new_host_name" ]; then
echo "`date`: hostname is $new_host_name" >>$LOGDIR/dhclient-exit.log 2>&1
hostname $new_host_name
fi
#
# XXX hmm...in FreeBSD 10, the first interface we probe will cause the
# default route to get set to that interface. This will cause any subsequent
# attempt to set the default route to fail and we may wind up without a
# valid default route at this point. So we double check here to make sure
# the default route is correct.
#
if [ -n "$new_routers" ]; then
gw=`route -n get -inet default | grep gateway`
gw=${gw##*: }
if [ -z "$gw" -o "$gw" != "$new_routers" ]; then
echo "reset default route from \"$gw\" to \"$new_routers\""
route delete default
route add default $new_routers
fi >>$LOGDIR/dhclient-exit.log 2>&1
fi
#
# See if the Testbed configuration software wants to change the hostname.
# Installed into /etc. Note: frisbee MFS doesn't have perl and hence
# doesn't have this script.
#
if [ -x $BINDIR/sethostname ]
then
$BINDIR/sethostname $new_domain_name >>$LOGDIR/dhclient.log 2>&1
fi
echo "`date`: ${interface}: ${reason}: done" >>$LOGDIR/dhclient-exit.log 2>&1
exit 0
# $FreeBSD: head/etc/group 256365 2013-10-12 06:06:53Z rpaulo $
#
wheel:*:0:root
daemon:*:1:
kmem:*:2:
sys:*:3:
tty:*:4:
operator:*:5:root
mail:*:6:
bin:*:7:
news:*:8:
man:*:9:
games:*:13:
ftp:*:14:
staff:*:20:
sshd:*:22:
smmsp:*:25:
mailnull:*:26:
guest:*:31:
bind:*:53:
unbound:*:59:
proxy:*:62:
authpf:*:63:
_pflogd:*:64:
_dhcp:*:65:
uucp:*:66:
dialer:*:68:
network:*:69:
audit:*:77:
www:*:80:
hast:*:845:
nogroup:*:65533:
nobody:*:65534:
messagebus:*:556:
polkit:*:562:
haldaemon:*:560:
git_daemon:*:964:
# $FreeBSD: head/etc/hosts 109997 2003-01-28 21:29:23Z dbaker $
#
# Host Database
#
# This file should contain the addresses and aliases for local hosts that
# share this file. Replace 'my.domain' below with the domainname of your
# machine.
#
# In the presence of the domain name service or NIS, this file may
# not be consulted at all; see /etc/nsswitch.conf for the resolution order.
#
#
#::1 localhost localhost.my.domain
127.0.0.1 localhost loghost
console="comconsole"
# No stupid menu
beastie_disable="YES"
## for wireless nodes
#if_ath_load="YES"
#hw.bge.allow_asf=1
# If you have lots of memory, set this to zero (9.0 and above)
# We do this at Utah for d820 nodes with 128GB.
hw.memtest.tests=0
#
# ixgbe driver will throttle back number of rx queues if not enough
# nmbclusters; i.e., less than min(cores,8) * ports_on_card * ring_bufs,
# which for the Utah d820s is 8 * 2 * 2048 == 32768. So we set nmbclusters
# to that value here (and set the other nmb* values as the kernel would
# based on that value). Note that it is not too much larger than the default
# the kernel would calculate 25600 (which is based on "maxusers").
#
# These values will get re-adjusted in the Emulab startup scripts to a
# more appropriate value based on the size of RAM and total number of
# interfaces.
#
kern.ipc.nmbclusters=32768
kern.ipc.nmbjumbop=16384
kern.ipc.nmbjumbo9=8192
kern.ipc.nmbjumbo16=4096
# force module path, our pxeboot can mess it up
module_path="/boot/kernel;/boot/modules"
# $FreeBSD: head/etc/master.passwd 278616 2015-02-12 05:35:00Z cperciva $
#
root:$1$0DKicYf8$PsfF3uhmTrtuaJKH/rxtQ/:0:0::0:0:Charlie &:/root:/bin/csh
toor:$1$0DKicYf8$PsfF3uhmTrtuaJKH/rxtQ/:0:0::0:0:Chaplin &:/root:/bin/csh
daemon:*:1:1::0:0:Owner of many system processes:/root:/usr/sbin/nologin
operator:*:2:5::0:0:System &:/:/usr/sbin/nologin
bin:*:3:7::0:0:Binaries Commands and Source:/:/usr/sbin/nologin
tty:*:4:65533::0:0:Tty Sandbox:/:/usr/sbin/nologin
kmem:*:5:65533::0:0:KMem Sandbox:/:/usr/sbin/nologin
games:*:7:13::0:0:Games pseudo-user:/:/usr/sbin/nologin
news:*:8:8::0:0:News Subsystem:/:/usr/sbin/nologin
man:*:9:9::0:0:Mister Man Pages:/usr/share/man:/usr/sbin/nologin
sshd:*:22:22::0:0:Secure Shell Daemon:/var/empty:/usr/sbin/nologin
smmsp:*:25:25::0:0:Sendmail Submission User:/var/spool/clientmqueue:/usr/sbin/nologin
mailnull:*:26:26::0:0:Sendmail Default User:/var/spool/mqueue:/usr/sbin/nologin
bind:*:53:53::0:0:Bind Sandbox:/:/usr/sbin/nologin
unbound:*:59:59::0:0:Unbound DNS Resolver:/var/unbound:/usr/sbin/nologin
proxy:*:62:62::0:0:Packet Filter pseudo-user:/nonexistent:/usr/sbin/nologin
_pflogd:*:64:64::0:0:pflogd privsep user:/var/empty:/usr/sbin/nologin
_dhcp:*:65:65::0:0:dhcp programs:/var/empty:/usr/sbin/nologin
uucp:*:66:66::0:0:UUCP pseudo-user:/var/spool/uucppublic:/usr/local/libexec/uucp/uucico
pop:*:68:6::0:0:Post Office Owner:/nonexistent:/usr/sbin/nologin
auditdistd:*:78:77::0:0:Auditdistd unprivileged user:/var/empty:/usr/sbin/nologin
www:*:80:80::0:0:World Wide Web Owner:/nonexistent:/usr/sbin/nologin
hast:*:845:845::0:0:HAST unprivileged user:/var/empty:/usr/sbin/nologin
nobody:*:65534:65534::0:0:Unprivileged user:/nonexistent:/usr/sbin/nologin
messagebus:*:556:556::0:0:D-BUS Daemon User:/nonexistent:/usr/sbin/nologin
polkit:*:562:562::0:0:PolicyKit Daemon User:/nonexistent:/usr/sbin/nologin
haldaemon:*:560:560::0:0:HAL Daemon User:/nonexistent:/usr/sbin/nologin
git_daemon:*:964:964::0:0:git daemon:/nonexistent:/usr/sbin/nologin
#
# Copyright (c) 2000-2014 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
# This file is part of the Emulab network testbed software.
#
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
#
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
# License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this file. If not, see <http://www.gnu.org/licenses/>.
#
# }}}
#
# Emulab version of netif to DHCP on all interfaces simultaneously.
# Runs before the standard netif, and effectively neuters that script.
# Note the dependencies below. Every script that declares that it must run
# BEFORE netif is listed as a REQUIRE here so that we are properly ordered
# w.r.t. those scripts.
#
# PROVIDE: netif-emulab
# REQUIRE: atm1 ipfilter mountcritlocal serial sppp sysctl
# REQUIRE: adjkerntz hostname ipfs ipnat kldxref random
# BEFORE: netif
# KEYWORD: nojail
. /etc/rc.subr
. /etc/network.subr
name="netif-emulab"
start_cmd="cnet_start"
stop_cmd="cnet_stop"
_cmdifn=
# some emulab paths
ELAB_LOGDIR=@CLIENT_VARDIR@/logs
ELAB_BOOTDIR=@CLIENT_VARDIR@/boot
# XXX accomodation for BSD-based frisbee MFS
if [ ! -d "$ELAB_BOOTDIR" ]; then
if [ -r /etc/emulab/paths.sh ]; then
. /etc/emulab/paths.sh
ELAB_LOGDIR=$LOGDIR
ELAB_BOOTDIR=$BOOTDIR
else
ELAB_LOGDIR=/etc/testbed
ELAB_BOOTDIR=/etc/testbed
fi
fi
#
# XXX hack for PRObE and nfe interfaces.
# The nfe driver apparently has issues and can fail to get an address.
# Gary Sandine found that taking the interface down and back up again can
# unstick things (if you are persistent enough).
#
cnet_nfe_hack()
{
# XXX try for 10 minutes at fixed 30s intervals
# XXX tried slowly increasing intervals, but didn't work
for i in 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30; do
echo "`date`: nfe_hack: taking interfaces down and up ..."
for _if in $*; do
ifconfig $_if down
done
sleep 2
for _if in $*; do
ifconfig $_if up
done
sleep $i
if [ -e $ELAB_BOOTDIR/controlif ]; then
echo "`date`: nfe_hack: worked!"
break;
fi
done
}
cnet_ibprobe()
{
#
# Handle Mellanox VPI cards: put them in auto mode.
#
if sysctl -q sys.class.infiniband_verbs.abi_version >/dev/null; then
sleep 2
if sysctl -q sys.device.mlx4_core0.mlx4_port1; then
echo "Putting Mellanox cards in auto mode..."
sysctl sys.device.mlx4_core0.mlx4_port1=auto
if sysctl -q sys.device.mlx4_core0.mlx4_port2; then
sysctl sys.device.mlx4_core0.mlx4_port2=auto
fi
sleep 2
fi
fi
}
# this is a separate function so we can redirect all the output below
cnet_dhcp()
{
#
# Argh! FreeBSD >= 6 dhclient also allows only a single interface
# to be specified. I tried to make this work by launching multiple,
# simultaneous dhclients, but that caused EEPROM read failures on
# em devices. So we will use the "pure" port version if it is
# installed.
#
if [ -x /usr/local/sbin/dhclient ]; then
echo "`date`: Using dhclient port..."
dhclient_program="/usr/local/sbin/dhclient"
${dhclient_program} ${dhclient_flags} $*
echo "`date`: $dhclient_program returned $?"
else
echo "Using default dhclient..."
#
# Argh redux! FreeBSD >= 6 has rewritten dhclient and it no longer
# takes the -i option. So we remove that option here.
#
dhclient_flags=`echo $dhclient_flags | sed -e 's/-i [0-9][0-9]*//'`
for _if in $*; do
${dhclient_program} ${dhclient_flags} -b $_if
done
wait
fi
}
cnet_start()
{
_nfe=""
cnet_ibprobe >>$ELAB_LOGDIR/netif-emulab.log 2>&1
rm -f $ELAB_BOOTDIR/controlif
#
# Find all the relevant networks IFs.
# Don't do loopback, funky tunnel devices
# (e.g., IP-over-string-and-cans).
#
# At Utah Emulab we also exclude wireless interfaces as our
# wireless machines are in a production ether and might get
# an answer!
#
_ifs=""
network_interfaces=`ifconfig -l | sed -e 's/lo0//'`
for _if in $network_interfaces; do
case $_if in
lo*|gif*|faith*|tun*|plip*|usbus*|ipfw*)
;;
# XXX skip IPoIB and Mellanox IB as eth
ib[0-9]|mlxen*)
;;
# XXX skip Intel 10Gb for now; they require huge numbers of mbufs
ix[0-9])
;;
ath*)
;;
nfe*)
_nfe="$_nfe $_if"
_ifs="$_ifs $_if"
;;
*)
_ifs="$_ifs $_if"
;;
esac
done
#
# For the widearea case: decide if we want static or dynamic
# network configuration based on a config file.
# XXX: should try to look on other media as well, instead of just
# the boot dongle.
#
WACONFIG=/etc/emulab/waconfig
if [ -e "$WACONFIG" ]; then
# key=val pairs become shell vars
. "$WACONFIG"
echo "Found Emulab widearea config info..."
if [ "$WA_BOOTMETHOD" = "static" -a "$WA_MAC" != "" ]; then
# try to find an iface matching WA_MAC
cnetif=""
for _if in $network_interfaces; do
mac=`ifconfig $_if | grep ether | sed -e 's/[[:space:]]*ether[[:space:]]*//'`
echo "$mac" | grep -i "$WA_MAC"
if [ "$?" = "0" ]; then
cnetif="$_if"
break
fi
done
if [ "$cnetif" = "" ]; then
echo -n "Could not find iface with "
echo "$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 -n "Missing static IP config "
echo "vars; trying DHCP!"
WA_BOOTMETHOD="dhcp"
fi
fi
else
WA_BOOTMETHOD="dhcp"
fi
if [ "$WA_BOOTMETHOD" = "dhcp" ]; then
#
# use good ol' Emulab dhcp!
#
echo "Emulab looking for control net among: $_ifs ..."
cnet_dhcp $_ifs >$ELAB_LOGDIR/netif-emulab.log 2>&1
if [ -e $ELAB_BOOTDIR/controlif ]; then
_cif=`cat $ELAB_BOOTDIR/controlif`
echo "Emulab control net is $_cif"
else
#
# XXX hack for nfe device on PRObE nodes. The PRObE
# nfe interfaces can get hung, but a down/up seems to
# get things moving again. The reset is done in
# dhclient-enter-hooks, we just wait for it to take
# effect here.
#
if [ -n "$_nfe" ]; then
echo "Engaging control net nfe hack on: $_nfe ..."
cnet_nfe_hack $_nfe >>$ELAB_LOGDIR/netif-emulab.log 2>&1
fi
if [ -e $ELAB_BOOTDIR/controlif ]; then
_cif=`cat $ELAB_BOOTDIR/controlif`
echo "Emulab control net is $_cif"
else
echo "*** No Emulab control net found!"
fi
fi
else
#
# configure according to static WA_X vars:
#
echo "Emulab statically configuring control net on $cnetif ..."
ifconfig "$cnetif" inet "$WA_IP_ADDR" netmask "$WA_IP_NETMASK" up
route add default "$WA_IP_GATEWAY"
# bring up lo0 too, since we neuter netif
ifconfig lo0 inet 127.0.0.1 up
route add 127.0.0.1 -interface lo0
# setup resolv.conf
echo "search $WA_DOMAIN" > /etc/resolv.conf
echo "nameserver $WA_IP_DNS1" >> /etc/resolv.conf
if [ "$WA_IP_DNS2" != "" ]; 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" > $ELAB_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 180 ]; do
echo "Failed to resolve boss ($bossnode)!"
sleep 5
i=`expr $i + 1`
bossip=`host -t A "$bossnode"`
retval="$?"
done