Commit 8dbe7f4b authored by Mike Hibler's avatar Mike Hibler

FreeBSD 10 client-side support.

parent 2f4ba4e1
......@@ -4925,8 +4925,9 @@ outfiles="Makeconf GNUmakefile \
tmcc/ubuntu11/GNUmakefile \
tmcc/freebsd5/GNUmakefile tmcc/freebsd5/supfile \
tmcc/freebsd6/GNUmakefile tmcc/freebsd6/supfile \
tmcc/freebsd6/netif-emulab tmcc/freebsd7/GNUmakefile \
tmcc/freebsd7/supfile tmcc/freebsd7/netif-emulab \
tmcc/freebsd6/netif-emulab \
tmcc/freebsd7/GNUmakefile tmcc/freebsd7/netif-emulab \
tmcc/freebsd10/GNUmakefile tmcc/freebsd10/netif-emulab \
tmcc/cygwinxp/GNUmakefile tmcc/dp/GNUmakefile \
tmcc/openbsd/GNUmakefile tmcc/ron/GNUmakefile \
tmcc/plab/GNUmakefile \
......
......@@ -237,8 +237,9 @@ outfiles="Makeconf GNUmakefile \
tmcc/ubuntu11/GNUmakefile \
tmcc/freebsd5/GNUmakefile tmcc/freebsd5/supfile \
tmcc/freebsd6/GNUmakefile tmcc/freebsd6/supfile \
tmcc/freebsd6/netif-emulab tmcc/freebsd7/GNUmakefile \
tmcc/freebsd7/supfile tmcc/freebsd7/netif-emulab \
tmcc/freebsd6/netif-emulab \
tmcc/freebsd7/GNUmakefile tmcc/freebsd7/netif-emulab \
tmcc/freebsd10/GNUmakefile tmcc/freebsd10/netif-emulab \
tmcc/cygwinxp/GNUmakefile tmcc/dp/GNUmakefile \
tmcc/openbsd/GNUmakefile tmcc/ron/GNUmakefile \
tmcc/plab/GNUmakefile \
......
......@@ -25,12 +25,14 @@ FBSDREL := $(shell uname -r | sed -e 's/\([^-][^-]*\)-.*/\1/')
FBSDMAJ := $(basename $(FBSDREL))
ifneq ($(FBSDMAJ),8)
ifneq ($(FBSDMAJ),9)
ifneq ($(FBSDMAJ),10)
# doesn't build right now due to API changes
SUBDIRS += delay-agent
endif
endif
endif
endif
endif
all: all-subdirs
......
......@@ -63,8 +63,9 @@ clean:
if [ -r Makefile ]; then $(MAKE) -f Makefile clean; fi
rm -f config.h config.log stamp-h1
reallyclean:
rm -rf config.status iperf-2.0.2 $(TARBALL)
reallyclean: clean
rm -rf config.status Makefile compat doc include src \
iperf-2.0.2 $(TARBALL)
Makefile: config.status
......
......@@ -39,12 +39,14 @@ ifneq ($(FBSDREL),5.3)
ifneq ($(FBSDMAJ),7)
ifneq ($(FBSDMAJ),8)
ifneq ($(FBSDMAJ),9)
ifneq ($(FBSDMAJ),10)
WITH_LTHREADS = 1
endif
endif
endif
endif
endif
endif
#ifndef WITH_MSERVER_NULL
WITH_MSERVER_NULL = 1
......
......@@ -50,12 +50,14 @@ ifneq ($(FBSDREL),5.3)
ifneq ($(FBSDMAJ),7)
ifneq ($(FBSDMAJ),8)
ifneq ($(FBSDMAJ),9)
ifneq ($(FBSDMAJ),10)
WITH_LTHREADS = 1
endif
endif
endif
endif
endif
endif
# Linux specific goop
ifeq ($(SYSTEM),Linux)
......
#!/bin/sh
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2005 University of Utah and the Flux Group.
# Copyright (c) 2000-2012 University of Utah and the Flux Group.
# All rights reserved.
#
. /etc/emulab/paths.sh
echo "`date`: ${interface}: ${reason}" >>$LOGDIR/dhclient-enter.log 2>&1
# For Freebsd 10
resolvconf_enable="NO"
#
# XXX Hack to force the duplex on interfaces
#
......
#!/bin/sh
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2010 University of Utah and the Flux Group.
# Copyright (c) 2000-2012 University of Utah and the Flux Group.
# All rights reserved.
#
. /etc/emulab/paths.sh
......@@ -81,6 +81,23 @@ if [ $reason = BOUND -a -z "$curhname" -a -n "$new_host_name" ]; then
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 [ "$gw" != "$new_routers" ]; then
echo "reset default route from \"$gw\" to \"$new_routers\""
route delete default >/dev/null 2>&1
route add default $new_routers >/dev/null 2>&1
fi
fi
#
# We have observed problems where changing the speed/duplex of a link
# leaves DNS a little wonky. So we whack on it til it responds so that
......
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2012 University of Utah and the Flux Group.
# All rights reserved.
#
#
# 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* $(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* $(DESTDIR)/usr/local/etc/
# 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
$(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
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* $(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* $(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
# $FreeBSD: src/etc/group,v 1.36 2011/01/28 22:28:12 pjd Exp $
#
wheel:*:0:root,toor
daemon:*:1:
kmem:*:2:root,toor
sys:*:3:root,toor
tty:*:4:root,toor
operator:*:5:root,toor
mail:*:6:
bin:*:7:
news:*:8:
man:*:9:
games:*:13:
ftp:*:14:
staff:*:20:root,toor
sshd:*:22:
smmsp:*:25:
mailnull:*:26:
guest:*:31:root,toor
bind:*:53:
proxy:*:62:
authpf:*:63:
_pflogd:*:64:
_dhcp:*:65:
uucp:*:66:
dialer:*:68:
network:*:69:
audit:*:77:
www:*:80:
hast:*:845:
nogroup:*:65533:
nobody:*:65534:
sfs:*:171:
messagebus:*:556:
polkit:*:562:
haldaemon:*:560:
# $FreeBSD: src/etc/hosts,v 1.16 2003/01/28 21:29:23 dbaker Exp $
#
# 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"
# wireless interfaces
if_ath_load="YES"
#
# Note, ACPI setting done via loader.conf.local.
# See the comment there.
#
# enable ASF
hw.bge.allow_asf=1
# force module path, our pxeboot can mess it up
module_path="/boot/kernel;/boot/modules"
# $FreeBSD: src/etc/master.passwd,v 1.42 2011/01/28 22:29:38 pjd Exp $
#
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/games:/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
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
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
sfs:*:171:171::0:0:SFS pseudo-user:/:/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
#
# 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
# 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 "Using dhclient port..."
dhclient_program="/usr/local/sbin/dhclient"
${dhclient_program} ${dhclient_flags} $*
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()
{
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*)
;;
ath*)
;;
*)
_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
echo "Emulab control net is `cat $ELAB_BOOTDIR/controlif`"
else
echo "*** No Emulab control net found!"
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
if [ "$retval" = "0" ]; then
echo "Resolved boss ($bossnode) to $bossip."
echo `echo "$bossip" | sed -n -e 's/.*has address\s*\(.*\)/\1/p'` \
> $ELAB_BOOTDIR/bossip
fi
fi
echo "$WA_HOSTNAME" > $ELAB_BOOTDIR/realname
echo "$WA_IP_GATEWAY" > $ELAB_BOOTDIR/routerip
echo "$WA_IP_ADDR" > $ELAB_BOOTDIR/myip
echo "$WA_IP_NETMASK" > $ELAB_BOOTDIR/mynetmask
fi
}
cnet_stop()
{
rm -f $ELAB_BOOTDIR/controlif
}
load_rc_config $name
run_rc_command $*
sendmail_enable="NO"
sshd_enable="YES"
nfs_client_enable="YES"
nfs_client_flags="-n 8"
# For SFS/Jails
rpcbind_enable="YES"
mountd_enable="YES"
nfs_server_enable="YES"
nfs_server_flags="-u -t -n 8"
# Emulab ntp configuration
# ntpstart will take care of running ntpdate, so leave it disabled
ntpd_enable="YES"
ntpd_program="/usr/local/etc/emulab/ntpstart"
ntpd_flags="/usr/sbin/ntpd -p /var/run/ntpd.pid"
# no displays
blanktime="NO"
# no dump by default
dumpdev="NO"
# no background activity once we are up
background_fsck="NO"
## debugging
#rc_info="YES"
#rc_debug="YES"
#
# FreeBSD has no way to say "DHCP on all available interfaces" without
# spelling out here what all those interfaces are. So here we just say
# to (statically) configure the loopback device. The real network
# interfaces are identified in rc.conf.d/dhclient for use by the
# rc.d/dhclient script.
#
# FreeBSD >= 6 has changed things yet again. Now, the rc.d/dhclient script
# expects to be called with an interface argument and apparently is not
# intended to be used as part of the default /etc/rc bootup. Instead, it
# is called manually from rc.d/netif for each interface. So we now hook
# that script via rc.conf.d/netif and run dhclient on all interfaces from
# there.
#
network_interfaces="lo0"
#
# Argh! dhclient in FreeBSD 5 has a new auto-background "feature",
# it dives into the background after 10 seconds regardless of whether
# it has received a response. This is fubar for us. Unfortunately,
# we cannot just crank this number through the roof because it is based
# on a polling interval which actually has a rational purpose. The timeout
# is actually (2 * polling_interval) where polling_interval is how often
# dhclient rechecks an interface without link. We need to keep this value
# reasonable in the event that we boot up and don't immediately have link
# on the control net. So lets try 15 seconds (30 second auto-background
# timeout) and see how things go.
#
dhclient_program="/usr/local/sbin/dhclient"
dhclient_flags="-i 15"
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2007-2012 University of Utah and the Flux Group.
# All rights reserved.
#
use English;
use Getopt::Std;
my $FSTAB = "/etc/fstab";
my $script = $0;
#
# Figure out if there is a swap device and add it to fstab.
# We used to do this in slicefix as part of the post-frisbee customization,
# but it is difficult to do a good job of it just using sh and sed given
# that the swap partition might be in a different slice than the filesystems.
#
sub swapenable();
sub addswap($$);
# Turn off line buffering on output
$| = 1;
swapenable();
exit(0);
sub swapenable()
{
my $rootfs;
my $nextcheck = 0;
if (!open(FD, "<$FSTAB")) {
print STDERR "*** WARNING: could not open $FSTAB for reading, ".
"no swap enabled\n";
return;
}
while (<FD>) {
my ($fs,$mpt,$type,$opt) = split;
if ($mpt eq "/") {
$rootfs = $fs;
next;
}
if ($type eq "swap") {
close(FD);
return;
}
}
close(FD);
#
# No swap device found, see if the disklabel of the root disk reveals one
#
my ($dtype, $dnum, $snum, $part);
if ($rootfs =~ /([a-zA-Z]+)(\d+)s(\d+)([a-z])/ ||
$rootfs =~ /([a-zA-Z]+)(\d+)([a-z])/) {
$dtype = $1;
$dnum = $2;
if (!defined($part)) {
$snum = "1";
$part = $3;
}
else {
$snum = $3;
$part = $4;
}
}
else {
print STDERR "*** WARNING: could not parse root device $rootfs, ".
"no swap enabled\n";
return;
}
my $disk = "${dtype}${dnum}";
my $slice = "${disk}s${snum}";
if (-e "/dev/$slice") {
my @lines = `disklabel $slice 2>/dev/null`;
if ($? != 0) {
print STDERR "*** WARNING: could not read disklabel of /dev/$slice, ".
"no swap enabled\n";
return;
}
chomp(@lines);
foreach $line (@lines) {
if ($line =~ /\s*([a-z]):\s+(\d+)\s+\d+\s+(\S+)/) {
my $part = $1;
my $size = $2;
my $fstype = $3;
if ($fstype eq "swap") {