#!/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: ncStateByRedirect4Incomplete.seq,v 1.1.1.1 2000/10/31 22:39:34 sekiya Exp $ ######################################################################## BEGIN { $V6evalTool::TestVersion = '$Name: $ '; } use V6evalTool; use nd; use hostRedirect; ndOptions(@ARGV); # The following generate debugging messages. $nd::debug=$ndOpt_v|$ndOpt_vv; # You can specifies debug optons to a remote control program. # If you want to know more detail, please see the following: # - V6evalTool.pm: perldoc V6evalTool # - V6evalRemote.pm: perldoc V6evalRemote $nd::remote_debug="-o1" if $ndOpt_vv; $IF=Link0; $exit_rtn=$V6evalTool::exitPass; # # # $type=$V6evalTool::NutDef{Type}; if($type eq router) { vLogHTML("This test is for the host only
"); exit $V6evalTool::exitHostOnly; } $type=$V6evalTool::NutDef{Type}; if($type ne host) { vLogHTML(ndErrmsg("ERROR: $V6evalTool::NutDef{Type}: ". "Unknown target type
")); exit $V6evalTool::exitFail; } # # sub test definition: # - sending pattern, # - SLLA vs cached LLA # - expected state # - message # $idx_ptn=0; $idx_lla=1; $idx_exp=2; $idx_explla=3; $idx_msg=4; $idx_inc_ip=5; $idx_prb_ip=6; $idx_rpy_ip=7; $idx_ign_ip=8; $idx_non_n=9; $idx_rpy_n=10; $idx_ign_n=11; $idx_stl_sr=12; $idx_ign_sr=13; @null=(); # @def_RDredirect_rone2nut= ( RDredirect_rone2nut, same, INCOMPLETE, unchanged, 'Redirect w/o TLL', \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null ); # @reply_RDredirect_rone2nut_tll=(nd_echo_reply); @def_RDredirect_rone2nut_tll= ( RDredirect_rone2nut_tll, same, STALE, unchanged, 'Redirect w/ TLL', \@null, \@null, \@reply_RDredirect_rone2nut_tll, \@null, \@null, \@null, \@null, \@null, \@null ); # @reply_RDredirect_rone2nut_tll_rd1280=(nd_echo_reply); @def_RDredirect_rone2nut_tll_rd1280= ( RDredirect_rone2nut_tll_rd1280, same, STALE, unchanged, 'Redirect w/ TLL, w/ RDed(1280)', \@null, \@null, \@reply_RDredirect_rone2nut_tll_rd1280, \@null, \@null, \@null, \@null, \@null, \@null ); # @reply_RDredirect_rone2nut_tll_rd1288=(nd_echo_reply); @def_RDredirect_rone2nut_tll_rd1288= ( RDredirect_rone2nut_tll_rd1288, same, STALE, unchanged, 'Redirect w/ TLL, w/ RDed(>1280)', \@null, \@null, \@reply_RDredirect_rone2nut_tll_rd1288, \@null, \@null, \@null, \@null, \@null, \@null ); # # # @defs= ( \@def_RDredirect_rone2nut, \@def_RDredirect_rone2nut_tll, \@def_RDredirect_rone2nut_tll_rd1280, \@def_RDredirect_rone2nut_tll_rd1288, ); # # # vCapture($IF); # # # $idx=0; foreach(@defs) { $exp=@$_[$idx_exp]; $explla=@$_[$idx_explla]; $msg=@$_[$idx_msg]; vLogHTML("
"); vLogHTML("*** INCOMPLETE vs. $msg ***
"); $s=checkState($_); $c=ndCachedLLA($explla); if($s =~ /$exp/ && $c eq $explla) { $result{$idx}=$V6evalTool::exitPass; vLogHTML("OK: The target was $s/$c
"); } else { $exit_rtn=$V6evalTool::exitFail; $result{$idx}=$exit_rtn; vLogHTML("". ndErrmsg("NG: The target was $s/$c")."
"); } $title{$idx}="$msgexp:$exp/$expllaresult:$s/$c"; $idx++; vLogHTML("
Termination
"); $pktdesc{RDredirect_tn2nut}= "Reset the Destination Cache entry for TN to router R1
"; vSend($IF, RDredirect_tn2nut); clear(); } $idx--; # # # #clear(); # # # @col=('PTN', 'EXP(State/Cached LLA)', 'RESULT(State/Cached LLA)'); ndPrintSummaryHTML("*** Test Summary: INCOMPLETE vs. Redirect ***", @col, %title, %result, $idx); # # # vLogHTML("*** EOT ***
"); exit $exit_rtn; # # # sub clear() { vLogHTML("
Termination
"); rdClear($IF); } sub checkState(\@) { my($def)=@_; my($ptn)=@$def[$idx_ptn]; my($lla)=@$def[$idx_lla]; my($exp)=@$def[$idx_exp]; my($msg)=@$def[$idx_msg]; my($inc_ip)=@$def[$idx_inc_ip]; my($prb_ip)=@$def[$idx_prb_ip]; my($rpy_ip)=@$def[$idx_rpy_ip]; my($ign_ip)=@$def[$idx_ign_ip]; my($non_n)=@$def[$idx_non_n]; my($rpy_n)=@$def[$idx_rpy_n]; my($ign_n)=@$def[$idx_ign_n]; my($stl_sr)=@$def[$idx_stl_sr]; my($ign_sr)=@$def[$idx_ign_sr]; vLogHTML("Initialization
"); goto error if rd2Incomplete($IF) != 0; vClear($IF); vLogHTML("Test
"); $pktdesc{$ptn}="Send $msg"; vSend($IF, $ptn); my($s)=ndStatusNum2Str(ndStatus( $IF, @$inc_ip, @$prb_ip, @$rpy_ip, @$ign_ip, @$non_n, @$rpy_n, @$ign_n, @$stl_sr, @$ign_sr, ) ); return $s; error: return("ERROR"); } ######################################################################## __END__ =head1 NAME ncStateByRedirect4Incomplete - Verifying State Machine: Redirect vs. INCOMPLETE =head1 TARGET Host only =head1 SYNOPSIS ncStateByRedirect4Incomplete.seq [-tooloption ...] -p ncStateByRedirect4Incomplete.def =head1 INITIALIZATION =begin html
  1. Set R1 as the default router by sending RA and NA.
  2. Set TN's Neighbor Cache State to INCOMPLETE.

  TN                 NUT
  ----------------------

State: NONCE (for R1, TN)
==== unsolicited RA ===> src=R1's link-local dst=all-node M=0, O=0 RouterLifetime=600 ReachableTime=0 RetransTimer=0 w/ SLLA Prefix Option: L=1, A=1 ValidLifetime=2592000 PreferredLifetime=604800 Prefix=3ffe:501:ffff:100::/64
State: STALE (for R1), NONCE (for TN)
==== solicited NA ===> src=R1's link-local dst=NUT's link-local R=1, S=1, O=1 target=R1's link-local TLLA=R1's LLA
State: REACHABLE (for R1), NONCE (for TN)
Wait (3 sec) for DAD NS
==== echo-request ===> src=TN's link-local dst=NUT's link-local
State: REACHABLE (for R1), INCOMPLETE (for TN)
=end html =head1 TEST PROCEDURE B verifies that state transition for a NUT in INCOMPLETE state when receiving a Redirect. =begin html
  TN               NUT
  ----------------------

State: REACHABLE (for R1), INCOMPLETE (for TN)
==== Redirect ===> src=R1's link-local dst=NUT's link-local icmp target=TN's link-local icmp dst=H1's global w/ or w/o TLL option w/ or w/o Redirected header option
Judgment: Examining NUT's neighbor cache state
=end html =head1 JUDGMENT =begin html

8.3. Host Specification
If the redirect contains a Target Link-Layer Address option the host either creates or updates the Neighbor Cache entry for the target. In both cases the cached link-layer address is copied from the Target Link-Layer Address option. If a Neighbor Cache entry is created for the target its reachability state MUST be set to STALE as specified in Section 7.3.3. If a cache entry already existed and it is updated with a different link-layer address, its reachability state MUST also be set to STALE. If the link-layer address is the same as that already in the cache, the cache entry's state remains unchanged.
=====================+=====================+===========+=============================== IP |ICMP |Option |NC state ----------+----------+----------+----------+-----+-----+----------+----------+--------- Src |Dst |Target |Dst |TLLA |R'ed |Current |New |LLA ==========+==========+==========+==========+=====+=====+==========+==========+========= R1's |NUT's |TN's |H1's |none |none |INCOMPLETE|INCOMPLETE|unchanged link-local|link-local|link-local|global | | | | | ----------+----------+----------+----------+-----+-----+----------+----------+--------- R1's |NUT's |TN's |H1's |exist|none |INCOMPLETE|STALE |updated link-local|link-local|link-local|global | | | | | ----------+----------+----------+----------+-----+-----+----------+----------+--------- R1's |NUT's |TN's |H1's |exist|exist|INCOMPLETE|STALE |updated link-local|link-local|link-local|global | | | | | ----------+----------+----------+----------+-----+-----+----------+----------+--------- R1's |NUT's |TN's |H1's |exist|exist|INCOMPLETE|STALE |updated link-local|link-local|link-local|global | |>1280| | | ==========+===========+=========+==========+=====+=====+==========+==========+=========
=end html =head1 TERMINATION =begin html
  TN               NUT
  ----------------------

State: any (for TN)
==== Redirect ===> src=TN's link-local dst=NUT's link-local icmp target=R1's link-local icmp dst=H1's global w/o TLL option w/o Redirected header option
==== RA (at the end of the test) ===> src=R1's link-local dst=allnode RouterLifetime=0
=end html =head1 NOTE The test does not invoke any remote command. =head1 SEE ALSO perldoc V6evalTool perldoc V6evalRemote =cut