Message ID | 20181102221454.5056-2-pvorel@suse.cz |
---|---|
State | Superseded |
Delegated to: | Petr Vorel |
Headers | show |
Series | [1/2] net: Add tst_net_driver helper | expand |
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
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"
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(+)