Skip to contentSkip to conversation

t_net.sh: use dummy interface instead of tun

PATCH In review Antonio Quartulli 2 participants 3 messages Apr 16, 2020 – Apr 19, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 t_net.sh: use dummy interface instead of tun

The tun interface has proved to be a bit fragile for basic netlink tests as it may introduce delays in switching state, depending on the system the test is ran on.

For this reason, switch to dummy interface type and at the same type set its oper-state to up right after creation to avoid hitting the no-carrier state later. No-carrier has been problematic in pasts tests as it sometimes persists long enough to create a discrepancy between the various tests snapshots thus causing a test failure.

Setting a static MAC addressis also re-enabled to avoid it being different and thus causing a test failure when comparing snapshots.

---
 tests/t_net.sh | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
tests/t_net.sh +4 -9
index 49790f0f..8f1bc361 100755
@@ -32,21 +32,16 @@ LAST_STATE=$((${#GET_STATE[@]} - 1))
 
 reload_dummy()
 {
-    $RUN_SUDO $openvpn --dev $IFACE --dev-type tun --rmtun >/dev/null
-    $RUN_SUDO $openvpn --dev $IFACE --dev-type tun --mktun >/dev/null
+    $RUN_SUDO ip link del $IFACE
+    $RUN_SUDO ip link add $IFACE type dummy
+    $RUN_SUDO ip link set dev $IFACE state up
 
     if [ $? -ne 0 ]; then
         echo "can't create interface $IFACE"
         exit 1
     fi
 
-    # it seems that tun devices will settle on NO-CARRIER while not connected to
-    # any process, but this won't happen immediately. To avoid having the
-    # NO-CARRIER bit appear in the middle of the tests - which would compromise
-    # the results - let's wait 1 sec here for it to settle.
-    sleep 1
-
-    #ip link set dev $IFACE address 00:11:22:33:44:55
+    $RUN_SUDO ip link set dev $IFACE address 00:11:22:33:44:55
 }
 
 run_test()
Signature · 1 line
2.26.1
#1 lore raw

Hi,

Quoted 10 lines · Antonio Quartulli

The tun interface has proved to be a bit fragile for basic netlink tests as it may introduce delays in switching state, depending on the system the test is ran on.

For this reason, switch to dummy interface type and at the same type set its oper-state to up right after creation to avoid hitting the no-carrier state later. No-carrier has been problematic in pasts tests as it sometimes persists long enough to create a discrepancy between the various tests snapshots thus causing a test failure.

Quoted 4 lines

Setting a static MAC addressis also re-enabled to avoid it being different and thus causing a test failure when comparing snapshots.

This patch has gone through buildbot a couple of times and I was never able to trigger the usual failure that we saw until now.

Signature · 1 line
Antonio Quartulli
Acked-by on v1 1/1
#2 lore raw
In reply to Antonio Quartulli

Your patch has been applied to the master branch.

commit d8225e98f23d1f133b914bd63c90c8113c713fc7

Author: Antonio Quartulli
Date:   Thu Apr 16 15:49:25 2020 +0200
     t_net.sh: use dummy interface instead of tun

     Signed-off-by: Antonio Quartulli <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg19751.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering