#!/usr/bin/perl
#
# Copyright (C) 1999, 2000, 2001, 2002, 2003 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/ncStateByRedirect4Probe.seq,v 1.28 2002/02/27 01:08:27 masaxmasa Exp $
########################################################################
BEGIN { $V6evalTool::TestVersion = '$Name: REL_2_1_1 $ '; }
use V6evalTool;
use nd;
use hostRedirect;
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;
#
#
#
$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,
PROBE,
unchanged,
'Redirect w/o TLL',
\@null, \@null, \@null, \@null,
\@null, \@null, \@null,
\@null, \@null
);
#
@def_RDredirect_rone2nut_tll=
(
RDredirect_rone2nut_tll,
same,
PROBE,
unchanged,
'Redirect w/ TLL',
\@null, \@null, \@null, \@null,
\@null, \@null, \@null,
\@null, \@null
);
#
@def_RDredirect_rone2nut_tll_diff=
(
RDredirect_rone2nut_tll,
diff,
STALE,
updated,
'Redirect w/ TLL(diff. LLA)',
\@null, \@null, \@null, \@null,
\@null, \@null, \@null,
\@null, \@null
);
#
@def_RDredirect_rone2nut_tll_rd1280_diff=
(
RDredirect_rone2nut_tll_rd1280,
diff,
STALE,
updated,
'Redirect w/ TLL(diff. LLA), w/ RDed(1280)',
\@null, \@null, \@null, \@null,
\@null, \@null, \@null,
\@null, \@null
);
#
@def_RDredirect_rone2nut_tll_rd1288_diff=
(
RDredirect_rone2nut_tll_rd1288,
diff,
STALE,
updated,
'Redirect w/ TLL(diff. LLA), w/ RDed(>1280)',
\@null, \@null, \@null, \@null,
\@null, \@null, \@null,
\@null, \@null
);
#
#
#
@defs=
(
\@def_RDredirect_rone2nut,
\@def_RDredirect_rone2nut_tll,
\@def_RDredirect_rone2nut_tll_diff,
\@def_RDredirect_rone2nut_tll_rd1280_diff,
\@def_RDredirect_rone2nut_tll_rd1288_diff,
);
#
#
#
vCapture($IF);
#
#
#
$idx=0;
foreach(@defs) {
$exp=@$_[$idx_exp];
$explla=@$_[$idx_explla];
$msg=@$_[$idx_msg];
vLogHTML("
TN NUT ----------------------=end html =head2 Cache a bogus LLA =begin html
State: NONCE (for all)
==== 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
==== unsolicited RA ===> src=TN'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: REACHABLE (for R1), STALE (for TN)
==== solicited NA ===> src=TN's link-local dst=NUT's link-local R=1, S=1, O=1 target=R1's link-local TLLA=TN's LLA
State: REACHABLE (for R1), REACHABLE (for TN)
Wait (REACHABLE_TIME * MAX_RANDOM_FACTOR)
State: REACHABLE (for R1), STALE (for TN)
==== echo-request ===> src=TN's link-local dst=NUT's link-local
<=== echo-reply ==== src=NUT's link-local dst=TN's link-local timeout=2 sec
State: DELAY
Wait (DELAY_FIRST_PROBE_TIME)
State: REACHABLE (for R1), PROBE (for TN)
TN NUT ----------------------=end html =head1 TEST PROCEDURE B
State: NONCE (for all)
==== 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
==== unsolicited RA ===> src=TN'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: REACHABLE (for R1), STALE (for TN)
==== solicited NA ===> src=TN's link-local dst=NUT's link-local R=1, S=1, O=1 target=R1's link-local TLLA=bogus LLA
State: REACHABLE (for R1), REACHABLE (for TN)
Wait (REACHABLE_TIME * MAX_RANDOM_FACTOR)
State: REACHABLE (for R1), STALE (for TN)
==== echo-request ===> src=TN's link-local dst=NUT's link-local
<=== echo-reply ==== src=NUT's link-local dst=TN's link-local timeout=2 sec
State: DELAY
Wait (DELAY_FIRST_PROBE_TIME)
State: REACHABLE (for R1), PROBE (for TN)
TN NUT ----------------------=end html =head1 JUDGMENT =begin html
State: REACHABLE (for R1), PROBE (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 (i.e. TN's LLA) w/ or w/o Redirected header option
Judgment: Examining NUT's neighbor cache state
=end html =head1 TERMINATION =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 |PROBE |PROBE |unchanged link-local|link-local|link-local|global | | | | | ----------+----------+----------+----------+-----+-----+---------+---------+--------- R1's |NUT's |TN's |H1's |same |none |PROBE |PROBE |unchanged link-local|link-local|link-local|global | | | | | ----------+----------+----------+----------+-----+-----+---------+---------+--------- R1's |NUT's |TN's |H1's |diff.|none |PROBE |STALE |updated link-local|link-local|link-local|global | | | | | ----------+----------+----------+----------+-----+-----+---------+---------+--------- R1's |NUT's |TN's |H1's |diff.|exist|PROBE |STALE |updated link-local|link-local|link-local|global | | | | | ----------+----------+----------+----------+-----+-----+---------+---------+--------- R1's |NUT's |TN's |H1's |diff.|exist|PROBE |STALE |updated link-local|link-local|link-local|global | |>1280| | | ==========+==========+==========+==========+=====+=====+=========+=========+=========
TN NUT ----------------------=end html =head1 NOTE The test does not invoke any remote command. =head1 SEE ALSO perldoc V6evalTool perldoc V6evalRemote =cut
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