Home | History | Annotate | Line # | Download | only in ipsec
common.sh revision 1.2.2.2
      1  1.2.2.2  pgoyette #	$NetBSD: common.sh,v 1.2.2.2 2017/05/11 02:58:42 pgoyette Exp $
      2  1.2.2.2  pgoyette #
      3  1.2.2.2  pgoyette # Copyright (c) 2017 Internet Initiative Japan Inc.
      4  1.2.2.2  pgoyette # All rights reserved.
      5  1.2.2.2  pgoyette #
      6  1.2.2.2  pgoyette # Redistribution and use in source and binary forms, with or without
      7  1.2.2.2  pgoyette # modification, are permitted provided that the following conditions
      8  1.2.2.2  pgoyette # are met:
      9  1.2.2.2  pgoyette # 1. Redistributions of source code must retain the above copyright
     10  1.2.2.2  pgoyette #    notice, this list of conditions and the following disclaimer.
     11  1.2.2.2  pgoyette # 2. Redistributions in binary form must reproduce the above copyright
     12  1.2.2.2  pgoyette #    notice, this list of conditions and the following disclaimer in the
     13  1.2.2.2  pgoyette #    documentation and/or other materials provided with the distribution.
     14  1.2.2.2  pgoyette #
     15  1.2.2.2  pgoyette # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     16  1.2.2.2  pgoyette # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     17  1.2.2.2  pgoyette # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     18  1.2.2.2  pgoyette # PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     19  1.2.2.2  pgoyette # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     20  1.2.2.2  pgoyette # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     21  1.2.2.2  pgoyette # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     22  1.2.2.2  pgoyette # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     23  1.2.2.2  pgoyette # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     24  1.2.2.2  pgoyette # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     25  1.2.2.2  pgoyette # POSSIBILITY OF SUCH DAMAGE.
     26  1.2.2.2  pgoyette #
     27  1.2.2.2  pgoyette 
     28  1.2.2.2  pgoyette test_flush_entries()
     29  1.2.2.2  pgoyette {
     30  1.2.2.2  pgoyette 	local sock=$1
     31  1.2.2.2  pgoyette 
     32  1.2.2.2  pgoyette 	export RUMP_SERVER=$sock
     33  1.2.2.2  pgoyette 
     34  1.2.2.2  pgoyette 	atf_check -s exit:0 -o empty $HIJACKING setkey -F
     35  1.2.2.2  pgoyette 	atf_check -s exit:0 -o empty $HIJACKING setkey -F -P
     36  1.2.2.2  pgoyette 	atf_check -s exit:0 -o match:"No SAD entries." $HIJACKING setkey -D -a
     37  1.2.2.2  pgoyette 	atf_check -s exit:0 -o match:"No SPD entries." $HIJACKING setkey -D -P
     38  1.2.2.2  pgoyette }
     39  1.2.2.2  pgoyette 
     40  1.2.2.2  pgoyette check_sa_entries()
     41  1.2.2.2  pgoyette {
     42  1.2.2.2  pgoyette 	local sock=$1
     43  1.2.2.2  pgoyette 	local local_addr=$2
     44  1.2.2.2  pgoyette 	local remote_addr=$3
     45  1.2.2.2  pgoyette 
     46  1.2.2.2  pgoyette 	export RUMP_SERVER=$sock
     47  1.2.2.2  pgoyette 
     48  1.2.2.2  pgoyette 	$DEBUG && $HIJACKING setkey -D
     49  1.2.2.2  pgoyette 
     50  1.2.2.2  pgoyette 	atf_check -s exit:0 -o match:"$local_addr $rmote_addr" \
     51  1.2.2.2  pgoyette 	    $HIJACKING setkey -D
     52  1.2.2.2  pgoyette 	atf_check -s exit:0 -o match:"$remote_addr $local_addr" \
     53  1.2.2.2  pgoyette 	    $HIJACKING setkey -D
     54  1.2.2.2  pgoyette 	# TODO: more detail checks
     55  1.2.2.2  pgoyette }
     56