[Openvpn-devel] t_net.sh: use dummy interface instead of tun

Message ID 20200416134925.8848-1-a@unstable.cc
State Accepted
Headers show
Series [Openvpn-devel] t_net.sh: use dummy interface instead of tun | expand

Commit Message

Antonio Quartulli April 16, 2020, 3:49 a.m. UTC
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.

Signed-off-by: Antonio Quartulli <a@unstable.cc>
---
 tests/t_net.sh | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

Comments

Antonio Quartulli April 16, 2020, 3:51 a.m. UTC | #1
Hi,

On 16/04/2020 15:49, Antonio Quartulli wrote:
> 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.
> 
> Signed-off-by: Antonio Quartulli <a@unstable.cc>
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.
Gert Doering April 19, 2020, 12:07 a.m. UTC | #2
Acked-by: Gert Doering <gert@greenie.muc.de>

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 <a@unstable.cc>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Message-Id: <20200416134925.8848-1-a@unstable.cc>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg19751.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/tests/t_net.sh b/tests/t_net.sh
index 49790f0f..8f1bc361 100755
--- a/tests/t_net.sh
+++ b/tests/t_net.sh
@@ -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()