Commit 6d42932b authored by David Johnson's avatar David Johnson
Browse files

Bugfix in the static_widearea_config path.

We were assuming that if static_widearea_config returned 0, it had
configured the physical $iface that findcnet was passed successfully.
But, static_widearea_config also returns 0 if the widearea config info
was present BUT if the given physical $iface did not match the widearea
config info.

So, catch that case, and all is well.

Also, fix a minor syntax bug; and add some debugging.
parent d4c2fa96
...@@ -75,7 +75,7 @@ static_widearea_config() ...@@ -75,7 +75,7 @@ static_widearea_config()
echo "$cnetif" > $BOOTDIR/controlif echo "$cnetif" > $BOOTDIR/controlif
if [ -e "/etc/emulab/bossnode" ]; then if [ -e "/etc/emulab/bossnode" ]; then
bossnode=`cat /etc/emulab/bossnode` bossnode=`cat /etc/emulab/bossnode`
i = 0 i=0
while [ $i -lt 6 ]; do while [ $i -lt 6 ]; do
bossip=`host -t A "$bossnode"` bossip=`host -t A "$bossnode"`
[ $? -eq 0 ] && break [ $? -eq 0 ] && break
...@@ -105,6 +105,8 @@ while ! mkdir $lockdir 2> /dev/null; do ...@@ -105,6 +105,8 @@ while ! mkdir $lockdir 2> /dev/null; do
sleep 1 sleep 1
done done
echo "`date`: $iface: starting" >>$LOGDIR/dhclient.log
cnetfile="/var/run/cnet" cnetfile="/var/run/cnet"
cnetif='' cnetif=''
...@@ -115,10 +117,23 @@ cnetif='' ...@@ -115,10 +117,23 @@ cnetif=''
if [ -f $cnetfile ]; then if [ -f $cnetfile ]; then
cnetif=`cat $cnetfile` cnetif=`cat $cnetfile`
echo "`date`: $iface: $cnetfile already had $cnetif" >>$LOGDIR/dhclient.log
elif static_widearea_config $iface; then elif static_widearea_config $iface; then
#
# Make sure that static_widearea_config matched $iface to the target WA_MAC.
#
if [ "$cnetif" = "$iface" ]; then
echo $iface > $cnetfile echo $iface > $cnetfile
cnetif=`cat $cnetfile` cnetif=`cat $cnetfile`
/sbin/initctl emit -n 'emulab-findcnet-done' /sbin/initctl emit -n 'emulab-findcnet-done'
else
#
# If not, don't fail; there was widearea config info; but also don't
# succeed in the final check at the end of the script. This $iface is
# not the control net.
#
cnetif=''
fi
else else
# #
# Find a list of candidate interfaces # Find a list of candidate interfaces
......
...@@ -75,7 +75,7 @@ static_widearea_config() ...@@ -75,7 +75,7 @@ static_widearea_config()
echo "$cnetif" > $BOOTDIR/controlif echo "$cnetif" > $BOOTDIR/controlif
if [ -e "/etc/emulab/bossnode" ]; then if [ -e "/etc/emulab/bossnode" ]; then
bossnode=`cat /etc/emulab/bossnode` bossnode=`cat /etc/emulab/bossnode`
i = 0 i=0
while [ $i -lt 6 ]; do while [ $i -lt 6 ]; do
bossip=`host -t A "$bossnode"` bossip=`host -t A "$bossnode"`
[ $? -eq 0 ] && break [ $? -eq 0 ] && break
...@@ -105,6 +105,8 @@ while ! mkdir $lockdir 2> /dev/null; do ...@@ -105,6 +105,8 @@ while ! mkdir $lockdir 2> /dev/null; do
sleep 1 sleep 1
done done
echo "`date`: $iface: starting" >>$LOGDIR/dhclient.log
cnetfile="/var/run/cnet" cnetfile="/var/run/cnet"
cnetif='' cnetif=''
...@@ -115,10 +117,23 @@ cnetif='' ...@@ -115,10 +117,23 @@ cnetif=''
if [ -f $cnetfile ]; then if [ -f $cnetfile ]; then
cnetif=`cat $cnetfile` cnetif=`cat $cnetfile`
echo "`date`: $iface: $cnetfile already had $cnetif" >>$LOGDIR/dhclient.log
elif static_widearea_config $iface; then elif static_widearea_config $iface; then
#
# Make sure that static_widearea_config matched $iface to the target WA_MAC.
#
if [ "$cnetif" = "$iface" ]; then
echo $iface > $cnetfile echo $iface > $cnetfile
cnetif=`cat $cnetfile` cnetif=`cat $cnetfile`
/sbin/initctl emit -n 'emulab-findcnet-done' /sbin/initctl emit -n 'emulab-findcnet-done'
else
#
# If not, don't fail; there was widearea config info; but also don't
# succeed in the final check at the end of the script. This $iface is
# not the control net.
#
cnetif=''
fi
else else
# #
# Find a list of candidate interfaces # Find a list of candidate interfaces
......
Supports Markdown
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