#!/usr/bin/perl # # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 Yokogawa Electric Corporation, # IPA (Information-technology Promotion Agency, 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/nd/ncStateByNa4Reachable.seq,v 1.31 2002/02/27 01:08:26 masaxmasa Exp $ ######################################################################## BEGIN { $V6evalTool::TestVersion = '$Name: REL_2_1_2 $ '; } use V6evalTool; use nd; ndOptions(@ARGV); # The following generate debugging messages. $nd::debug=$ndOpt_v|$ndOpt_vv; # You can specifies debug options 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; # # 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_unicast_na_tn2nut_rso= ( unicast_na_tn2nut_rso, same, REACHABLE, unchanged, 'unicast rso NA w/o TLL', \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null ); # @def_unicast_na_tn2nut_rsO= ( unicast_na_tn2nut_rsO, same, REACHABLE, unchanged, 'unicast rsO NA w/o TLL', \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null ); # @def_unicast_na_tn2nut_rSo= ( unicast_na_tn2nut_rSo, same, REACHABLE, unchanged, 'unicast NA rSo w/o TLL', \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null ); # @def_unicast_na_tn2nut_rSO= ( unicast_na_tn2nut_rSO, same, REACHABLE, unchanged, 'unicast NA rSO w/o TLL', \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null ); # @def_unicast_na_tn2nut_rso_tll= ( unicast_na_tn2nut_rso_tll, same, REACHABLE, unchanged, 'unicast NA rso w/ TLL', \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null ); # @def_unicast_na_tn2nut_rsO_tll= ( unicast_na_tn2nut_rsO_tll, same, REACHABLE, unchanged, 'unicast rsO NA w/ TLL', \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null ); # @def_unicast_na_tn2nut_rSo_tll= ( unicast_na_tn2nut_rSo_tll, same, REACHABLE, unchanged, 'unicast rSo NA w/ TLL', \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null ); # @def_unicast_na_tn2nut_rSO_tll= ( unicast_na_tn2nut_rSO_tll, same, REACHABLE, unchanged, 'unicast rSO NA w/ TLL', \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null ); # @def_multicast_na_tn2allnode_rso= ( multicast_na_tn2allnode_rso, same, REACHABLE, unchanged, 'multicast rso NA w/o TLL (INVALID)', \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null ); # @def_multicast_na_tn2allnode_rsO= ( multicast_na_tn2allnode_rsO, same, REACHABLE, unchanged, 'multicast rsO NA w/o TLL (INVALID)', \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null ); # @def_multicast_na_tn2allnode_rSo= ( multicast_na_tn2allnode_rSo, same, REACHABLE, unchanged, 'multicast rSo NA w/o TLL (INVALID)', \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null ); # @def_multicast_na_tn2allnode_rSO= ( multicast_na_tn2allnode_rSO, same, REACHABLE, unchanged, 'multicast rSO NA w/o TLL (INVALID)', \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null ); # @def_multicast_na_tn2allnode_rso_tll= ( multicast_na_tn2allnode_rso_tll, same, REACHABLE, unchanged, 'multicast rso NA w/ TLL', \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null ); # @def_multicast_na_tn2allnode_rsO_tll= ( multicast_na_tn2allnode_rsO_tll, same, REACHABLE, unchanged, 'multicast rsO NA w/ TLL', \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null ); # @def_multicast_na_tn2allnode_rSo_tll= ( multicast_na_tn2allnode_rSo_tll, same, REACHABLE, unchanged, 'multicast rSo NA w/ TLL (INVALID)', \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null ); # @def_multicast_na_tn2allnode_rSO_tll= ( multicast_na_tn2allnode_rSO_tll, same, REACHABLE, unchanged, 'multicast rSO NA w/ TLL (INVALID)', \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null ); # @def_unicast_na_tn2nut_rso_tll2_diff= ( unicast_na_tn2nut_rso_tll2, same, STALE, unchanged, 'unicast NA rso w/ TLL, diff. LLA', \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null ); # @def_unicast_na_tn2nut_rsO_tll_diff= ( unicast_na_tn2nut_rsO_tll, diff, STALE, updated, 'unicast NA rsO w/ TLL, diff. LLA', \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null ); # @def_unicast_na_tn2nut_rSo_tll2_diff= ( unicast_na_tn2nut_rSo_tll2, same, STALE, unchanged, 'unicast NA rSo w/ TLL, diff. LLA', \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null ); # @def_unicast_na_tn2nut_rSO_tll_diff= ( unicast_na_tn2nut_rSO_tll, diff, REACHABLE, updated, 'unicast NA rSO w/ TLL, diff. LLA', \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null ); # @def_multicast_na_tn2allnode_rso_tll2_diff= ( multicast_na_tn2allnode_rso_tll2, same, STALE, unchanged, 'multicast rso NA w/ TLL, diff. LLA', \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null ); # @def_multicast_na_tn2allnode_rsO_tll_diff= ( multicast_na_tn2allnode_rsO_tll, diff, STALE, updated, 'multicast rsO NA w/ TLL, diff. LLA', \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null ); # @def_multicast_na_tn2allnode_rSo_tll2_diff= ( multicast_na_tn2allnode_rSo_tll2, same, REACHABLE, unchanged, 'multicast rSo NA w/ TLL (INVALID), diff. LLA', \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null ); # @def_multicast_na_tn2allnode_rSO_tll2_diff= ( multicast_na_tn2allnode_rSO_tll2, same, REACHABLE, unchanged, 'multicast rSO NA w/ TLL (INVALID), diff. LLA', \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null, \@null ); # # # @defs= ( \@def_unicast_na_tn2nut_rso, \@def_unicast_na_tn2nut_rsO, \@def_unicast_na_tn2nut_rSo, \@def_unicast_na_tn2nut_rSO, \@def_unicast_na_tn2nut_rso_tll, \@def_unicast_na_tn2nut_rsO_tll, \@def_unicast_na_tn2nut_rSo_tll, \@def_unicast_na_tn2nut_rSO_tll, \@def_multicast_na_tn2allnode_rso, \@def_multicast_na_tn2allnode_rsO, \@def_multicast_na_tn2allnode_rSo, \@def_multicast_na_tn2allnode_rSO, \@def_multicast_na_tn2allnode_rso_tll, \@def_multicast_na_tn2allnode_rsO_tll, \@def_multicast_na_tn2allnode_rSo_tll, \@def_multicast_na_tn2allnode_rSO_tll, \@def_unicast_na_tn2nut_rso_tll2_diff, \@def_unicast_na_tn2nut_rsO_tll_diff, \@def_unicast_na_tn2nut_rSo_tll2_diff, \@def_unicast_na_tn2nut_rSO_tll_diff, \@def_multicast_na_tn2allnode_rso_tll2_diff, \@def_multicast_na_tn2allnode_rsO_tll_diff, \@def_multicast_na_tn2allnode_rSo_tll2_diff, \@def_multicast_na_tn2allnode_rSO_tll2_diff, ); # # # vCapture($IF); # # # $idx=0; foreach(@defs) { $exp=@$_[$idx_exp]; $msg=@$_[$idx_msg]; $explla=@$_[$idx_explla]; vLogHTML("
TN NUT ----------------------=end html =head2 Cache a bogus LLA =begin html
State: NONCE (for TN)
==== echo-request ===> src=TN's link-local dst=NUT's link-local
State: INCOMPLETE (for TN)
<=== multicast NS ==== src=NUT's link-local dst=solicited-node[TN's link-local] target=TN's link-local w/ SLLA timeout: RETRANS_TIMER * MAX_MULTICAST_SOLICIT
==== solicited NA ===> src=TN's link-local dst=NUT's link-local target=TN's link-local TLLA=TN's LLA
State: REACHABLE (for TN)
TN NUT ----------------------=end html =head1 TEST PROCEDURE B
State: NONCE (for TN)
==== echo-request ===> src=TN's link-local dst=NUT's link-local
State: INCOMPLETE (for TN)
<=== multicast NS ==== src=NUT's link-local dst=solicited-node[TN's link-local] target=TN's link-local w/ SLLA timeout: RETRANS_TIMER * MAX_MULTICAST_SOLICIT
==== solicited NA ===> src=TN's link-local dst=NUT's link-local target=TN's link-local TLLA=a bogus LLA
State: REACHABLE (for TN)
TN NUT ----------------------=end html =head1 JUDGMENT =begin html
State: REACHABLE (for TN)
==== NA ===> src=TN's link-local dst=NUT's link-local or all-node w/o or w/ TLLA r=0, s=0/1, o=0/1
Judgment: Examining NUT's neighbor cache state
=end html =head1 TERMINATION N/A =head1 NOTE The test does not invoke any remote command. =head1 SEE ALSO perldoc V6evalTool perldoc V6evalRemote =cut
7.2.5. Receipt of Neighbor Advertisements
IF(State != INCOMPLETE) { If the target's Neighbor Cache entry is in any state other than INCOMPLETE when the advertisement is received, processing becomes quite a bit more complex. IF(Override==0 && TLLA!=LLA) { If the Override flag is clear and the supplied link-layer address differs from that in the cache, then one of two actions takes place: IF(REACHABLE) { if the state of the entry is REACHABLE, set it to STALE, but do not update the entry in any other way; } ELSE { otherwise, the received advertisement should be ignored and must not update the cache. } } ELSIF(Override==1 || (Override==0 && TLLA==LLA) || TLLA==NULL) { If the Override flag is set, both the Override flag is clear and the supplied link-layer address is the same as that in the cache, or no Target Link-layer address option was supplied, the received advertisement must update the Neighbor Cache entry as follows: - The link-layer address in the Target Link-Layer Address option must be inserted in the cache (if one is supplied and is different than the already recorded address). - IF(Solicited flag==1) { If the Solicited flag is set, the state of the entry must be set to REACHABLE. } ELSIF(Solicited flag==0 && TLLA!=LLA) { If the Solicited flag is zero and the link-layer address was updated with a different address the state must be set to STALE. } ELSE { Otherwise, the entry's state remains unchanged. } An advertisement's Solicited flag should only be set if the advertisement is a response to a Neighbor Solicitation. Because Neighbor Unreachability Detection Solicitations are sent to the cached link-layer address, receipt of a solicited advertisement indicates that the forward path is working. Receipt of an unsolicited advertisement, however, suggests that a neighbor has urgent information to announce (e.g., a changed link-layer address). If the urgent information indicates a change from what a node is currently using, the node should verify the reachability of the (new) path when it sends the next packet. There is no need to update the state for unsolicited advertisements that do not change the contents of the cache.
- The IsRouter flag in the cache entry must be set based on the Router flag in the received advertisement. In those cases where the IsRouter flag changes from TRUE to FALSE as a result of this update, the node must remove that router from the Default Router List and update the Destination Cache entries for all destinations using that neighbor as a router as specified in Section 7.3.3. This is needed to detect when a node that is used as a router stops forwarding packets due to being configured as a host. } }
================================+===============+============= NA |New State |cached LLA ---------------+-+--+-+---------+ | Destination |r| s|o|TLLA | | ===============+=+==+=+=========+===============+============= Unicast 0 0 0 none REACHABLE unchanged ---------------+-+--+-+---------+---------------+------------- Unicast 0 0 1 none REACHABLE unchanged ---------------+-+--+-+---------+---------------+------------- Unicast 0 1 0 none REACHABLE unchanged ---------------+-+--+-+---------+---------------+------------- Unicast 0 1 1 none REACHABLE unchanged ===============+=+==+=+=========+===============+============= Unicast 0 0 0 same REACHABLE unchanged ---------------+-+--+-+---------+---------------+------------- Unicast 0 0 1 same REACHABLE unchanged ---------------+-+--+-+---------+---------------+------------- Unicast 0 1 0 same REACHABLE unchanged ---------------+-+--+-+---------+---------------+------------- Unicast 0 1 1 same REACHABLE unchanged ===============+=+==+=+=========+===============+============= Unicast 0 0 0 different STALE unchanged ---------------+-+--+-+---------+---------------+------------- Unicast 0 0 1 different STALE *updated ---------------+-+--+-+---------+---------------+------------- Unicast 0 1 0 different STALE unchanged ---------------+-+--+-+---------+---------------+------------- Unicast 0 1 1 different REACHABLE *updated ===============+=+==+=+=========+===============+============= *Multicast 0 0 0 *none REACHABLE unchanged *invalid ---------------+-+--+-+---------+---------------+------------- *Multicast 0 0 1 *none REACHABLE unchanged *invalid ---------------+-+--+-+---------+---------------+------------- *Multicast 0 *1 0 *none REACHABLE unchanged *invalid ---------------+-+--+-+---------+---------------+------------- *Multicast 0 *1 1 *none REACHABLE unchanged *invalid ===============+=+==+=+=========+===============+============= Multicast 0 0 0 same REACHABLE unchanged ---------------+-+--+-+---------+---------------+------------- Multicast 0 0 1 same REACHABLE unchanged ---------------+-+--+-+---------+---------------+------------- *Multicast 0 *1 0 same REACHABLE unchanged *invalid ---------------+-+--+-+---------+---------------+------------- *Multicast 0 *1 1 same REACHABLE unchanged *invalid ===============+=+==+=+=========+===============+============= Multicast 0 0 0 different STALE unchanged ---------------+-+--+-+---------+---------------+------------- Multicast 0 0 1 different STALE *updated ---------------+-+--+-+---------+---------------+------------- *Multicast 0 *1 0 different REACHABLE unchanged *invalid ---------------+-+--+-+---------+---------------+------------- *Multicast 0 *1 1 different REACHABLE unchanged *invalid ===============+=+==+=+=========+===============+=============