Commit de99c83c authored by Leigh Stoller's avatar Leigh Stoller

Minor changes to DHCP support; Dave was having problems with how

I was getting the IP from the hostname, so I switched to the trick
we use on the testbed nodes; use /etc/dhclient-exit-hooks to write
the data into /var/run, and use that in register.sh when the IP=DHCP.
parent eb438194
......@@ -154,22 +154,11 @@ else {
fatal("Tainted hostname $hostname!");
}
#
# If DHCP mode, must get our IP from the hostname first. Perhaps we
# should do that all the time, as a check on the nameserver, which had
# better be correct and working!
#
if ($IP eq "DHCP") {
my (undef,undef,undef,undef,@ipaddrs) = gethostbyname($hostname);
$IP = inet_ntoa($ipaddrs[0]);
}
# Now taint check IP.
if ($IP =~ /^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/) {
$IP = $1;
}
else {
fatal("Tainted value $IP!");
fatal("Bad IP: $IP!");
}
#
......
......@@ -112,7 +112,7 @@ if ($IP eq "DHCP") {
$IP = inet_ntoa($ipaddrs[0]);
}
else {
fatal("Invalid hostname: $hostname");
}
}
......
#!/bin/sh
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -14,6 +14,11 @@
. /etc/rc.conf.local
if [ "$netbed_IP" = "DHCP" ]; then
# See /etc/dhclient-exit-hooks
netbed_IP=`cat /var/run/myip`
fi
case "$1" in
start)
if [ -f /usr/site/sbin/register.pl ]; then
......
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