All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] tst_net.sh: Allow execution if xfrm is disabled
@ 2019-10-09  6:23 Joerg Vehlow
  2019-10-29 14:35 ` Petr Vorel
  0 siblings, 1 reply; 3+ messages in thread
From: Joerg Vehlow @ 2019-10-09  6:23 UTC (permalink / raw)
  To: ltp

From: Joerg Vehlow <joerg.vehlow@aox-tech.de>

If the kernel is configured without xfrm support, the setup of the
interfaces for communication between local and remote host fails,
because it tries to flush xfrm state and policy.
There is no need to flush, if the system doesn't even support xfrm.

Signed-off-by: Joerg Vehlow <joerg.vehlow@aox-tech.de>
---
 testcases/lib/tst_net.sh | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
index 6c3ae708d..3aaf21cb5 100644
--- a/testcases/lib/tst_net.sh
+++ b/testcases/lib/tst_net.sh
@@ -430,8 +430,10 @@ tst_init_iface()
 	tst_res_ TINFO "initialize '$type' '$iface' interface"
 
 	if [ "$type" = "lhost" ]; then
-		ip xfrm policy flush || return $?
-		ip xfrm state flush || return $?
+		if ip xfrm state 1>/dev/null 2>&1; then
+			ip xfrm policy flush || return $?
+			ip xfrm state flush || return $?
+		fi
 		ip link set $iface down || return $?
 		ip route flush dev $iface || return $?
 		ip addr flush dev $iface || return $?
@@ -439,8 +441,10 @@ tst_init_iface()
 		return $?
 	fi
 
-	tst_rhost_run -c "ip xfrm policy flush" || return $?
-	tst_rhost_run -c "ip xfrm state flush" || return $?
+	if tst_rhost_run -c "ip xfrm state 1>/dev/null 2>&1"; then
+		tst_rhost_run -c "ip xfrm policy flush" || return $?
+		tst_rhost_run -c "ip xfrm state flush" || return $?
+	fi
 	tst_rhost_run -c "ip link set $iface down" || return $?
 	tst_rhost_run -c "ip route flush dev $iface" || return $?
 	tst_rhost_run -c "ip addr flush dev $iface" || return $?
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [LTP] [PATCH] tst_net.sh: Allow execution if xfrm is disabled
  2019-10-09  6:23 [LTP] [PATCH] tst_net.sh: Allow execution if xfrm is disabled Joerg Vehlow
@ 2019-10-29 14:35 ` Petr Vorel
  2019-10-31 13:18   ` Petr Vorel
  0 siblings, 1 reply; 3+ messages in thread
From: Petr Vorel @ 2019-10-29 14:35 UTC (permalink / raw)
  To: ltp

Hi Joerg,

> From: Joerg Vehlow <joerg.vehlow@aox-tech.de>

> If the kernel is configured without xfrm support, the setup of the
> interfaces for communication between local and remote host fails,
> because it tries to flush xfrm state and policy.
> There is no need to flush, if the system doesn't even support xfrm.

> Signed-off-by: Joerg Vehlow <joerg.vehlow@aox-tech.de>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Tested-by: Petr Vorel <pvorel@suse.cz>

> ---
>  testcases/lib/tst_net.sh | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)

> diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
> index 6c3ae708d..3aaf21cb5 100644
> --- a/testcases/lib/tst_net.sh
> +++ b/testcases/lib/tst_net.sh
> @@ -430,8 +430,10 @@ tst_init_iface()
>  	tst_res_ TINFO "initialize '$type' '$iface' interface"

>  	if [ "$type" = "lhost" ]; then
> -		ip xfrm policy flush || return $?
> -		ip xfrm state flush || return $?
> +		if ip xfrm state 1>/dev/null 2>&1; then
> +			ip xfrm policy flush || return $?
> +			ip xfrm state flush || return $?
> +		fi
>  		ip link set $iface down || return $?
>  		ip route flush dev $iface || return $?
>  		ip addr flush dev $iface || return $?
> @@ -439,8 +441,10 @@ tst_init_iface()
>  		return $?
>  	fi

> -	tst_rhost_run -c "ip xfrm policy flush" || return $?
> -	tst_rhost_run -c "ip xfrm state flush" || return $?
> +	if tst_rhost_run -c "ip xfrm state 1>/dev/null 2>&1"; then
> +		tst_rhost_run -c "ip xfrm policy flush" || return $?
> +		tst_rhost_run -c "ip xfrm state flush" || return $?
> +	fi
>  	tst_rhost_run -c "ip link set $iface down" || return $?
>  	tst_rhost_run -c "ip route flush dev $iface" || return $?
>  	tst_rhost_run -c "ip addr flush dev $iface" || return $?

Kind regards,
Petr

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [LTP] [PATCH] tst_net.sh: Allow execution if xfrm is disabled
  2019-10-29 14:35 ` Petr Vorel
@ 2019-10-31 13:18   ` Petr Vorel
  0 siblings, 0 replies; 3+ messages in thread
From: Petr Vorel @ 2019-10-31 13:18 UTC (permalink / raw)
  To: ltp

Hi Joerg,

> > From: Joerg Vehlow <joerg.vehlow@aox-tech.de>

> > If the kernel is configured without xfrm support, the setup of the
> > interfaces for communication between local and remote host fails,
> > because it tries to flush xfrm state and policy.
> > There is no need to flush, if the system doesn't even support xfrm.

> > Signed-off-by: Joerg Vehlow <joerg.vehlow@aox-tech.de>
> Reviewed-by: Petr Vorel <pvorel@suse.cz>

Thanks, merged!

Kind regards,
Petr

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-31 13:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-09  6:23 [LTP] [PATCH] tst_net.sh: Allow execution if xfrm is disabled Joerg Vehlow
2019-10-29 14:35 ` Petr Vorel
2019-10-31 13:18   ` Petr Vorel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.