Home | History | Annotate | Download | only in icmp
      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 [ -n "$IPSEC_MODE" -a -n "$IPSEC_PROTO" ] && DO_IPSEC=true || DO_IPSEC=false
     31 
     32 # Test description
     33 tst_resm TINFO "Sending ICMP messages with the following conditions"
     34 tst_resm TINFO "- Version of IP is IPv${TST_IPV6:-4}"
     35 tst_resm TINFO "- Size of packets are ( $IPSEC_SIZE_ARRAY )"
     36 
     37 if $DO_IPSEC; then
     38 	case $IPSEC_PROTO in
     39 	ah)	tst_resm TINFO "- IPsec [ AH / $IPSEC_MODE ]" ;;
     40 	esp)	tst_resm TINFO "- IPsec [ ESP / $IPSEC_MODE ]" ;;
     41 	comp)	tst_resm TINFO "- IPcomp [ $IPSEC_MODE ]" ;;
     42 	esac
     43 fi
     44 
     45 # name of interface of the local/remote host
     46 lhost_ifname=$(tst_iface lhost $LINK_NUM)
     47 rhost_ifname=$(tst_iface rhost $LINK_NUM)
     48 
     49 lhost_addr=$(tst_ipaddr)
     50 rhost_addr=$(tst_ipaddr rhost)
     51 
     52 # Configure SAD/SPD
     53 if $DO_IPSEC ; then
     54 	tst_ipsec lhost $lhost_addr $rhost_addr
     55 	tst_ipsec rhost $rhost_addr $lhost_addr
     56 fi
     57 
     58 PING_MAX="$IPSEC_REQUESTS"
     59 
     60 tst_ping $lhost_ifname $rhost_addr $IPSEC_SIZE_ARRAY
     61 
     62 tst_exit
     63