public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/2] net: Add tst_net_driver helper
@ 2018-11-02 22:14 Petr Vorel
  2018-11-02 22:14 ` [LTP] [PATCH 2/2] net/ipsec: Add check for xfrm_user Petr Vorel
  2018-11-05  7:37 ` [LTP] [PATCH 1/2] net: Add tst_net_driver helper Petr Vorel
  0 siblings, 2 replies; 4+ messages in thread
From: Petr Vorel @ 2018-11-02 22:14 UTC (permalink / raw)
  To: ltp

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/lib/tst_net.sh | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
index d1206e285..3a243ca05 100644
--- a/testcases/lib/tst_net.sh
+++ b/testcases/lib/tst_net.sh
@@ -653,6 +653,11 @@ tst_set_sysctl()
 
 	tst_rhost_run $safe -c "sysctl -q -w $add_opt $name=$value"
 }
+tst_net_driver()
+{
+	tst_test_drivers $@
+	tst_rhost_run "tst_test_drivers $@"
+}
 
 tst_cleanup_rhost()
 {
-- 
2.19.1


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

* [LTP] [PATCH 2/2] net/ipsec: Add check for xfrm_user
  2018-11-02 22:14 [LTP] [PATCH 1/2] net: Add tst_net_driver helper Petr Vorel
@ 2018-11-02 22:14 ` Petr Vorel
  2018-11-02 22:37   ` Petr Vorel
  2018-11-05  7:37 ` [LTP] [PATCH 1/2] net: Add tst_net_driver helper Petr Vorel
  1 sibling, 1 reply; 4+ messages in thread
From: Petr Vorel @ 2018-11-02 22:14 UTC (permalink / raw)
  To: ltp

which is required by ip xfrm command.
As ipsec_lib.sh is used for other commands than it,
check it only when used. Call in cleanup function could trigger infinite
loop, therefore check only once.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/network/stress/ipsec/ipsec_lib.sh | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/testcases/network/stress/ipsec/ipsec_lib.sh b/testcases/network/stress/ipsec/ipsec_lib.sh
index b099fdeaf..731fa3140 100644
--- a/testcases/network/stress/ipsec/ipsec_lib.sh
+++ b/testcases/network/stress/ipsec/ipsec_lib.sh
@@ -89,6 +89,14 @@ TST_SETUP=${TST_SETUP:-ipsec_lib_setup}
 TST_USAGE=ipsec_lib_usage
 . tst_net.sh
 
+tst_ipsec_check_driver()
+{
+	if [ -z "$ipsec_driver_checked" ]; then
+		export ipsec_driver_checked=1
+		tst_net_driver "xfrm_user"
+	fi
+}
+
 get_key()
 {
 	local bits=$1
@@ -110,6 +118,7 @@ tst_ipsec_setup()
 # tst_ipsec_cleanup: flush ipsec state and policy rules
 tst_ipsec_cleanup()
 {
+	tst_ipsec_check_driver
 	ip xfrm state flush
 	ip xfrm policy flush
 	tst_rhost_run -c "ip xfrm state flush && ip xfrm policy flush"
@@ -175,6 +184,7 @@ tst_ipsec()
 	local p="proto $IPSEC_PROTO"
 	[ "$IPSEC_PROTO" = "esp_aead" ] && p="proto esp"
 
+	tst_ipsec_check_driver
 	ipsec_set_algoline
 
 	if [ $target = lhost ]; then
@@ -234,6 +244,7 @@ tst_ipsec_vti()
 		tst_brk TCONF "iproute doesn't support 'vti'"
 
 	ipsec_set_algoline
+	tst_ipsec_check_driver
 
 	local o_dir="src $src dst $dst"
 	local i_dir="src $dst dst $src"
-- 
2.19.1


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

* [LTP] [PATCH 2/2] net/ipsec: Add check for xfrm_user
  2018-11-02 22:14 ` [LTP] [PATCH 2/2] net/ipsec: Add check for xfrm_user Petr Vorel
@ 2018-11-02 22:37   ` Petr Vorel
  0 siblings, 0 replies; 4+ messages in thread
From: Petr Vorel @ 2018-11-02 22:37 UTC (permalink / raw)
  To: ltp

Hi,

> which is required by ip xfrm command.
> As ipsec_lib.sh is used for other commands than it,
> check it only when used. Call in cleanup function could trigger infinite
> loop, therefore check only once.

> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
...
> +tst_ipsec_check_driver()
> +{
> +	if [ -z "$ipsec_driver_checked" ]; then
> +		export ipsec_driver_checked=1
> +		tst_net_driver "xfrm_user"
> +	fi
I know that all *_ipsec_vti.sh are affected, but I think it's better to be universal.


And maybe ip xfrm calls in tst_init_iface() (in tst_net.sh) should have stderr redirected:

$ udp_ipsec_vti.sh -p comp -m tunnel -s 1500
udp_ipsec_vti 1 TINFO: initialize 'lhost' 'ltp_ns_veth2' interface
Cannot open netlink socket: Protocol not supported
udp_ipsec_vti 1 TINFO: initialize 'rhost' 'ltp_ns_veth1' interface
Cannot open netlink socket: Protocol not supported
# tst_net_iface_prefix.c:145: INFO: prefix and interface not found for '10.0.0.2'.

# tst_net_iface_prefix.c:145: INFO: prefix and interface not found for 'fd00:1:1:1::2'.

udp_ipsec_vti 1 TINFO: Network config (local -- remote):
udp_ipsec_vti 1 TINFO: ltp_ns_veth2 -- ltp_ns_veth1
udp_ipsec_vti 1 TINFO: 10.0.0.2/24 -- 10.0.0.1/24
udp_ipsec_vti 1 TINFO: fd00:1:1:1::2/64 -- fd00:1:1:1::1/64
udp_ipsec_vti 1 TINFO: Test vti + IPsec[comp/tunnel]
udp_ipsec_vti 1 TCONF: xfrm_user driver not available
Cannot open netlink socket: Protocol not supported
Cannot open netlink socket: Protocol not supported
Cannot open netlink socket: Protocol not supported


Kind regards,
Petr

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

* [LTP] [PATCH 1/2] net: Add tst_net_driver helper
  2018-11-02 22:14 [LTP] [PATCH 1/2] net: Add tst_net_driver helper Petr Vorel
  2018-11-02 22:14 ` [LTP] [PATCH 2/2] net/ipsec: Add check for xfrm_user Petr Vorel
@ 2018-11-05  7:37 ` Petr Vorel
  1 sibling, 0 replies; 4+ messages in thread
From: Petr Vorel @ 2018-11-05  7:37 UTC (permalink / raw)
  To: ltp

Hi,

> +tst_net_driver()
> +{
> +	tst_test_drivers $@
> +	tst_rhost_run "tst_test_drivers $@"
Error, needs:
tst_rhost_run -c "tst_test_drivers $@"


Kind regards,
Petr

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

end of thread, other threads:[~2018-11-05  7:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-02 22:14 [LTP] [PATCH 1/2] net: Add tst_net_driver helper Petr Vorel
2018-11-02 22:14 ` [LTP] [PATCH 2/2] net/ipsec: Add check for xfrm_user Petr Vorel
2018-11-02 22:37   ` Petr Vorel
2018-11-05  7:37 ` [LTP] [PATCH 1/2] net: Add tst_net_driver helper Petr Vorel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox