[LTP] [PATCH 2/2] net/ipsec: Add check for xfrm_user

Petr Vorel
2018-11-02T22:37:36Z

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