Commit a071e63f authored by Mike Hibler's avatar Mike Hibler

Sigh...

Yet another version of the enter/exit scripts to get DHCP to work both
regular- and elabinelab-wise.  For regular experiments, nothing has changed.
New strategy for inner elab nodes: if we get a reply with dns server 1.1.1.1
(our current indication that the responder is real boss), then we know this
interface is the real control net.  So we hardwire the speed/duplex on
*every other* interface at this time.  Also had to resurrect a hack to
issue a few tmcc calls before running the sethostname script.  Apparently,
the first few DNS queries after a speed/duplex change may get lost.  This
causes tmcd calls to fail occasionally.  So make em fail early before we
try to do anything important.

Yuk, yuk, yuk.
parent a22274eb
......@@ -6,15 +6,43 @@
#
. /etc/emulab/paths.sh
if [ x$reason != xREBOOT -a x$reason != xBOUND -a x$reason != xRENEW ]
then
return 0
fi
echo "${interface}: ${reason}" >>$LOGDIR/dhclient-enter.log 2>&1
#
# ElabinElab support.
# XXX Hack to force the duplex on interfaces
#
if [ -e "$ETCDIR/outer_bossnode" ]; then
setduplex() {
_if=$1
_rc=0
_out=`ifconfig $_if`
_hmb=`echo $_out | grep -c '100baseTX'`
_fdx=`echo $_out | grep -c 'full-duplex'`
if [ $_hmb -ne 0 -a $_fdx -ne 0 ]; then
echo "$_if: speed/duplex correct"
else
# If we are fixing the current interface, just let dhclient do it
if [ x$_if = x$interface ]; then
echo "$_if: telling dhclient to fix speed/duplex"
medium="media 100baseTX mediaopt full-duplex"
else
echo -n "$_if: fixing speed/duplex..."
ifconfig $_if media 100baseTX mediaopt full-duplex
_rc=$?
echo "returns $_rc"
fi
fi
return $_rc
}
if [ x$reason != xREBOOT -a x$reason != xBOUND -a x$reason != xRENEW -a x$reason != xREBIND ]
then
# do nothing
true
elif [ -e "$ETCDIR/outer_bossnode" ]; then
#
# ElabinElab support.
#
# On inner boss/ops, we do not accept the following from the DHCPD
# server on outer boss. This stuff has been setup in /etc/rc.conf
......@@ -24,29 +52,43 @@ if [ -e "$ETCDIR/outer_bossnode" ]; then
unset new_domain_name_servers
unset new_domain_name
unset new_routers
elif [ "$new_host_name" = "" ]; then
elif [ x"$new_domain_name_servers" = "x1.1.1.1" ]; then
#
# Otherwise, if no hostname provided, it means that its an outer emulab
# returning DHCPD info, in which case we want to again ignore most of the
# info since all we want to do is configure the interface.
# ElabinElab support.
#
new_static_routes="$new_dhcp_server_identifier $new_routers"
unset new_domain_name_servers
unset new_domain_name
unset new_routers
new_subnet_mask="255.255.255.0"
# 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 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 -lu`
do
if [ $_if != "lo0" -a x$_if != x$interface ]; then
setduplex $_if >>$LOGDIR/dhclient-enter.log 2>&1
fi
done
#
# Ack, changed my mind. This is a pain in the ass. For now do not
# configure the outer interface; worry about it later.
# XXX sleep here so we don't pummel boss with REQUEST/DECLINE pairs.
#
#
sleep 5
exit_status=1
elif [ "$new_network_number" = "10.200.1.0" ]; then
#
# I am inside an inner elab, force 100Mb full-duplex
# since that is what the switch does
# 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.
#
medium="media 100baseTX mediaopt full-duplex"
setduplex $interface >>$LOGDIR/dhclient-enter.log 2>&1
fi
echo "${interface}: ${reason}: done" >>$LOGDIR/dhclient-enter.log 2>&1
#!/bin/sh
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2004 University of Utah and the Flux Group.
# Copyright (c) 2000-2005 University of Utah and the Flux Group.
# All rights reserved.
#
. /etc/emulab/paths.sh
if [ x$reason != xREBOOT -a x$reason != xBOUND -a x$reason != xRENEW ]
echo "${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
# ElabinElab support (inner boss and ops)
#
if [ -e "$ETCDIR/outer_bossnode" ]; then
#
......@@ -25,21 +27,28 @@ if [ -e "$ETCDIR/outer_bossnode" ]; then
# Then kill as we normally do.
killall dhclient >>$LOGDIR/dhclient.log 2>&1
exit 0
elif [ "$new_host_name" = "" ]; then
#
# Otherwise, if no hostname provided, it means that its an outer emulab
# returning DHCPD info, in which case all we want to do is configure the
# interface, but not allow dhclient to think it has finished its job.
# So, exit with non-zero status and dhclient will keep trying to configure
# another interface (the inner control network). This assumes this
# was the first interface to respond. If the inner control interface
# came up first, then dhclient is already in the background. See below;
# we are going to let dhclient keep running.
#
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
#
# Remember our server IP, real hostname, router IP, etc.
#
......@@ -52,6 +61,21 @@ 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
......@@ -82,4 +106,7 @@ do
ifconfig $_if down remove
fi >>$LOGDIR/dhclient.log 2>&1
done
echo "${interface}: ${reason}: done" >>$LOGDIR/dhclient-exit.log 2>&1
exit 0
#!/bin/sh
#
# EMULAB-COPYRIGHT
# Copyright (c) 2004, 2005 University of Utah and the Flux Group.
# Copyright (c) 2004-2005 University of Utah and the Flux Group.
# All rights reserved.
#
. /etc/emulab/paths.sh
......@@ -15,42 +15,81 @@ if [ xxx$interface = xxxlo ]; then
return
fi
if [ x$reason != xREBOOT -a x$reason != xBOUND -a x$reason != xRENEW -a x$reason != xREBIND ]
then
return
fi
echo "${interface}: ${reason}" >>$LOGDIR/dhclient-enter.log 2>&1
#
# ElabinElab support.
# XXX Hack to force the duplex on interfaces
#
if [ "$new_host_name" = "" ]; then
setduplex() {
_if=$1
_rc=0
_out=`/sbin/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 /sbin/ethtool $_if >/dev/null 2>&1; then
/sbin/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
#
# If no hostname provided, it means that its an outer emulab returning
# DHCPD info, in which case we want to again ignore most of the
# info since all we want to do is configure the interface.
# ElabinElab support.
#
new_static_routes="$new_dhcp_server_identifier $new_routers"
unset new_domain_name_servers
unset new_domain_name
unset new_routers
# 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 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
#
# Ack, changed my mind. This is a pain in the ass. For now do not
# configure the outer interface; worry about it later.
# XXX sleep here so we don't pummel boss with REQUEST/DECLINE pairs.
#
sleep 5
exit_status=1
elif [ "$new_network_number" = "10.200.1.0" ]; then
#
# I am inside an inner elab, force 100Mb full-duplex
# since that is what the switch does
#
# XXX Linux dhclient-script doesn't support "media" so we do it
# ourselves.
# 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.
#
if /sbin/ethtool $interface >/dev/null 2>&1; then
/sbin/ethtool -s $interface autoneg off speed 100 duplex full
else
/sbin/mii-tool --force=100baseTx-FD $interface
fi >$LOGDIR/dhclient-enter.log 2>&1
setduplex $interface >>$LOGDIR/dhclient-enter.log 2>&1
fi
echo "${interface}: ${reason}: done" >>$LOGDIR/dhclient-enter.log 2>&1
#!/bin/sh
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2004 University of Utah and the Flux Group.
# Copyright (c) 2000-2005 University of Utah and the Flux Group.
# All rights reserved.
#
. /etc/emulab/paths.sh
echo "${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
......@@ -14,17 +16,23 @@ fi
#
# ElabinElab support
#
if [ "$new_host_name" = "" ]; then
#
# If no hostname provided, it means that its an outer emulab
# returning DHCPD info, in which case all we want to do is configure the
# interface, but not allow dhclient to think it has finished its job.
# So, exit with non-zero status and dhclient will keep trying to configure
# another interface (the inner control network).
#
# 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
#
# Remember our server IP, real hostname, router IP, etc.
#
......@@ -37,11 +45,28 @@ 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.
#
#
$BINDIR/sethostname.dhclient >$LOGDIR/dhclient.log 2>&1
echo "${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)
......
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