findif.sh: dont use table parameter as it returns no netmask

This commit is contained in:
eabdullin 2023-11-14 15:55:42 +03:00
parent 59dcdf2589
commit 00e4a8176e
2 changed files with 88 additions and 1 deletions

View File

@ -0,0 +1,79 @@
From cf2fd2a9cf06dc2e915f2fb5dbcc5e09e907a6df Mon Sep 17 00:00:00 2001
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
Date: Thu, 5 Oct 2023 11:53:18 +0200
Subject: [PATCH] findif.sh: dont use table parameter as it returns no netmask
(tested with main/local/custom tables)
---
heartbeat/IPaddr2 | 12 ------------
heartbeat/findif.sh | 8 ++++----
2 files changed, 4 insertions(+), 16 deletions(-)
diff --git a/heartbeat/IPaddr2 b/heartbeat/IPaddr2
index e8384c5866..97a7431a24 100755
--- a/heartbeat/IPaddr2
+++ b/heartbeat/IPaddr2
@@ -73,7 +73,6 @@ OCF_RESKEY_ip_default=""
OCF_RESKEY_cidr_netmask_default=""
OCF_RESKEY_broadcast_default=""
OCF_RESKEY_iflabel_default=""
-OCF_RESKEY_table_default=""
OCF_RESKEY_cidr_netmask_default=""
OCF_RESKEY_lvs_support_default=false
OCF_RESKEY_lvs_ipv6_addrlabel_default=false
@@ -98,7 +97,6 @@ OCF_RESKEY_network_namespace_default=""
: ${OCF_RESKEY_cidr_netmask=${OCF_RESKEY_cidr_netmask_default}}
: ${OCF_RESKEY_broadcast=${OCF_RESKEY_broadcast_default}}
: ${OCF_RESKEY_iflabel=${OCF_RESKEY_iflabel_default}}
-: ${OCF_RESKEY_table=${OCF_RESKEY_table_default}}
: ${OCF_RESKEY_lvs_support=${OCF_RESKEY_lvs_support_default}}
: ${OCF_RESKEY_lvs_ipv6_addrlabel=${OCF_RESKEY_lvs_ipv6_addrlabel_default}}
: ${OCF_RESKEY_lvs_ipv6_addrlabel_value=${OCF_RESKEY_lvs_ipv6_addrlabel_value_default}}
@@ -241,16 +239,6 @@ If a label is specified in nic name, this parameter has no effect.
<content type="string" default="${OCF_RESKEY_iflabel_default}"/>
</parameter>
-<parameter name="table">
-<longdesc lang="en">
-Table to use to lookup which interface to use for the IP.
-
-This can be used for policy based routing. See man ip-rule(8).
-</longdesc>
-<shortdesc lang="en">Table</shortdesc>
-<content type="string" default="${OCF_RESKEY_table_default}" />
-</parameter>
-
<parameter name="lvs_support">
<longdesc lang="en">
Enable support for LVS Direct Routing configurations. In case a IP
diff --git a/heartbeat/findif.sh b/heartbeat/findif.sh
index 6c04c98c19..5f1c19ec3c 100644
--- a/heartbeat/findif.sh
+++ b/heartbeat/findif.sh
@@ -32,7 +32,7 @@ prefixcheck() {
getnetworkinfo()
{
local line netinfo
- ip -o -f inet route list match $OCF_RESKEY_ip table "${OCF_RESKEY_table:=main}" scope host | (while read line;
+ ip -o -f inet route list match $OCF_RESKEY_ip scope host | (while read line;
do
netinfo=`echo $line | awk '{print $2}'`
case $netinfo in
@@ -210,14 +210,14 @@ findif()
fi
findif_check_params $family || return $?
- if [ -n "$netmask" ] ; then
+ if [ -n "$netmask" ]; then
match=$match/$netmask
fi
if [ -n "$nic" ] ; then
# NIC supports more than two.
- set -- $(ip -o -f $family route list match $match $scope table "${OCF_RESKEY_table:=main}" | 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 " | awk 'BEGIN{best=0} /\// { mask=$1; sub(".*/", "", mask); if( int(mask)>=best ) { best=int(mask); best_ln=$0; } } END{print best_ln}')
else
- set -- $(ip -o -f $family route list match $match $scope table "${OCF_RESKEY_table:=main}" | 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 | awk 'BEGIN{best=0} /\// { mask=$1; sub(".*/", "", mask); if( int(mask)>=best ) { best=int(mask); best_ln=$0; } } END{print best_ln}')
fi
if [ $# = 0 ] ; then
case $OCF_RESKEY_ip in

View File

@ -69,7 +69,7 @@
Name: resource-agents Name: resource-agents
Summary: Open Source HA Reusable Cluster Resource Scripts Summary: Open Source HA Reusable Cluster Resource Scripts
Version: 4.9.0 Version: 4.9.0
Release: 47%{?rcver:%{rcver}}%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} Release: 48%{?rcver:%{rcver}}%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist}.alma.1
License: GPLv2+ and LGPLv2+ License: GPLv2+ and LGPLv2+
URL: https://github.com/ClusterLabs/resource-agents URL: https://github.com/ClusterLabs/resource-agents
%if 0%{?fedora} || 0%{?centos_version} || 0%{?rhel} %if 0%{?fedora} || 0%{?centos_version} || 0%{?rhel}
@ -149,6 +149,10 @@ Patch57: bz2189243-Filesystem-1-improve-stop-action.patch
Patch58: bz2189243-Filesystem-2-fix-incorrect-parameter-types.patch Patch58: bz2189243-Filesystem-2-fix-incorrect-parameter-types.patch
Patch59: bz2189243-Filesystem-3-fix-signal_delay-default-value.patch Patch59: bz2189243-Filesystem-3-fix-signal_delay-default-value.patch
# Patches were taken from:
# https://github.com/ClusterLabs/resource-agents/commit/cf2fd2a9cf06dc2e915f2fb5dbcc5e09e907a6df
Patch60: findif-dont-use-table-parameter-as-it-returns-no-netmask.patch
# Patches were taken from # Patches were taken from
# https://gitlab.com/redhat/centos-stream/rpms/resource-agents/-/commit/1cc6788b864876025836abed4d8132e52ac9c9ae#e5e2b05c719e98f752cb68e9c0600209785ffbc1 # https://gitlab.com/redhat/centos-stream/rpms/resource-agents/-/commit/1cc6788b864876025836abed4d8132e52ac9c9ae#e5e2b05c719e98f752cb68e9c0600209785ffbc1
Patch48: bz2182415-azure-events-1-fix-no-transition-summary.patch Patch48: bz2182415-azure-events-1-fix-no-transition-summary.patch
@ -392,6 +396,7 @@ exit 1
%patch57 -p1 %patch57 -p1
%patch58 -p1 %patch58 -p1
%patch59 -p1 %patch59 -p1
%patch60 -p1
chmod 755 heartbeat/nova-compute-wait chmod 755 heartbeat/nova-compute-wait
chmod 755 heartbeat/NovaEvacuate chmod 755 heartbeat/NovaEvacuate
@ -967,6 +972,9 @@ ccs_update_schema > /dev/null 2>&1 ||:
%{_usr}/lib/ocf/lib/heartbeat/OCF_*.pm %{_usr}/lib/ocf/lib/heartbeat/OCF_*.pm
%changelog %changelog
* Tue Nov 14 2023 Eduard Abdullin <eabdullin@almalinux.org> - 4.9.0-48.alma.1
- findif.sh: dont use table parameter as it returns no netmask
* Thu Jul 20 2023 Oyvind Albrigtsen <oalbrigt@redhat.com> - 4.9.0-47 * Thu Jul 20 2023 Oyvind Albrigtsen <oalbrigt@redhat.com> - 4.9.0-47
- Filesystem: improve stop-action and allow setting term/kill signals - Filesystem: improve stop-action and allow setting term/kill signals
and signal_delay for large filesystems and signal_delay for large filesystems