#!/usr/bin/perl # # Copyright (C) 2003, 2004, 2005 Yokogawa Electric Corporation, # INTAP(Interoperability Technology Association # for Information Processing, Japan). All rights reserved. # # Redistribution and use of this software in source and binary forms, with # or without modification, are permitted provided that the following # conditions and disclaimer are agreed and accepted by the user: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # 3. Neither the names of the copyrighters, the name of the project which # is related to this software (hereinafter referred to as "project") nor # the names of the contributors may be used to endorse or promote products # derived from this software without specific prior written permission. # # 4. No merchantable use may be permitted without prior written # notification to the copyrighters. However, using this software for the # purpose of testing or evaluating any products including merchantable # products may be permitted without any notification to the copyrighters. # # # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHTERS, THE PROJECT AND # CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING # BUT NOT LIMITED THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS # FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. IN NO EVENT SHALL THE # COPYRIGHTERS, THE PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT,STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF # THE POSSIBILITY OF SUCH DAMAGE. # # $TAHI: ct/default-addr-select/SrcSelectRule2_TempAddr.seq,v 1.3 2003/04/22 03:57:46 akisada Exp $ # ###################################################################### BEGIN { $V6evalTool::TestVersion = '$Name: REL_2_1_2 $'; } use V6evalTool; if ($V6evalTool::NutDef{Type} ne 'host') { vLogHTML("This test is for the Host only
"); exit $V6evalTool::exitHostOnly; } use ADDR_SELECT; $TRUE = $ADDR_SELECT::TRUE; $FALSE = $ADDR_SELECT::FALSE; $IF = $ADDR_SELECT::IF; $NUT_LLA = nutLLA($IF); $TEST_STRING = "Test for Default Source Address Selection Rule2(Prefer appropriate scope) with temporary address"; $C_BLUE = $ADDR_SELECT::C_BLUE; @RESULT; $RESULT_TABLE = ""; $RESULT_TEST = $TRUE; #====== Test #====== vLogHTML("#### $TEST_STRING ####
"); vLogHTML("#### Jump to Test Result ####
"); $RESULT[@RESULT] = check_TempAddr("01",$FALSE,"3fff::2","3ffe::","fec0::1","fec0::3"); $RESULT[@RESULT] = check_TempAddr("02",$TRUE,"ff0e::2","3ffe::","fec0::1","fec0::3"); $RESULT[@RESULT] = check_TempAddr("03",$FALSE,"3fff::2","fec0::","",""); $RESULT[@RESULT] = check_TempAddr("04",$TRUE,"ff0e::2","fec0::","",""); $RESULT[@RESULT] = check_TempAddr("05",$TRUE,"ff08::2","3ffe::","fec0::1","fec0::3"); $RESULT[@RESULT] = check_TempAddr("06",$TRUE,"ff08::2","fec0::","",""); $RESULT[@RESULT] = check_TempAddr("07",$FALSE,"fec0::2","3ffe::","",""); $RESULT[@RESULT] = check_TempAddr("08",$TRUE,"ff05::2","3ffe::","",""); $RESULT[@RESULT] = check_TempAddr("09",$TRUE,"fec0::2","fec0::","3ffe::1","3ffe::3"); $RESULT[@RESULT] = check_TempAddr("10",$TRUE,"ff05::2","fec0::","3ffe::1","3ffe::3"); #====== Test Result #====== vLogHTML("
#### Test ($TEST_STRING) Result ####
"); $RESULT_TABLE .= "

Destination Address & Candidate Source AddressJudgment
"; vLogHTML("$RESULT_TABLE"); foreach $RESULT_CHECK (@RESULT){ if(!$RESULT_CHECK){ $RESULT_TEST = $FALSE; } } if($RESULT_TEST){ vLogHTML("#### All Check: PASS ####
"); exit $V6evalTool::exitPass; }else{ vLogHTML('#### Some Checks are Fail: NG ####
'); exit $V6evalTool::exitFail; } #====================================================================== # check_TempAddr($CHECK_NUM,$NEED_NCE_DST,$DESTINATION,$G_PREFIX,$SOURCE2,$TEST_DST2) # $CHECK_NUM : check number # $NEED_NCE_DST : need nutMakeNCE_Destination() flag # $DESTINATION # $G_PREFIX : (to make temporary address) # $SOURCE2 # $TEST_DST2 : destination of SOURCE2 at checkNUT_SrcAddr #====================================================================== sub check_TempAddr($$$$$$$) { my ($CHECK_NUM,$ON_LINK,$DESTINATION,$G_PREFIX,$SOURCE2,$TEST_DST2) = @_; $SOURCE1 = prefix2G_ADDR_NUT($G_PREFIX,$IF); my $SOURCE3 = $NUT_LLA; my $CHECK_TXT = "Destination = $DESTINATION
Candidate Source = temporary address($G_PREFIX+random), $SOURCE2, $SOURCE3
Expected Source = temporary address($G_PREFIX+random)"; my $RESULT_LINE = "
$CHECK_NUM$CHECK_TXT"; my $RESULT = $TRUE; #====== Check : Initialize Add source address & NCE in NUT #====== vLogHTML("
#### Check $CHECK_NUM: Start ($CHECK_TXT) ####
"); nutInitialize() || exit $V6evalTool::exitFatal; nutTempAddrEnable() || exit $V6evalTool::exitFatal; $CPP = "-DSOURCE1=\\\"$SOURCE1\\\" -DSOURCE3=\\\"$SOURCE3\\\" -DDESTINATION=\\\"$DESTINATION\\\""; if($SOURCE2 ne ''){ $CPP .= " -DSOURCE2=\\\"$SOURCE2\\\""; } vCPP($CPP); nutAutoConfIPv6AddrAdd($G_PREFIX,$CPP); if($SOURCE2 ne ''){ nutIPv6AddrAdd($SOURCE2,"64") || exit $V6evalTool::exitFatal; $ret = checkNUT_SrcAddr($CPP,$SOURCE2,$TEST_DST2); if (!$ret) { vLogHTML("#### Check $CHECK_NUM: Fail ####
"); nutReboot() || exit $V6evalTool::exitFatal; $RESULT_LINE .= "Fail"; $RESULT_TABLE .= $RESULT_LINE; return $FALSE; } } nutIPv6AddrDelete($SOURCE1,"64") || exit $V6evalTool::exitFatal; if($RESULT){ if(!nutPing62Dest_TempAddr($CPP,$DESTINATION,$ON_LINK)){ $RESULT = $FALSE; } } if($RESULT){ vLogHTML("#### Check $CHECK_NUM: PASS ####
"); $RESULT_LINE .= "PASS"; $RESULT_TABLE .= $RESULT_LINE; nutClear($SOURCE2,"64") || exit $V6evalTool::exitFatal; nutTempAddrDisable() || exit $V6evalTool::exitFatal; return $TRUE; }else{ vLogHTML("#### Check $CHECK_NUM: Fail ####
"); $RESULT_LINE .= "Fail"; $RESULT_TABLE .= $RESULT_LINE; nutClear($SOURCE2,"64") || exit $V6evalTool::exitFatal; nutTempAddrDisable() || exit $V6evalTool::exitFatal; return $FALSE; } } ###################################################################### __END__ =head1 NAME SrcSelectRule2_TempAddr.seq - Source Address Selection Check Rule 2(Prefer appropriate scope) with temporary address Rule 2: Prefer appropriate scope. If Scope(SA) < Scope(SB): If Scope(SA) < Scope(D), then prefer SB and otherwise prefer SA. Source addresses used for this test are "temporary address" and "public address". =head1 TARGET Host =head1 SYNOPSIS =begin html
  SrcSelectRule2_TempAddr.seq [-tooloption ...] -pkt ADDR_SELECT.def
    -tooloption : v6eval tool option
=end html =head1 INITIALIZATION None =head1 TEST PROCEDURE This TEST performs the following Check procedures for every address group defined by Check 01 - *. *Check procedure 1. Initialize : 1.1. Set IPv6 Default Route in NUT (Default Router address = ) 1.2. Set privacy extention setting in NUT 1.3. Add Candidate Source Addresses (temporary / public ) in NUT * temporary address is added by RA (TN->NUT) 1.4. Check Candidate Source Addresses by Ping6 (TN->NUT) 2. Send Ping6 from NUT to Destination 2.1. NUT send ICMPv6 echo request (NUT->TN) 3. Judgment : if (recive packet's Destination & Source Addresses) = (expected Destination & Source Addresses), Check pass 4. Cleanup : 4.1. Delete Candidate Source Addresses in NUT 4.2. Clear prefix list & NCE & default router list in NUT 4.3. Remove privacy extention setting in NUT NUT TN Default Router Destination | | | | ======(INITIALIZE)========= | | | | |<-<-<-+ | | Set IPv6 Default Route |<-<-<-+ | | Set privacy extention setting |<-<-<-+ | | Add Candidate Source Addresses | | | | |<------------+ | RA | | | | |<------------+ | Echo Request to Candidate Source Addresses 1 +------------>| | Echo Reply | | | | |<------------+ | Echo Request to Candidate Source Addresses 2 +------------>| | Echo Reply | | | | ======(INITIALIZE)========= | | | | |<-<-<-+ | | Excute ping6 command | | | | +------------------------>| Echo Request | | | | GS(Unicast Global Scope), GSM(Multicast Global Scope), OSM(Multicast Organization Scope), SS(Unicast Site local Scope), SSM(Multicast Site local Scope), LS(Link local Scope) LLA(Link Local Address) Check 01: Destination: 3fff::2(GS) Candidate Source Addresses: 3ffe::random(temporary)(GS) or fec0::1(SS) or LLA(LS) Result: 3ffe::random(temporary)(GS) Scope(LLA) < Scope(fec0::1): If Scope(LLA) < Scope(3fff::2), yes, prefer fec0::1 Scope(fec0::1) < Scope(3ffe::random): If Scope(fec0::1) < Scope(3fff::2), yes, prefer 3ffe::random Check 02: Destination: ff0e::2(GSM) Candidate Source Addresses: 3ffe::random(temporary)(GS) or fec0::1(SS) or LLA(LS) Result: 3ffe::random(temporary)(GS) Scope(LLA) < Scope(fec0::1): If Scope(LLA) < Scope(ff0e::2), yes, prefer fec0::1 Scope(fec0::1) < Scope(3ffe::random): If Scope(fec0::1) < Scope(ff0e::2), yes, prefer 3ffe::random Check 03: Destination: 3fff::2(GS) Candidate Source Addresses: fec0::random(temporary)(SS) or LLA(LS) Result: fec0::random(temporary)(SS) Scope(LLA) < Scope(fec0::random): If Scope(LLA) < Scope(3fff::2), yes, prefer fec0::random Check 04: Destination: ff0e::2(GSM) Candidate Source Addresses: fec0::random(temporary)(SS) or LLA(LS) Result: fec0::random(temporary)(SS) Scope(LLA) < Scope(fec0::random): If Scope(LLA) < Scope(ff0e::2), yes, prefer fec0::random Check 05: Destination: ff08::2(OSM) Candidate Source Addresses: 3ffe::random(temporary)(GS) or fec0::1(SS) or LLA(LS) Result: 3ffe::random(temporary)(GS) Scope(LLA) < Scope(fec0::1): If Scope(LLA) < Scope(ff08::2), yes, prefer fec0::1 Scope(fec0::1) < Scope(3ffe::random): If Scope(fec0::1) < Scope(ff08::2), yes, prefer 3ffe::random Check 06: Destination: ff08::2(GS) Candidate Source Addresses: fec0::random(temporary)(SS) or LLA(LS) Result: fec0::random(temporary)(SS) Scope(LLA) < Scope(fec0::random): If Scope(LLA) < Scope(ff08::2), yes, prefer fec0::random Check 07: Destination: fec0::2(SS) Candidate Source Addresses: 3ffe::random(temporary)(SS) or LLA(LS) Result: fec0::random(temporary)(SS) Scope(LLA) < Scope(3ffe::random): If Scope(LLA) < Scope(fec0::2), yes, prefer 3ffe::random Check 08: Destination: ff05::2(SSM) Candidate Source Addresses: 3ffe::random(temporary)(SS) or LLA(LS) Result: fec0::random(temporary)(SS) Scope(LLA) < Scope(3ffe::random): If Scope(LLA) < Scope(ff05::2), yes, prefer 3ffe::random Check 09: Destination: fec0::2(SS) Candidate Source Addresses: 3ffe::1(GS) or fec0::random(temporary)(SS) or LLA(LS) Result: fec0::random(temporary)(SS) Scope(LLA) < Scope(fec0::random): If Scope(LLA) < Scope(fec0::2), yes, prefer fec0::random Scope(fec0::random) < Scope(3ffe::1): If Scope(fec0::random) < Scope(fec0::2), no, prefer fec0::random Check 10: Destination: ff05::2(SSM) Candidate Source Addresses: 3ffe::1(GS) or fec0::random(temporary)(SS) or LLA(LS) Result: fec0::random(temporary)(SS) Scope(LLA) < Scope(fec0::random): If Scope(LLA) < Scope(ff05::2), yes, prefer fec0::random Scope(fec0::random) < Scope(3ffe::1): If Scope(fec0::random) < Scope(ff05::2), no, prefer fec0::random =head1 JUDGEMENT Check 01: PASS: Receive Echo Request & source address != fec0::1 and LLA Check 02: PASS: Receive Echo Request & source address != fec0::1 and LLA Check 03: PASS: Receive Echo Request & source address != LLA Check 04: PASS: Receive Echo Request & source address != LLA Check 05: PASS: Receive Echo Request & source address != fec0::1 and LLA Check 06: PASS: Receive Echo Request & source address != LLA Check 07: PASS: Receive Echo Request & source address != LLA Check 08: PASS: Receive Echo Request & source address != LLA Check 09: PASS: Receive Echo Request & source address != 3ffe::1 and LLA Check 10: PASS: Receive Echo Request & source address != 3ffe::1 and LLA TEST PASS: All Check = PASS =head1 SEE ALSO perldoc V6evalTool =begin html
  ADDR_SELECT.html "Default Address Selection for IPv6" Test Common Utility
das_rules.html "Default Address Selection for IPv6" Rules
=end html =cut