Package: vip-manager
Version: 1.0.1-4
Severity: normal
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu impish

Dear Maintainer,

vip-manager behavior_test can fail, depending on the device network
configuration.  If the test device has a network device of type ether
and a zero hardware address, and it selects this network device as the
one to use, the tests will fail.

Example failure:
https://autopkgtest.ubuntu.com/results/autopkgtest-impish/impish/armhf/v/vip-manager/20210901_213607_5779b@/log.gz
2021/09/01 21:35:37 Problems with generating the virtual ip manager: Cannot run 
vip-manager on the loopback device
as its hardware address is the local address (00:00:00:00:00:00),
which prohibits sending of gratuitous ARP messages

Here is abbreviated output of 'ip link show' for one such test device:
3: gretap0@NONE: <BROADCAST,MULTICAST> mtu 1476 qdisc noop state DOWN mode 
DEFAULT group default qlen 1000
    link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
44262: eth0@if44263: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1458 qdisc noqueue 
state UP mode DEFAULT group default qlen 1000
    link/ether 00:16:3e:0f:a3:f7 brd ff:ff:ff:ff:ff:ff link-netnsid 0

In this example, gretap0 will be the chosen network device, but will
fail at runtime of vip-manager due to the all-zeros mac address.
Instead, eth0 should be chosen.

Please see the attached patch, which I will be looking to get integrated
to Ubuntu, which seems to address the above problem for Ubuntu armhf
autopkgtest.

This bug report was also filed in Ubuntu and can be found at
https://launchpad.net/bugs/1942375

-Dan
Description: Improved test device selection
Author:      Dan Bungert <daniel.bung...@canonical.com>
Bug-Ubuntu:  https://bugs.launchpad.net/bugs/1942375
Last-Update: 2021-09-03
--- a/test/behaviour_test.sh
+++ b/test/behaviour_test.sh
@@ -7,9 +7,29 @@
 NC='\033[0m' # No Color
 
 # testing parameters
-dev=`ip link show | grep -B1 ether | cut -d ":" -f2 | head -n1 | cut -d " " -f2 | sed s/@.*//`
 vip=10.0.2.123
 
+function get_dev {
+    # select a suitable device for testing purposes
+    # * a device that is an "ether"
+    # * and isn't a nil hardware address
+
+    # https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-net
+    ARPHRD_ETHER=1
+
+    for dev in /sys/class/net/* ; do
+        test ! -e "$dev/address" && continue
+        test "$(cat $dev/address)" = "00:00:00:00:00:00" && continue
+        test "$(cat $dev/type)" != "$ARPHRD_ETHER" && continue
+        basename "$dev"
+        break
+    done
+}
+
+dev="$(get_dev)"
+# prerequisite test - do we have a suitable device?
+test -n "$dev"
+
 #cleanup
 function cleanup {
     if test -f .ncatPid
@@ -35,7 +55,7 @@
 }
 trap cleanup EXIT
 
-# prerequisite test 0: vip should not yet be registered
+# prerequisite test: vip should not yet be registered
 ! ip address show dev $dev | grep $vip
 
 # run etcd with podman/docker maybe?

Reply via email to