#!/usr/bin/perl # # Copyright (C) 1999,2000 Yokogawa Electric Corporation and # YDC Corporation. # 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. # # 5. The copyrighters, the project and the contributors may prohibit # the use of this software at any time. # # 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. # # $Id: ADDRSTATE_src_select.seq,v 1.1.1.1 2000/10/31 22:39:55 sekiya Exp $ ######################################################################## BEGIN { $V6evalTool::TestVersion = '$Name: $ '; } use V6evalTool; use DAD; #----- get sequence arguments $howto_initNUT="none"; $send = "ok"; foreach (@ARGV) { /^waitsec=(\S+)/ && do {$waitsec=$1; # Wait time [sec] since address configuration next; }; # sample: 40, 70, 100 # /^addrconf=(\S+)/ && do {$DAD::howto_addrconf=$1; # How to configure address of NUT? # next; }; # sample: boot, ra, manual+_GLOBAL0A0N_UCAST /^init=(\S+)/ && do {$howto_initNUT=$1; # How to initialize NUT? next; }; # sample: none, DADSuccess_boot, DADFail_boot /^sd=(\S+)/ && do {$seqdebugopt=$1; # sequence debug options next; }; # sample: qRs seqERROR("Unknown sequence option '$_'"); } #----- test condition $IF=Link0; # network interface seqSetDADParam($seqdebugopt); $pingto_addr = "3ffe:501:ffff:102::1"; #ping6 from NUT to off-link global address. #----- set %pktdesc seqSetPktdesc(); #----- initialize NUT vLog("*** Target initialization phase ***"); seqInitNUT($IF, $howto_initNUT); #----- start Capturing vLog("*** Target testing phase ***"); vCapture($IF); #----- Configure Address on NUT # stateless addrconf by RA vLog("Stateless address configuration by sending RA to NUT. (2 prefixes) "); %ret=vSend($IF, $DAD::usolra_to_NUT); $seektime_for_dadns = $ret{'sentTime1'}; #foreach $key (sort(keys %ret)) { # vLog("\$ret{$key} = $ret{$key}"); #} #----- wait a DAD NS comming from NUT $timeout_for_dadns = $DAD::wait_dadns{"ra"}; vLog("TN wait the DAD NS sends from NUT : $DAD::dadns_from_NUT"); %ret1=vRecv($IF,$timeout_for_dadns, $seektime_for_dadns, 1, $DAD::dadns_from_NUT); vLog("TN wait the DAD NS sends from NUT : $DAD::dadns_from_NUT"); %ret2=vRecv($IF,$timeout_for_dadns, $seektime_for_dadns, 1, $DAD::dadns_from_NUT); #foreach $key (sort(keys %ret1)) { # vLog("\$ret1{$key} = $ret1{$key}"); #} #foreach $key (sort(keys %ret2)) { # vLog("\$ret2{$key} = $ret2{$key}"); #} #----- if received frame is a DAD NS # Now, unable to check DAD NS target address uniqueness. if( $ret1{status} == 0 && $ret2{status} == 0) { vLog("TN received the DAD NS sends from NUT."); #----- wait for NUT to finish DAD vSleep($DAD::RetransTimerSec, "Wait for NUT to finish DAD. ($DAD::RetransTimerSec [sec])"); }elsif( $ret1{status} == 1 && $ret2{status} == 1) { #----- timeout vLog("TN received no DAD NS sends from NUT. It seems that NUT doesn't perform DAD process."); }else{ #----- error vLog("TN received unexpected packet send from NUT."); seqERROR(vErrmsg(%ret)); #exit } #----- stop test sequence if debug seqOK() if $seqdebugopt =~ /s/; #----- Spent NUT's address lifetime #seqWaitNUTbeReady(); vSleep($DAD::RetransTimerSec); vSleep($waitsec, "Wait $waitsec [sec] to spent NUT's address lifetime."); #------------------------------------------------------ # Contents of RA # Prefix GLOBAL0 GLOBAL1 # PreferredLifetime[sec] 30 60 # ValidLifetime[sec] 90 120 #------------------------------------------------------ #------------------------------------------------------ # $waitsec [sec] GLOBAL0 state GLOBAL1 state # 10( 0-30) valid pref valid pref # 40(30-60) valid dep valid pref # 70(60-90) valid dep valid dep # 100(90-120) invalid valid dep # 130(120- ) invalid invalid #------------------------------------------------------ $allexpire=120; #120[sec] all address expire to be invalid #----- ping6 from NUT to off-link global address. ($NUTif) = split(/\s+/,$V6evalTool::NutDef{$IF}); vLog("On NUT, ping to $pingto_addr"); $ret=vRemote("ping6.rmt","", "if=$NUTif addr=$pingto_addr"); vLog("ping6.rmt returned status $rret") if $debug > 0; seqERROR("vRemote ping6.rmt exit $rret") if $ret > 0; #----- Receive ICMP echo request from NUT vLog("Wait echo request from NUT."); %ret=vRecv($IF, 5, 0, 1, echo_request); vLog("Received packet count=$ret{recvCount}"); if($ret{status}==0) { vLog("TN received echo request."); if ($waitsec < $allexpire) { vLog("Because one of NUT's address state is 'valid'."); seqOK(); }else{ vLog("But all of NUT's address state are 'invalid'."); seqNG(); } }else { vLog("TN doesn't receive echo request."); vLog("status = $ret{status}") if $debug > 0; if ($waitsec < $allexpire) { vLog("But one of NUT's address state is 'valid'."); seqNG(); }else{ vLog("Because all of NUT's address state are 'invalid'."); seqOK(); } } #end ######################################################################## __END__ =head1 NAME ADDRSTATE_src_select - check src address selection and address lifetime expiry =head1 TARGET Host =head1 SYNOPSIS ADDRSTATE_src_select.seq [-tooloption ...] -pkt waitsec= [init=,...] [sd=] -tooloption : v6eval tool option : packet definition file (v6eval tool option) : Wait time [sec] since address configuration. sample:40,70,100 : how to initialize NUT; DADSuccess_boot/DADFail_boot/ra : debug options =begin html
 detail of v6eval tool option: see perldoc V6evalTool.pm, perldoc V6evalRemote.pm
 detail of parameters: see Test sequence for IPv6 Stateless Address Autoconfiguration.
=end html =head1 INITIALIZATION =begin html
 detail of Initialization: see Test sequence for IPv6 Stateless Address Autoconfiguration.
=end html =head1 TEST PROCEDURE The following tests are prepared in this test package. See INDEX file. B Source address selection and address lifetime expiry (valid deprecated VS valid preferred) Source address selection and address lifetime expiry (valid deprecated VS valid deprecated) Source address selection and address lifetime expiry (invalid VS valid deprecated) Source address selection and address lifetime expiry (invalid VS invalid) B TN(or X) NUT ------------------------------ Initialize NUT (see ...) Send Unsolicited RA to configure address of NUT ==== Action #1: Unsolicited RA ===> name: usolra src: TN's Link-local address dst: allnodes multicast SLL option exists Prefix option PrefixLength: 64 LFlag: 1 AFlag: 1 ValidLifetime: 90 PreferredLifetime: 30 Prefix: _GLOBAL0_UCAST_PRFX Prefix option PrefixLength: 64 LFlag: 1 AFlag: 1 ValidLifetime: 120 PreferredLifetime: 60 Prefix: _GLOBAL1_UCAST_PRFX TN wait the DAD NS sends from NUT. (This judgement is informational only.) <=== Judgement #1-1: DAD NS ==== name: dadns_from_NUT src: ::0 dst: solnode[TargetAddress] TargetAddress: NUT's tentative _GLOBAL[01]_UCAST_PRFX + interface-id TN wait the DAD NS sends from NUT. (This judgement is informational only.) <=== Judgement #1-2: DAD NS ==== name: dadns_from_NUT src: ::0 dst: solnode[TargetAddress] TargetAddress: NUT's tentative _GLOBAL[01]_UCAST_PRFX + interface-id Wait for NUT to finish DAD. (sleep $RetransTimerSec=1 [sec]) Wait [sec] to spent NUT's address lifetime. Execute ping on NUT by remote control ==== Action #2: execute "ping6 3ffe:501:ffff:102::1" ===> TN wait the ICMPv6 echo request send from NUT. <=== Judgement #2: ICMPv6 echo request ==== name: echo_request src: dst: 3ffe:501:ffff:102::1 =head1 JUDGEMENT B The following table shows RA for address configuration and address states by . Contents of RA (usolra) ------------------------------------------------------ Prefix GLOBAL0 GLOBAL1 PreferredLifetime[sec] 30 60 ValidLifetime[sec] 90 120 ------------------------------------------------------ Address states by waitsec ------------------------------------------------------ [sec] GLOBAL0 state GLOBAL1 state 10( 0-30) valid pref valid pref 40(30-60) valid dep valid pref 70(60-90) valid dep valid dep 100(90-120) invalid valid dep 130(120- ) invalid invalid ------------------------------------------------------ B B< -pkt ADDRSTATE_dep_pref.def waitsec=40 init=DADSuccess_boot> Judgement #1-1,2. DAD NS may come from NUT on Global address autoconfiguration. (This judgement is informational only.) Judgement #2. ICMPv6 echo request must come from NUT. name: echo_request src: _GLOBAL1_UCAST_PRFX + interface-id (so waitsec=40) dst: 3ffe:501:ffff:102::1 B B< -pkt ADDRSTATE_dep_dep.def waitsec=70 init=DADSuccess_boot> Judgement #1-1,2. DAD NS may come from NUT on Global address autoconfiguration. (This judgement is informational only.) Judgement #2. ICMPv6 echo request must come from NUT. name: echo_request src: _GLOBAL[01]_UCAST_PRFX + interface-id (so waitsec=70) dst: 3ffe:501:ffff:102::1 B B< -pkt ADDRSTATE_inval_dep.def waitsec=100 init=DADSuccess_boot> Judgement #1-1,2. DAD NS may come from NUT on Global address autoconfiguration. (This judgement is informational only.) Judgement #2. ICMPv6 echo request must come from NUT. name: echo_request src: _GLOBAL1_UCAST_PRFX + interface-id (so waitsec=100) dst: 3ffe:501:ffff:102::1 B B< -pkt ADDRSTATE_inval_inval.def waitsec=130 init=DADSuccess_boot> Judgement #1-1,2. DAD NS may come from NUT on Global address autoconfiguration. (This judgement is informational only.) Judgement #2. ICMPv6 echo request must not come from NUT. name: echo_request src: _GLOBAL[01]_UCAST_PRFX + interface-id (so waitsec=130) dst: 3ffe:501:ffff:102::1 =head1 SEE ALSO =begin html
 detail of v6eval tool option: see perldoc V6evalTool.pm, perldoc V6evalRemote.pm
 detail of parameters: see Test sequence for IPv6 Stateless Address Autoconfiguration.
=end html =cut