HP-UX Secure Resource Partitions (SRP) A.02.01 Administrator's Guide

101
function srp_route_delete
{
# run 'route' command for each IP address
rval=0
index=0
last_index=${#SRP_SG_MANAGED_IP[@]}
while [ "$index" -lt "$last_index" ]
do
srp_ip="${SRP_SG_MANAGED_IP[$index]}"
srp_gateway="${SRP_SG_GATEWAY[$index]}";
if [ -z "$srp_ip" ] # skip empty slot in the array
then
let index=$index+1
let last_index=$last_index+1
continue
fi
if [ "$srp_ip" = "$srp_gateway" ]
then
# use local IP as gateway
emsg=$(/usr/sbin/route delete default $srp_gateway 0 \
source $srp_ip 2>&1)
else
# use remote gateway
emsg=$(/usr/sbin/route delete default $srp_gateway 1 \
source $srp_ip 2>&1)
fi
if (($? != 0)); then
print "ERROR: $emsg" >$2
rval=1
fi
let index=$index+1
done
return $rval
}
################
# main routine
################
sg_log 5 "SRP routing entry configuration script"
#########################################################################
#
# Customer defined external script must be specified with three required
# entry points: start, stop, and validate.
#
# It's not recommended to add additional entry points to the script
# due to potential name space collision with future Serviceguard
releases.
#
#########################################################################
typeset -i exit_val=0
case ${1} in
start)
srp_route_add
exit_val=$?
;;