diff --git a/configure b/configure index e7cae0367448b7a6f9c5fda33976141d15938544..dbee9e962ad0b0ed272083f5ffd53b468845c3cb 100755 --- a/configure +++ b/configure @@ -2437,8 +2437,8 @@ outfiles="$outfiles Makeconf GNUmakefile \ tmcd/linux9/GNUmakefile tmcd/linux9/supfile \ tmcd/linux-sg/GNUmakefile \ tmcd/freebsd5/GNUmakefile tmcd/freebsd5/supfile \ - tmcd/freebsd6/GNUmakefile tmcd/freebsd6/supfile \ - tmcd/freebsd6/netif-emulab \ + tmcd/freebsd6/GNUmakefile tmcd/freebsd6/supfile tmcd/freebsd6/netif-emulab \ + tmcd/freebsd7/GNUmakefile tmcd/freebsd7/supfile tmcd/freebsd7/netif-emulab \ tmcd/cygwinxp/GNUmakefile \ tmcd/openbsd/GNUmakefile tmcd/ron/GNUmakefile tmcd/plab/GNUmakefile \ utils/GNUmakefile utils/vlandiff utils/vlansync utils/delay_config \ diff --git a/configure.in b/configure.in index 16c0e996fa1f9acbfa7d0d7205cc2cbc74041f16..bc1fd48ac5ddeb3f35aca7f4307e442a9c968e6c 100755 --- a/configure.in +++ b/configure.in @@ -824,8 +824,8 @@ outfiles="$outfiles Makeconf GNUmakefile \ tmcd/linux9/GNUmakefile tmcd/linux9/supfile \ tmcd/linux-sg/GNUmakefile \ tmcd/freebsd5/GNUmakefile tmcd/freebsd5/supfile \ - tmcd/freebsd6/GNUmakefile tmcd/freebsd6/supfile \ - tmcd/freebsd6/netif-emulab \ + tmcd/freebsd6/GNUmakefile tmcd/freebsd6/supfile tmcd/freebsd6/netif-emulab \ + tmcd/freebsd7/GNUmakefile tmcd/freebsd7/supfile tmcd/freebsd7/netif-emulab \ tmcd/cygwinxp/GNUmakefile \ tmcd/openbsd/GNUmakefile tmcd/ron/GNUmakefile tmcd/plab/GNUmakefile \ utils/GNUmakefile utils/vlandiff utils/vlansync utils/delay_config \ diff --git a/tmcd/common/ntpstart b/tmcd/common/ntpstart index 96ba626b06a8909b2f408e1267863797bf230089..0acaa8854e6a7204e689dc59ee93f2c4929e7951 100755 --- a/tmcd/common/ntpstart +++ b/tmcd/common/ntpstart @@ -1,7 +1,7 @@ #!/usr/bin/perl -w # # EMULAB-COPYRIGHT -# Copyright (c) 2000-2005 University of Utah and the Flux Group. +# Copyright (c) 2000-2006 University of Utah and the Flux Group. # All rights reserved. # use English; @@ -55,6 +55,14 @@ my @tmccresults; # Since this is a wrapper, we have to try to start ntp no matter what. # sub ntpstart () { + # + # XXX FreeBSD 7 prepends "-c <configfile>" to the arguments + # which in our case means before the command name! + # + if ($ARGV[0] eq "-c") { + shift @ARGV; + shift @ARGV; + } if ($debug) { print "@ARGV\n"; return 0; @@ -225,4 +233,3 @@ sub fatal($) " $msg\n"; exit(ntpstart()); } - diff --git a/tmcd/freebsd7/GNUmakefile.in b/tmcd/freebsd7/GNUmakefile.in new file mode 100644 index 0000000000000000000000000000000000000000..d47670222affd1996f87fef7a2041ce442b41843 --- /dev/null +++ b/tmcd/freebsd7/GNUmakefile.in @@ -0,0 +1,92 @@ +# +# EMULAB-COPYRIGHT +# Copyright (c) 2000-2006 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 = ../.. +SUBDIR = tmcd/freebsd7 + +include $(OBJDIR)/Makeconf + +SCRIPTS = + +# +# Force dependencies on the scripts so that they will be rerun through +# configure if the .in file is changed. +# +all: supfile 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 + +install client-install: bincheck basefbsd-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 $(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 -f $(SYSETCDIR)/rc.conf.d/dhclient + rm -f $(DESTDIR)/usr/local/etc/dhclient* + ln -s /etc/dhclient* $(DESTDIR)/usr/local/etc/ + +sup-install: dir-install supfile + $(INSTALL) -m 755 ./supfile $(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 + +sysetc-install: dir-install netif-emulab + $(INSTALL) -m 444 $(SRCDIR)/rc.conf $(SYSETCDIR)/rc.conf + $(INSTALL) -m 755 $(SRCDIR)/dhclient-exit-hooks \ + $(SYSETCDIR)/dhclient-exit-hooks + $(INSTALL) -m 555 ./netif-emulab $(SYSETCDIR)/rc.d/netif-emulab + +script-install: dir-install +# $(INSTALL) -m 755 $(SRCDIR)/prepare $(BINDIR)/prepare diff --git a/tmcd/freebsd7/dhclient-exit-hooks b/tmcd/freebsd7/dhclient-exit-hooks new file mode 100644 index 0000000000000000000000000000000000000000..3b7da957146998607703162a1c48642cbb183e80 --- /dev/null +++ b/tmcd/freebsd7/dhclient-exit-hooks @@ -0,0 +1,121 @@ +#!/bin/sh +# +# EMULAB-COPYRIGHT +# Copyright (c) 2000-2005 University of Utah and the Flux Group. +# All rights reserved. +# +. /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 + +# +# 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 + +# +# 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 + +# +# 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 + +# +# 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 +if [ -n "$interface" ]; then + echo $interface > $BOOTDIR/controlif +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 +# the sethostname script won't fail. +# +if [ "$new_network_number" = "10.200.1.0" ]; then + for i in 0 1 2; do + if `$BINDIR/tmcc bossinfo >/dev/null 2>&1`; then + break + fi + echo "${interface}: waiting for DNS.." >>$LOGDIR/dhclient-exit.log 2>&1 + sleep $i + done +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 + +# +# Once we have an IP address, we can stop dhclient so that it doesn't get +# in the way. +# +# 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 + +# +# And shutdown all the other interfaces that dhclient was trying +# +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 + +echo "`date`: ${interface}: ${reason}: done" >>$LOGDIR/dhclient-exit.log 2>&1 + +exit 0 diff --git a/tmcd/freebsd7/group b/tmcd/freebsd7/group new file mode 100644 index 0000000000000000000000000000000000000000..0f87214b083d7ff8df34b63dce1f2c564a446eb0 --- /dev/null +++ b/tmcd/freebsd7/group @@ -0,0 +1,31 @@ +# $FreeBSD: src/etc/group,v 1.34 2006/02/05 19:34:09 rwatson 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: +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: +sfs:*:171: +nogroup:*:65533: +nobody:*:65534: diff --git a/tmcd/freebsd7/master.passwd b/tmcd/freebsd7/master.passwd new file mode 100644 index 0000000000000000000000000000000000000000..ee6735265a66a671b1ca5ff2efd4a236818fd8eb --- /dev/null +++ b/tmcd/freebsd7/master.passwd @@ -0,0 +1,24 @@ +# $FreeBSD: src/etc/master.passwd,v 1.40 2005/06/06 20:19:56 brooks Exp $ +# +root:kEi.I6fTKyJDg:0:0::0:0:Charlie &:/root:/bin/csh +toor:kEi.I6fTKyJDg: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 +sfs:*:171:171::0:0:SFS pseudo-user:/:/usr/sbin/nologin +nobody:*:65534:65534::0:0:Unprivileged user:/nonexistent:/usr/sbin/nologin diff --git a/tmcd/freebsd7/netif-emulab.in b/tmcd/freebsd7/netif-emulab.in new file mode 100644 index 0000000000000000000000000000000000000000..420374ee72a9ed951e4c8e1b486ba4a351bd46d3 --- /dev/null +++ b/tmcd/freebsd7/netif-emulab.in @@ -0,0 +1,94 @@ +# +# 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 pccard 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= + +# this is a separate function so we can redirect all the output below +cnet_dhcp() +{ + # + # Argh! 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]*//'` + + # + # Argh V2! 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..." + for _if in $*; do + ${dhclient_program} ${dhclient_flags} -b $_if + done + wait + fi +} + +cnet_start() +{ + rm -f @CLIENT_VARDIR@/boot/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*) + ;; + ath*) + ;; + *) + _ifs="$_ifs $_if" + ;; + esac + done + + echo "Emulab looking for control net among: $_ifs ..." + cnet_dhcp $_ifs >@CLIENT_VARDIR@/logs/netif-emulab.log 2>&1 + if [ -e @CLIENT_VARDIR@/boot/controlif ]; then + echo "Emulab control net is `cat @CLIENT_VARDIR@/boot/controlif`" + else + echo "*** No Emulab control net found!" + fi +} + +cnet_stop() +{ + rm -f @CLIENT_VARDIR@/boot/controlif +} + +load_rc_config $name +run_rc_command $* diff --git a/tmcd/freebsd7/rc.conf b/tmcd/freebsd7/rc.conf new file mode 100644 index 0000000000000000000000000000000000000000..4ed45ea047af8a97ae266418d748b36c652cc662 --- /dev/null +++ b/tmcd/freebsd7/rc.conf @@ -0,0 +1,54 @@ +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" + +rc_info="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_flags="-i 15" diff --git a/tmcd/freebsd7/supfile.in b/tmcd/freebsd7/supfile.in new file mode 100644 index 0000000000000000000000000000000000000000..eb948ac5891686f933ad79bb55f6f82415599e89 --- /dev/null +++ b/tmcd/freebsd7/supfile.in @@ -0,0 +1,4 @@ +# +# Bump as needed. +# +FBSD70-STD base=@CLIENT_VARDIR@ prefix=/ preserve release=20061221