# Get network config
. /etc/sysconfig/network
+# Check that networking is up.
+if ! is_yes "${IPV6_NETWORKING}"; then
+ exit 0
+fi
+
# Get service config
[ -f /etc/sysconfig/dhcpd ] && . /etc/sysconfig/dhcpd
-# Check that networking is up.
-if is_yes "${NETWORKING}"; then
- if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
- msg_network_down "DHCP IPv6 Server"
- exit 1
- fi
-else
- exit 0
+if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
+ msg_network_down "DHCP IPv6 Server"
+ exit 1
fi
check_device_up()
# configtest itself
configtest() {
local rc=0
- /sbin/dhcpd -6 -q -t -T || rc=$?
+ /sbin/dhcpd -6 -t -T -cf /etc/dhcpd6.conf -pf /var/run/dhpcd6.pid || rc=$?
# check if interfaces specified exist and have addresses
for i in $DHCPD_INTERFACES; do
}
# wrapper for configtest
+checkconfig=-1
checkconfig() {
local details=${1:-0}
- if [ $details = 1 ]; then
+ # run checkconfig only once
+ if [ $checkconfig -ne -1 ]; then
+ return $checkconfig
+ fi
+
+ if [ "$details" = "1" ]; then
# run config test and display report (status action)
show "Checking %s configuration" "DHCP IPv6 Server"; busy
local out
out=$(configtest 2>&1)
- RETVAL=$?
- if [ $RETVAL = 0 ]; then
+ checkconfig=$?
+ if [ $checkconfig -eq 0 ]; then
ok
else
fail
fi
[ "$out" ] && echo >&2 "$out"
+ RETVAL=$checkconfig
else
# run config test and abort with nice message if failed
# (for actions checking status before action).
configtest >/dev/null 2>&1
- RETVAL=$?
- if [ $RETVAL != 0 ]; then
+ checkconfig=$?
+ if [ $checkconfig -ne 0 ]; then
show "Checking %s configuration" "DHCP IPv6 Server"; fail
nls 'Configuration test failed. See details with %s "checkconfig"' $0
- exit $RETVAL
+ exit $checkconfig
fi
fi
}
start() {
# Check if the service is already running?
- if [ -f /var/lock/subsys/dhcpd ]; then
+ if [ -f /var/lock/subsys/dhcpd6 ]; then
msg_already_running "DHCP IPv6 Server"
return
fi
checkconfig
msg_starting "DHCP IPv6 Server"
- daemon /sbin/dhcpd -6 -q $DHCPD_INTERFACES
+ daemon /sbin/dhcpd -6 -q -cf /etc/dhcpd6.conf -pf /var/run/dhpcd6.pid $DHCPD_INTERFACES
RETVAL=$?
- [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dhcpd
+ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dhcpd6
}
stop() {
- if [ ! -f /var/lock/subsys/dhcpd ]; then
+ if [ ! -f /var/lock/subsys/dhcpd6 ]; then
msg_not_running "DHCP IPv6 Server"
return
fi
msg_stopping "DHCP IPv6 Server"
killproc --pidfile /var/run/dhcpd6.pid dhcpd
- rm -f /var/run/dhcpd6.pid /var/lock/subsys/dhcpd >/dev/null 2>&1
+ rm -f /var/run/dhcpd6.pid /var/lock/subsys/dhcpd6 >/dev/null 2>&1
}
condrestart() {
- if [ ! -f /var/lock/subsys/dhcpd ]; then
+ if [ ! -f /var/lock/subsys/dhcpd6 ]; then
msg_not_running "DHCP IPv6 Server"
RETVAL=$1
return
checkconfig 1
;;
status)
- status --pidfile /var/run/dhcpd6.pid dhcpd
+ status --pidfile /var/run/dhcpd6.pid dhcpd6 dhcpd
exit $?
;;
*)