1#!/bin/sh 2# Copyright (c) 2016 Red Hat Inc., All Rights Reserved. 3# Copyright (c) International Business Machines Corp., 2005 4# 5# This program is free software; you can redistribute it and/or 6# modify it under the terms of the GNU General Public License as 7# published by the Free Software Foundation; either version 2 of 8# the License, or (at your option) any later version. 9# 10# This program is distributed in the hope that it would be useful, 11# but WITHOUT ANY WARRANTY; without even the implied warranty of 12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13# GNU General Public License for more details. 14# 15# You should have received a copy of the GNU General Public License 16# along with this program; if not, see <http://www.gnu.org/licenses/>. 17# 18# Author: Hangbin Liu <haliu@redhat.com> 19# 20################################################################################ 21TCID=${TCID:-icmp-uni-basic} 22TST_TOTAL=1 23TST_COUNT=1 24TST_CLEANUP="tst_ipsec_cleanup" 25 26. ipsec_lib.sh 27 28LINK_NUM=${LINK_NUM:-0} 29DO_IPSEC=${DO_IPSEC:-false} 30IPSEC_SIZE_ARRAY="${IPSEC_SIZE_ARRAY:-10 100 1000 10000 65507}" 31[ -n "$IPSEC_MODE" -a -n "$IPSEC_PROTO" ] && DO_IPSEC=true || DO_IPSEC=false 32 33# Test description 34tst_resm TINFO "Sending ICMP messages with the following conditions" 35tst_resm TINFO "- Version of IP is IPv${TST_IPV6:-4}" 36tst_resm TINFO "- Size of packets are ( $IPSEC_SIZE_ARRAY )" 37 38if $DO_IPSEC; then 39 case $IPSEC_PROTO in 40 ah) tst_resm TINFO "- IPsec [ AH / $IPSEC_MODE ]" ;; 41 esp) tst_resm TINFO "- IPsec [ ESP / $IPSEC_MODE ]" ;; 42 comp) tst_resm TINFO "- IPcomp [ $IPSEC_MODE ]" ;; 43 esac 44fi 45 46# name of interface of the local/remote host 47lhost_ifname=$(tst_iface lhost $LINK_NUM) 48rhost_ifname=$(tst_iface rhost $LINK_NUM) 49 50lhost_addr=$(tst_ipaddr) 51rhost_addr=$(tst_ipaddr rhost) 52 53# Configure SAD/SPD 54if $DO_IPSEC ; then 55 tst_ipsec lhost $lhost_addr $rhost_addr 56 tst_ipsec rhost $rhost_addr $lhost_addr 57fi 58 59tst_ping $lhost_ifname $rhost_addr $IPSEC_SIZE_ARRAY 60if [ $? -ne 0 ]; then 61 tst_resm TFAIL "Checked IPv${TST_IPV6:-4} $IPSEC_PROTO $IPSEC_MODE" 62else 63 tst_resm TPASS "Checked IPv${TST_IPV6:-4} $IPSEC_PROTO $IPSEC_MODE" 64fi 65 66tst_exit 67