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 (at] redhat.com> 19 # 20 ################################################################################ 21 TCID=${TCID:-icmp-uni-basic} 22 TST_TOTAL=1 23 TST_COUNT=1 24 TST_CLEANUP="tst_ipsec_cleanup" 25 26 . ipsec_lib.sh 27 28 LINK_NUM=${LINK_NUM:-0} 29 DO_IPSEC=${DO_IPSEC:-false} 30 IPSEC_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 34 tst_resm TINFO "Sending ICMP messages with the following conditions" 35 tst_resm TINFO "- Version of IP is IPv${TST_IPV6:-4}" 36 tst_resm TINFO "- Size of packets are ( $IPSEC_SIZE_ARRAY )" 37 38 if $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 44 fi 45 46 # name of interface of the local/remote host 47 lhost_ifname=$(tst_iface lhost $LINK_NUM) 48 rhost_ifname=$(tst_iface rhost $LINK_NUM) 49 50 lhost_addr=$(tst_ipaddr) 51 rhost_addr=$(tst_ipaddr rhost) 52 53 # Configure SAD/SPD 54 if $DO_IPSEC ; then 55 tst_ipsec lhost $lhost_addr $rhost_addr 56 tst_ipsec rhost $rhost_addr $lhost_addr 57 fi 58 59 tst_ping $lhost_ifname $rhost_addr $IPSEC_SIZE_ARRAY 60 if [ $? -ne 0 ]; then 61 tst_resm TFAIL "Checked IPv${TST_IPV6:-4} $IPSEC_PROTO $IPSEC_MODE" 62 else 63 tst_resm TPASS "Checked IPv${TST_IPV6:-4} $IPSEC_PROTO $IPSEC_MODE" 64 fi 65 66 tst_exit 67