1#!/bin/sh 2# Copyright (c) 2016 Oracle and/or its affiliates. All Rights Reserved. 3# 4# This program is free software; you can redistribute it and/or 5# modify it under the terms of the GNU General Public License as 6# published by the Free Software Foundation; either version 2 of 7# the License, or (at your option) any later version. 8# 9# This program is distributed in the hope that it would be useful, 10# but WITHOUT ANY WARRANTY; without even the implied warranty of 11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12# GNU General Public License for more details. 13# 14# You should have received a copy of the GNU General Public License 15# along with this program; if not, see <http://www.gnu.org/licenses/>. 16# 17# Author: Alexey Kodanev <alexey.kodanev@oracle.com> 18 19TCID=icmp-uni-vti 20TST_TOTAL=1 21TST_CLEANUP="tst_ipsec_cleanup" 22 23. ipsec_lib.sh 24 25do_setup() 26{ 27 IPSEC_SIZE_ARRAY="${IPSEC_SIZE_ARRAY:-10 100 1000 10000 65507}" 28 29 if_loc=$(tst_iface) 30 if_rmt=$(tst_iface rhost) 31 32 ip_loc=$(tst_ipaddr) 33 ip_rmt=$(tst_ipaddr rhost) 34 35 tst_vti="ltp_vti0" 36 37 tst_resm TINFO "Test vti$TST_IPV6 + IPsec[$IPSEC_PROTO/$IPSEC_MODE]" 38 39 tst_ipsec_vti lhost $ip_loc $ip_rmt $tst_vti 40 tst_ipsec_vti rhost $ip_rmt $ip_loc $tst_vti 41 42 local mask= 43 if [ "$TST_IPV6" ]; then 44 ip_loc_tun="${IPV6_NET32_UNUSED}::1"; 45 ip_rmt_tun="${IPV6_NET32_UNUSED}::2"; 46 mask=64 47 ROD ip -6 route add ${IPV6_NET32_UNUSED}::/$mask dev $tst_vti 48 else 49 ip_loc_tun="${IPV4_NET16_UNUSED}.1.1"; 50 ip_rmt_tun="${IPV4_NET16_UNUSED}.1.2"; 51 mask=30 52 ROD ip route add ${IPV4_NET16_UNUSED}.1.0/$mask dev $tst_vti 53 fi 54 55 tst_resm TINFO "Add IPs to vti tunnel, " \ 56 "loc: $ip_loc_tun/$mask, rmt: $ip_rmt_tun/$mask" 57 58 ROD ip a add $ip_loc_tun/$mask dev $tst_vti 59 tst_rhost_run -s -c "ip a add $ip_rmt_tun/$mask dev $tst_vti" 60} 61 62do_test() 63{ 64 tst_resm TINFO "Sending ICMP messages..." 65 EXPECT_PASS tst_ping $tst_vti $ip_rmt_tun $IPSEC_SIZE_ARRAY 66} 67 68do_setup 69do_test 70 71tst_exit 72