summaryrefslogtreecommitdiffstats
path: root/heartbeat/findif.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-05 21:04:41 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-05 21:04:41 +0000
commitb37ff8756eeb4882c7fcd5864c12b850d2983607 (patch)
treec80a6f1066737bc4ea7f5e903494b1fcc6a031e9 /heartbeat/findif.sh
parentAdding debian version 1:4.13.0-1. (diff)
downloadresource-agents-b37ff8756eeb4882c7fcd5864c12b850d2983607.tar.xz
resource-agents-b37ff8756eeb4882c7fcd5864c12b850d2983607.zip
Merging upstream version 1:4.14.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'heartbeat/findif.sh')
-rw-r--r--heartbeat/findif.sh10
1 files changed, 5 insertions, 5 deletions
diff --git a/heartbeat/findif.sh b/heartbeat/findif.sh
index 5f1c19e..13484f8 100644
--- a/heartbeat/findif.sh
+++ b/heartbeat/findif.sh
@@ -29,10 +29,10 @@ prefixcheck() {
fi
return 0
}
-getnetworkinfo()
+getloopbackinfo()
{
local line netinfo
- ip -o -f inet route list match $OCF_RESKEY_ip scope host | (while read line;
+ ip -o -f inet route list match $OCF_RESKEY_ip table local scope host | (while read line;
do
netinfo=`echo $line | awk '{print $2}'`
case $netinfo in
@@ -215,14 +215,14 @@ findif()
fi
if [ -n "$nic" ] ; then
# NIC supports more than two.
- set -- $(ip -o -f $family route list match $match $scope | grep "dev $nic " | awk 'BEGIN{best=0} /\// { mask=$1; sub(".*/", "", mask); if( int(mask)>=best ) { best=int(mask); best_ln=$0; } } END{print best_ln}')
+ set -- $(ip -o -f $family route list match $match $scope | grep "dev $nic " | sed -e 's,^\([0-9.]\+\) ,\1/32 ,;s,^\([0-9a-f:]\+\) ,\1/128 ,' | sort -t/ -k2,2nr)
else
- set -- $(ip -o -f $family route list match $match $scope | awk 'BEGIN{best=0} /\// { mask=$1; sub(".*/", "", mask); if( int(mask)>=best ) { best=int(mask); best_ln=$0; } } END{print best_ln}')
+ set -- $(ip -o -f $family route list match $match $scope | sed -e 's,^\([0-9.]\+\) ,\1/32 ,;s,^\([0-9a-f:]\+\) ,\1/128 ,' | sort -t/ -k2,2nr)
fi
if [ $# = 0 ] ; then
case $OCF_RESKEY_ip in
127.*)
- set -- `getnetworkinfo`
+ set -- `getloopbackinfo`
shift;;
esac
fi