Public bug reported:

This patch

https://github.com/ClusterLabs/resource-
agents/commit/669df08f39cf8a778b05ac6c4632f43568e49454

did note make it into 26.04 in time. It completely breaks the function
of IPaddr2 on modern systems.

Description from GitHub:

IPaddr2: fix find_interface output
find_interface output should be empty when not interface is found.
Returning just one space breaks the following code:

        cur_nic="`find_interface $OCF_RESKEY_ip $NETMASK`"

        if [ -z "$cur_nic" ]; then
                echo "no"
                return 0
        fi

Also altname ip command generates an error in the logs when the
interface is not found:

        Command line is not complete. Try option "help"


26.04 broken vs fixed:

diff --git a/IPaddr2 b/IPaddr2
index 230ac85..e9c1cdb 100755
--- a/IPaddr2
+++ b/IPaddr2
@@ -660,9 +660,10 @@ find_interface() {
                | grep " $ipaddr/$netmask" \
                | cut -d ' ' -f2 \
                | grep -v '^ipsec[0-9][0-9]*$'`"
-       local iface_altname="`$IP2UTIL -f inet link show dev $iface | grep 
"altname" | sed 's/^[[:space:]]*//; s/altname //g' | tr '\n' ' '`"
-
-       echo "$iface $iface_altname"
+       if [ -n "$iface" ]; then
+               local iface_altname="`$IP2UTIL -f inet link show dev $iface | 
grep "altname" | sed 's/^[[:space:]]*//; s/altname //g' | tr '\n' ' '`"
+               echo "$iface $iface_altname"
+       fi
        return 0
 }

Quickfix:

curl -o /usr/lib/ocf/resource.d/heartbeat/IPaddr2
https://raw.githubusercontent.com/ClusterLabs/resource-
agents/refs/heads/main/heartbeat/IPaddr2 && chmod +x
/usr/lib/ocf/resource.d/heartbeat/IPaddr2 && chown root:root
/usr/lib/ocf/resource.d/heartbeat/IPaddr2

** Affects: resource-agents (Ubuntu)
     Importance: Undecided
         Status: Confirmed

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2151788

Title:
  In 26.04, the ocf:heartbeat:IPaddr2 script is broken detecting iface
  names

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/resource-agents/+bug/2151788/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to