Commit a82f9ac8 authored by David Johnson's avatar David Johnson

Add Ubuntu 16 support (both x86 and aarch64).

This is all pretty vanilla atop the Ubuntu 15 support.  Just new
metadata files (passwd,group,shadow,gshadow); pulling in Kirk's Centos
ntp.service; and an important tweak to the dhclient exit hook.

resolvconf seems to be more prominently featured in Ubuntu 16, and it
has a dhclient exit hook to alert the resolvconf stuff (so it can alert
others) when nameservers change.  However, that hook somehow breaks DNS
for our exit hook right as it calls sethostname.dhclient .  So to fix
this, I just added a check for /sbin/resolvconf in the exit hook, and if
that exists, we use the same elabinelab DNS-problem-avoidance strategy
of manually invoking the tmcc binary with getbossinfo, so that the perl
tmcc stuff doesn't hang in sethostname.client .  That works great.

aarch64 (ubuntu16-ms) support is a very simple overlay atop the regular
ubuntu16 dir; it only adds the special uboot boot.scr modification file
we need.
parent 1a24d8c2
......@@ -4570,6 +4570,8 @@ outfiles="Makeconf GNUmakefile setversion \
tmcc/ubuntu11/GNUmakefile \
tmcc/ubuntu14/GNUmakefile \
tmcc/ubuntu15/GNUmakefile \
tmcc/ubuntu16/GNUmakefile \
tmcc/ubuntu16-ms/GNUmakefile \
tmcc/linux-ms/GNUmakefile \
tmcc/freebsd5/GNUmakefile tmcc/freebsd5/supfile \
tmcc/freebsd6/GNUmakefile tmcc/freebsd6/supfile \
......
......@@ -297,6 +297,8 @@ outfiles="Makeconf GNUmakefile setversion \
tmcc/ubuntu11/GNUmakefile \
tmcc/ubuntu14/GNUmakefile \
tmcc/ubuntu15/GNUmakefile \
tmcc/ubuntu16/GNUmakefile \
tmcc/ubuntu16-ms/GNUmakefile \
tmcc/linux-ms/GNUmakefile \
tmcc/freebsd5/GNUmakefile tmcc/freebsd5/supfile \
tmcc/freebsd6/GNUmakefile tmcc/freebsd6/supfile \
......
#
# Copyright (c) 2000-2015 University of Utah and the Flux Group.
# Copyright (c) 2000-2016 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -96,6 +96,9 @@ endif
ifeq ($(MDSUBDIR),redhat9)
MDSUBDIR = linux9
endif
ifeq ($(MDSUBDIR),MoonshotUbuntu16)
MDSUBDIR = ubuntu16-ms
endif
ifeq ($(MDSUBDIR),Moonshot)
MDSUBDIR = linux-ms
endif
......
#!/bin/sh
#
# Copyright (c) 2007-2015 University of Utah and the Flux Group.
# Copyright (c) 2007-2016 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -131,7 +131,11 @@ Linux)
rel=1.0 # XXX probably wrong
fi
if [ "$dist" = "Ubuntu" -a `uname -m` = "aarch64" ]; then
tag=Moonshot
if [ "$rel" = "16.04" ]; then
tag=MoonshotUbuntu16
else
tag=Moonshot
fi
fi
;;
CYGWIN_NT-*) # aka Windows XP/7
......
setenv bootargs ${bootargs} root=/dev/sda1
#
# Copyright (c) 2000-2012, 2015, 2016 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 AN UBUNTU LINUX 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: supfile ifcfgs
include $(TESTBED_SRCDIR)/GNUmakerules
SYSETCDIR = $(DESTDIR)/etc
ETCDIR = $(DESTDIR)$(CLIENT_ETCDIR)
BINDIR = $(DESTDIR)$(CLIENT_BINDIR)
VARDIR = $(DESTDIR)$(CLIENT_VARDIR)
RCDIR = $(SYSETCDIR)
RRCDIR = /etc
INSTALL = /usr/bin/install -c
COMMON = $(SRCDIR)/../common
DEFRUNLVLDIR ?= $(SYSETCDIR)/rc3.d
install client-install: common-install etc-install \
script-install bin-install sysetc-fixup sysetc-install \
systemd-install
@echo "Remember to install the PEM files if necessary"
simple-install: common-install script-install bin-install
dir-install:
(cd ../ubuntu16; $(MAKE) DESTDIR=$(DESTDIR) RCDIR=$(RCDIR) dir-install)
$(INSTALL) -m 755 -o root -g root -d $(SYSETCDIR)/flash-kernel
$(INSTALL) -m 755 -o root -g root -d $(SYSETCDIR)/flash-kernel/ubootenv.d
common-install: dir-install
(cd ../common; $(MAKE) DESTDIR=$(DESTDIR) local-install)
bin-install: dir-install
(cd ../ubuntu16; $(MAKE) DESTDIR=$(DESTDIR) RCDIR=$(RCDIR) bin-install)
etc-install: dir-install common-sysetc-install
(cd ../ubuntu16; $(MAKE) DESTDIR=$(DESTDIR) RCDIR=$(RCDIR) etc-install)
$(INSTALL) -m 644 $(SRCDIR)/group $(ETCDIR)/group
$(INSTALL) -m 644 $(SRCDIR)/passwd $(ETCDIR)/passwd
$(INSTALL) -m 600 $(SRCDIR)/shadow $(ETCDIR)/shadow
$(INSTALL) -m 600 $(SRCDIR)/gshadow $(ETCDIR)/gshadow
common-sysetc-install: dir-install
(cd ../ubuntu16; $(MAKE) DESTDIR=$(DESTDIR) RCDIR=$(RCDIR) common-sysetc-install)
sysetc-fixup:
(cd ../ubuntu16; $(MAKE) DESTDIR=$(DESTDIR) RCDIR=$(RCDIR) sysetc-fixup)
sysetc-install: dir-install
(cd ../ubuntu16; $(MAKE) DESTDIR=$(DESTDIR) RCDIR=$(RCDIR) sysetc-install)
$(INSTALL) -m 644 $(SRCDIR)/99-emulab $(SYSETCDIR)/flash-kernel/ubootenv.d/99-emulab
systemd-install: dir-install
(cd ../ubuntu16; $(MAKE) DESTDIR=$(DESTDIR) RCDIR=$(RCDIR) systemd-install)
script-install: dir-install $(SCRIPTS)
(cd ../ubuntu16; $(MAKE) DESTDIR=$(DESTDIR) RCDIR=$(RCDIR) script-install)
genirack-install:
sfs-install:
root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:syslog
tty:x:5:
disk:x:6:
lp:x:7:
mail:x:8:
news:x:9:
uucp:x:10:
man:x:12:
proxy:x:13:
kmem:x:15:
dialout:x:20:
fax:x:21:
voice:x:22:
cdrom:x:24:
floppy:x:25:
tape:x:26:
sudo:x:27:
audio:x:29:
dip:x:30:
www-data:x:33:
backup:x:34:
operator:x:37:
list:x:38:
irc:x:39:
src:x:40:
gnats:x:41:
shadow:x:42:
utmp:x:43:
video:x:44:
sasl:x:45:
plugdev:x:46:
staff:x:50:
games:x:60:
users:x:100:
nogroup:x:65534:
systemd-journal:x:101:
systemd-timesync:x:102:
systemd-network:x:103:
systemd-resolve:x:104:
systemd-bus-proxy:x:105:
input:x:106:
crontab:x:107:
syslog:x:108:
netdev:x:109:
messagebus:x:110:
uuidd:x:111:
mlocate:x:112:
ssh:x:113:
_cvsadmin:x:114:
ntp:x:115:
scanner:x:116:
colord:x:117:
ssl-cert:x:118:
root:*::
daemon:*::
bin:*::
sys:*::
adm:*::syslog
tty:*::
disk:*::
lp:*::
mail:*::
news:*::
uucp:*::
man:*::
proxy:*::
kmem:*::
dialout:*::
fax:*::
voice:*::
cdrom:*::
floppy:*::
tape:*::
sudo:*::
audio:*::
dip:*::
www-data:*::
backup:*::
operator:*::
list:*::
irc:*::
src:*::
gnats:*::
shadow:*::
utmp:*::
video:*::
sasl:*::
plugdev:*::
staff:*::
games:*::
users:*::
nogroup:*::
systemd-journal:!::
systemd-timesync:!::
systemd-network:!::
systemd-resolve:!::
systemd-bus-proxy:!::
input:!::
crontab:!::
syslog:!::
netdev:!::
messagebus:!::
uuidd:!::
mlocate:!::
ssh:!::
_cvsadmin:!::
ntp:!::
scanner:!::
colord:!::
ssl-cert:!::
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/usr/sbin/nologin
man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
systemd-timesync:x:100:102:systemd Time Synchronization,,,:/run/systemd:/bin/false
systemd-network:x:101:103:systemd Network Management,,,:/run/systemd/netif:/bin/false
systemd-resolve:x:102:104:systemd Resolver,,,:/run/systemd/resolve:/bin/false
systemd-bus-proxy:x:103:105:systemd Bus Proxy,,,:/run/systemd:/bin/false
syslog:x:104:108::/home/syslog:/bin/false
_apt:x:105:65534::/nonexistent:/bin/false
messagebus:x:106:110::/var/run/dbus:/bin/false
uuidd:x:107:111::/run/uuidd:/bin/false
sshd:x:108:65534::/var/run/sshd:/usr/sbin/nologin
ntp:x:109:115::/home/ntp:/bin/false
colord:x:110:117:colord colour management daemon,,,:/var/lib/colord:/bin/false
statd:x:111:65534::/var/lib/nfs:/bin/false
root:$6$T4LdwCw1$FfjB6KXDVP4Dhrae3aO6r8WEt5vLLZX/HtNFJbyWV4Pc5j80Kv0xDlVJmaXhY2Ye455vGomDCF7HY8hCqLBBF/:16997:0:99999:7:::
daemon:*:16997:0:99999:7:::
bin:*:16997:0:99999:7:::
sys:*:16997:0:99999:7:::
sync:*:16997:0:99999:7:::
games:*:16997:0:99999:7:::
man:*:16997:0:99999:7:::
lp:*:16997:0:99999:7:::
mail:*:16997:0:99999:7:::
news:*:16997:0:99999:7:::
uucp:*:16997:0:99999:7:::
proxy:*:16997:0:99999:7:::
www-data:*:16997:0:99999:7:::
backup:*:16997:0:99999:7:::
list:*:16997:0:99999:7:::
irc:*:16997:0:99999:7:::
gnats:*:16997:0:99999:7:::
nobody:*:16997:0:99999:7:::
systemd-timesync:*:16997:0:99999:7:::
systemd-network:*:16997:0:99999:7:::
systemd-resolve:*:16997:0:99999:7:::
systemd-bus-proxy:*:16997:0:99999:7:::
syslog:*:16997:0:99999:7:::
_apt:*:16997:0:99999:7:::
messagebus:*:16997:0:99999:7:::
uuidd:*:16997:0:99999:7:::
sshd:*:16997:0:99999:7:::
ntp:*:16997:0:99999:7:::
colord:*:16997:0:99999:7:::
statd:*:16997:0:99999:7:::
#
# Copyright (c) 2000-2012, 2015, 2016 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 AN UBUNTU LINUX 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: supfile ifcfgs
include $(TESTBED_SRCDIR)/GNUmakerules
SYSETCDIR = $(DESTDIR)/etc
ETCDIR = $(DESTDIR)$(CLIENT_ETCDIR)
BINDIR = $(DESTDIR)$(CLIENT_BINDIR)
VARDIR = $(DESTDIR)$(CLIENT_VARDIR)
RCDIR = $(SYSETCDIR)
RRCDIR = /etc
INSTALL = /usr/bin/install -c
COMMON = $(SRCDIR)/../common
DEFRUNLVLDIR ?= $(SYSETCDIR)/rc3.d
install client-install: common-install etc-install \
script-install bin-install sysetc-fixup sysetc-install \
systemd-install
@echo "Remember to install the PEM files if necessary"
simple-install: common-install script-install bin-install
dir-install:
$(INSTALL) -m 755 -o root -g root -d $(SYSETCDIR)/dhcp
$(INSTALL) -m 755 -o root -g root -d $(SYSETCDIR)/dhcp/dhclient-enter-hooks.d
$(INSTALL) -m 755 -o root -g root -d $(SYSETCDIR)/dhcp/dhclient-exit-hooks.d
$(INSTALL) -m 755 -o root -g root -d $(SYSETCDIR)/network
$(INSTALL) -m 755 -o root -g root -d $(SYSETCDIR)/rsyslog.d
$(INSTALL) -m 755 -o root -g root -d $(SYSETCDIR)/sudoers.d
$(INSTALL) -m 755 -o root -g root -d $(SYSETCDIR)/systemd
$(INSTALL) -m 755 -o root -g root -d $(SYSETCDIR)/systemd/system
$(INSTALL) -m 755 -o root -g root -d $(SYSETCDIR)/systemd/system/network-online.target.wants
$(INSTALL) -m 755 -o root -g root -d $(SYSETCDIR)/systemd/system/multi-user.target.wants
common-install: dir-install
(cd ../common; $(MAKE) DESTDIR=$(DESTDIR) local-install)
bin-install: dir-install
(cd ../linux; $(MAKE) DESTDIR=$(DESTDIR) RCDIR=$(RCDIR) USES_SYSTEMD=1 bin-install)
$(INSTALL) -m 755 $(SRCDIR)/findcnet $(BINDIR)/findcnet
etc-install: dir-install common-sysetc-install
$(INSTALL) -m 644 $(SRCDIR)/group $(ETCDIR)/group
$(INSTALL) -m 644 $(SRCDIR)/passwd $(ETCDIR)/passwd
$(INSTALL) -m 600 $(SRCDIR)/shadow $(ETCDIR)/shadow
$(INSTALL) -m 600 $(SRCDIR)/gshadow $(ETCDIR)/gshadow
$(INSTALL) -m 644 $(SRCDIR)/hosts $(ETCDIR)/hosts
common-sysetc-install: dir-install
# Tell ../linux/GNUMakefile.in that we want systemd files, not SYSV
(cd ../linux; $(MAKE) DESTDIR=$(DESTDIR) RCDIR=$(RCDIR) RRCDIR=$(RRCDIR) USES_SYSTEMD=1 sysetc-install)
sysetc-fixup:
rm -rf $(SYSETCDIR)/modules.conf $(SYSETCDIR)/cron.pend \
$(SYSETCDIR)/sysconfig $(SYSETCDIR)/init.d/ntpd
rm -f $(SYSETCDIR)/dhclient-enter-hooks $(SYSETCDIR)/dhclient-exit-hooks
rm -f $(SYSETCDIR)/rc.local
sysetc-install: dir-install
$(INSTALL) -m 755 $(SRCDIR)/dhclient-exit-hooks \
$(SYSETCDIR)/dhcp/dhclient-exit-hooks.d/emulab
$(INSTALL) -m 755 $(SRCDIR)/dhclient-enter-hooks \
$(SYSETCDIR)/dhcp/dhclient-enter-hooks.d/emulab
$(INSTALL) -m 644 $(SRCDIR)/rsyslog-emulab.conf $(SYSETCDIR)/rsyslog.d/60-emulab.conf
$(INSTALL) -m 755 $(SRCDIR)/rc.local $(SYSETCDIR)/rc.local
$(INSTALL) -m 644 $(SRCDIR)/interfaces $(SYSETCDIR)/network/interfaces
$(INSTALL) -m 644 $(SRCDIR)/sudoers $(SYSETCDIR)/sudoers.d/99-emulab
$(INSTALL) -m 644 $(SRCDIR)/ntp.conf $(SYSETCDIR)/ntp.conf
$(INSTALL) -m 644 -o ntp -g ntp /dev/null /etc/ntp.drift
ln -sf /etc/ntp.drift /var/lib/ntp/ntp.drift
systemd-install: dir-install
$(INSTALL) -m 644 $(SRCDIR)/ifup-wait-emulab-cnet.service \
$(SYSETCDIR)/systemd/system/ifup-wait-emulab-cnet.service
$(INSTALL) -m 644 $(SRCDIR)/ifup-wait-emulab-cnet.service \
/etc/emulab/ifup-wait-emulab-cnet.service
rm -f $(SYSETCDIR)/systemd/system/network-online.target.wants/ifup-wait-all-auto.service
ln -sf ../ifup-wait-emulab-cnet.service \
$(SYSETCDIR)/systemd/system/network-online.target.wants/ifup-wait-emulab-cnet.service
$(INSTALL) -m 644 $(SRCDIR)/ntp.service $(SYSETCDIR)/systemd/system
ln -sf $(SYSETCDIR)/systemd/system/ntp.service \
$(SYSETCDIR)/systemd/system/multi-user.target.wants/ntp.service
@if [ -z "$(DESTDIR)" ]; then \
systemctl daemon-reload; \
fi
script-install: dir-install $(SCRIPTS)
(cd ../linux; $(MAKE) DESTDIR=$(DESTDIR) RCDIR=$(RCDIR) USES_SYSTEMD=1 script-install)
genirack-install:
sfs-install:
#!/bin/sh
#
# Copyright (c) 2004-2009 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
#
# Sweet! dhclient on linux wants to DHCP on the loopback interface
# thus screwing up its default setting. Put a stop to that early on!
#
if [ xxx$interface = xxxlo ]; then
exit_status=1
return
fi
echo "`date`: ${interface}: ${reason}" >>$LOGDIR/dhclient-enter.log 2>&1
#
# XXX Hack to force the duplex on interfaces
#
setduplex() {
_if=$1
_rc=0
if [ -x /sbin/ethtool ]; then
_ethtool=/sbin/ethtool
else
_ethtool=/usr/sbin/ethtool
fi
_out=`$_ethtool $_if`
if [ $? -eq 0 ]; then
_hmb=`echo $_out | grep -c 'Speed: 100Mb/s'`
_fdx=`echo $_out | grep -c 'Duplex: Full'`
else
_out=`/sbin/mii-tool $_if`
_hmb=`echo $_out | grep -c '100 Mbit'`
_fdx=`echo $_out | grep -c 'full duplex'`
fi
if [ $_hmb -ne 0 -a $_fdx -ne 0 ]; then
echo "$_if: speed/duplex correct"
else
echo -n "$_if: fixing speed/duplex..."
if $_ethtool $_if >/dev/null 2>&1; then
$_ethtool -s $_if autoneg off speed 100 duplex full
else
/sbin/mii-tool --force=100baseTx-FD $_if
fi
_rc=$?
echo "returns $_rc"
fi
return $_rc
}
if [ x$reason != xREBOOT -a x$reason != xBOUND -a x$reason != xRENEW -a x$reason != xREBIND ]
then
# do nothing
true
elif [ x"$new_domain_name_servers" = "x1.1.1.1" ]; then
#
# ElabinElab support.
#
# XXX oh so hacky. Real boss is set to return 1.1.1.1 as a name server
# for nodes in inner elabs. This is the hack de jour for determining
# who has responded to our DHCP request. If it is outer boss and we are
# an inner node, we want to decline this offer and not configure the
# interface
#
exit_status=1
#
# XXX it just keeps getting better! The Ubuntu (Debian?) dhclient-script
# doesn't check that status code and just plows ahead. Thus we will wind
# up with a resolv.conf file with 1.1.1.1 as the name server. So if we
# currently have a legit resolv.conf (one without a 1.1.1.1 nameserver),
# save that off so we can restore it in the exit hook.
#
if grep -q 1.1.1.1 /etc/resolv.conf; then
echo "`date`: ${interface}: resolv.conf already bad"
else
echo "`date`: ${interface}: saving current resolv.conf"
cp -p /etc/resolv.conf /etc/resolv.conf.good
fi >>$LOGDIR/dhclient-enter.log 2>&1
#
# XXX since we now know that we are in an inner elab and we know which
# interface is the real control net, we force 100Mb full-duplex on all
# other (experimental) interfaces. This is necessary to ensure a
# response from the inner control net.
#
for _if in `ifconfig -s | awk '{ print $1 }' | grep -v Iface`
do
if [ $_if != "lo" -a x$_if != x$interface ]; then
setduplex $_if >>$LOGDIR/dhclient-enter.log 2>&1
fi
done
#
# XXX sleep here so we don't pummel boss with REQUEST/DECLINE pairs.
#
sleep 3
elif [ "$new_network_number" = "10.200.1.0" ]; then
#
# XXX sometime we can get a reply even if the duplex is wrong.
# If we get such a reply and we are inside an inner elab, again
# force 100Mb full-duplex to make sure we continue to communicate
# with the server.
#
setduplex $interface >>$LOGDIR/dhclient-enter.log 2>&1
fi
echo "`date`: ${interface}: ${reason}: done" >>$LOGDIR/dhclient-enter.log 2>&1
#!/bin/sh
#
# Copyright (c) 2000-2012, 2016 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
#
# 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.
#
# XXX we will get here on Ubuntu (Debian?), as the exit status of the
# enter hook is not checked (see dhclient-enter-hook). At this point
# we have a bogus resolv.conf file and we must fix it up.
#
if [ x"$new_domain_name_servers" = "x1.1.1.1" ]; then
echo -n "`date`: ${interface}: exit with bad name server..."
if [ -f /etc/resolv.conf.good ]; then
echo "replacing"
mv /etc/resolv.conf.good /etc/resolv.conf
else
echo "no good replacement, removing"
cp /dev/null /etc/resolv.conf
fi
exit_status=1
exit 1
fi >>$LOGDIR/dhclient-exit.log 2>&1
#
# 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
#
# 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.
#
# resolveconf on Linux also breaks DNS momentarily via dhclient exit hook.
# So if we have that, avoid it, too.
#
if [ "$new_network_number" = "10.200.1.0" -o -x /sbin/resolvconf ]; then
for i in 0 1 2; do
if `$BINDIR/tmcc bossinfo >/dev/null 2>&1`; then
break
fi
echo "`date`: ${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.
#
$BINDIR/sethostname.dhclient >>$LOGDIR/dhclient.log 2>&1
echo "`date`: ${interface}: ${reason}: done" >>$LOGDIR/dhclient-exit.log 2>&1
#
# The killing of dhclient and shutdown of other interfaces is handled
# by the dhclient caller (sysconfig/network-scripts/ifcfg-eth99)
#
exit 0
#!/bin/sh
#
# Find the Emulab control network interface.
#
# When called the first time (an invocation on any interface when
# /var/emulab/boot/controlif does not exist) we run DHCP and find the
# control network.
#
# On all invocations, we check the contents of that file against the
# 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