Package: ucarp
Version: 1.5.2-2+b1
Severity: normal

Dear Maintainer,

There's new version of ifupdown in Debian Stretch that adds additional locking and recursion checks.

Unfortunately, the way ucarp is currently integrated in /etc/network/ifu-up.d/ucarp is not compatible with the new ifupdown when using vlan interfaces.

This new ifupdown version uses environment variables to detect recursive locks.

ucarp daemon is started from the up (more specifically if-up.d/ucarp) stanza of the vlan (e.g. eth0.2) interfaces, so the environment variables are inherited.

Later, when ucarp daemon tries to bring the alias interfaces (eth0.2:ucarp) it calls ifup (through vip-up), which inherits the environment from ucarp and tries to ensure there are no recursive locks by checking for the presence of IFUPDOWN_eth0 env var with value "parent-lock". Because there IS such a var, ifup fails with:

ifup: recursion detected for parent interface bond0 in parent-lock phase

I'm attaching my workaround for this problem, as well as added logging for vip-up scripts.
Logging would be better handled from within ucarp binary imo.

See also this similar (but not the same) bug: https://bugs.launchpad.net/ubuntu/+source/ifupdown/+bug/1545302

--- etc/network/if-up.d/ucarp
+++ etc/network/if-up.d/ucarp
@@ -1,5 +1,5 @@
-#!/bin/sh
+#!/bin/bash
 
 UCARP=/usr/sbin/ucarp
 EXTRA_PARAMS=""
 
@@ -44,8 +44,19 @@
 fi
 
 if [ -n "$IF_UCARP_VID" -a -n "$IF_UCARP_VIP" -a \
         -n "$IF_UCARP_PASSWORD" ]; then
+
+	# Workaround for ifupdown recursive lock false positive (ADMIN-517)
+	IFS_OLD=$IFS
+	IFS='='
+	while read -r key val; do
+		if [ "$key" = "IFUPDOWN_${IFACE%%.*}" -a "$val" = "parent-lock" ]; then
+			unset eval "$key"
+		fi
+	done < <(env)
+	IFS=$IFS_OLD
+
     $UCARP -i $IFACE -s $IF_ADDRESS -B -z -v $IF_UCARP_VID \
         -p $IF_UCARP_PASSWORD -a $IF_UCARP_VIP -u $IF_UCARP_UPSCRIPT \
         -d $IF_UCARP_DOWNSCRIPT $EXTRA_PARAMS
 fi
--- usr/share/ucarp/vip-up
+++ usr/share/ucarp/vip-up
@@ -1,3 +1,3 @@
 #!/bin/sh
 
-/sbin/ifdown $1:ucarp
+/sbin/ifdown $1:ucarp 2>&1 |logger --stderr --tag "ucarp-${0##*/}"

Reply via email to