/etc/ha.d/resource.d/IPaddr is in heartbeat 1:3.0.6-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | #!/bin/sh
#
#
# Description: wrapper of OCF RA IPaddr, based on original heartbeat RA.
# See OCF RA IPaddr for more information.
#
# Author: Xun Sun <xunsun@cn.ibm.com>
# License: GNU General Public License (GPL)
# Support: linux-ha@lists.linux-ha.org
# Copyright: (C) 2005 International Business Machines
#
# This script manages IP alias IP addresses
#
# It can add an IP alias, or remove one.
#
# usage: $0 <ip-address> {start|stop|status|monitor}
#
# The "start" arg adds an IP alias.
#
# Surprisingly, the "stop" arg removes one. :-)
#
. /etc/ha.d/resource.d//hto-mapfuncs
usage() {
echo "usage: $0 <ip-address> $LEGAL_ACTIONS"
exit 1
}
if [ $# != 2 ]; then
usage
fi
# We need to split the argument into pieces that IPaddr OCF RA can
# recognize, sed is prefered over Bash specific builtin functions
# for portability.
BASEIP=`echo $1 | sed 's%/.*%%'`
OCF_RESKEY_ip=$BASEIP; export OCF_RESKEY_ip
str=`echo $1 | sed 's%^'$BASEIP'/*%%'`
if [ ! -z "$str" ]; then
NETMASK=`echo $str | sed 's%/.*%%'`
OCF_RESKEY_cidr_netmask=$NETMASK; export OCF_RESKEY_cidr_netmask
str=`echo $str | sed 's%^'$NETMASK'/*%%'`
NIC=`echo $str | sed 's%/.*%%'`
case $NIC in
[0-9]*) BROADCAST=$NIC
OCF_RESKEY_broadcast=$BROADCAST; export OCF_RESKEY_broadcast
NIC=
;;
"") ;;
*) BROADCAST=`echo $str | sed -e 's%^'$NIC'/*%%' -e 's%/.*%%'`
OCF_RESKEY_nic=$NIC; export OCF_RESKEY_nic
OCF_RESKEY_broadcast=$BROADCAST; export OCF_RESKEY_broadcast
;;
esac
fi
#
# Determine if this IP address is really being served, or not.
# Note that we don't distinguish if *we're* serving it locally...
#
ip_monitor() {
PINGARGS="`pingargs $BASEIP`"
for j in 1 2 3
do
# for R1 style clusters, CTS runs this on the test monitor node
# so we cannot check to see if the IP address is served locally
# This means that the ARP spoofing is also tested
# But we can't tell for sure which node is serving the IP
if
/bin/ping $PINGARGS >/dev/null 2>&1
then
exit 0
fi
done
exit 1
}
case $2 in
monitor)
ip_monitor
;;
*)
;;
esac
OCF_TYPE=IPaddr
OCF_RESKEY_lvs_support=0
OCF_RESOURCE_INSTANCE=${OCF_TYPE}_$BASEIP
export OCF_TYPE OCF_RESOURCE_INSTANCE OCF_RESKEY_lvs_support
ra_execocf $2
|