ttcn3-docker-run.sh: Use interface "up" flag, not operstate

Don't use the "operstate" sysfs attribute to determine if an interface
is "up", use the actual UP-flag (0x01) in the "flags" sysfs attribute.

The "operstate" attribute may at least occasionally be "unknown" and
remain in that state (causing jenkins jobs to wait indefinitely), while
the flags (which we don't look at before this patch) indicates it is "up".

This is a fixup to the below commit:

commit d2014603a7
Author: Harald Welte <laforge@osmocom.org>
Date:   Wed Feb 3 22:05:43 2021 +0100

    debian-stretch-titan: Wait for interface to be _up_ not just its existance

Change-Id: Ib5c3bbe470ce874217437c2518df5ae07f0d8301
Closes: OS#5803
This commit is contained in:
Harald Welte 2022-11-30 13:33:34 +01:00 committed by laforge
parent 36c6ff8f11
commit c4d1cc59b0
1 changed files with 5 additions and 4 deletions

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
if [ $# -lt 2 ]; then
echo
echo "usage: ttcn3-docker-run SUBDIR SUITE"
@ -18,11 +18,12 @@ if [ -n "$WAIT_FOR_NETDEV" ]; then
pipework --wait -i "$WAIT_FOR_NETDEV"
while true; do
if [ ! -f /sys/class/net/${WAIT_FOR_NETDEV}/operstate ]; then
if [ ! -f /sys/class/net/${WAIT_FOR_NETDEV}/flags ]; then
exit 23
fi
OPSTATE=$(cat /sys/class/net/${WAIT_FOR_NETDEV}/operstate)
if [ "$OPSTATE" = "up" ]; then
FLAGS=$(cat /sys/class/net/${WAIT_FOR_NETDEV}/flags)
let FLAG_UP=$FLAGS\&1
if [ "$FLAG_UP" = "1" ]; then
break
fi
echo "Waiting for ${WAIT_FOR_NETDEV} to become operational"