selftest: txtimestamp: fix net ns entry logic
authorPaolo Pisati <paolo.pisati@canonical.com>
Tue, 21 Jul 2020 16:17:10 +0000 (18:17 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 21 Jul 2020 23:11:07 +0000 (16:11 -0700)
According to 'man 8 ip-netns', if `ip netns identify` returns an empty string,
there's no net namespace associated with current PID: fix the net ns entrance
logic.

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
Acked-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
tools/testing/selftests/net/txtimestamp.sh

index eea6f5193693f633cccfb722a7d6f33f654d8b2c..31637769f59f607377532695d7e1c1d1ae96d9eb 100755 (executable)
@@ -75,7 +75,7 @@ main() {
        fi
 }
 
-if [[ "$(ip netns identify)" == "root" ]]; then
+if [[ -z "$(ip netns identify)" ]]; then
        ./in_netns.sh $0 $@
 else
        main $@