#!/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/hostRecvRedirect4OfflinkDC.seq,v 1.20 2002/02/27 06:11:40 masaxmasa Exp $
########################################################################
BEGIN { $V6evalTool::TestVersion = '$Name: REL_2_1_1 $ '; }
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;
$idx=0;
$wait_dad=3;
$wait_echo=2;
$drs_policy=fifo;
#
#
#
@valid_ra_ptn=(
redirect_rone2nut,
redirect_rone2nut_tll,
redirect_rone2nut_rd,
redirect_rone2nut_tll_rd,
redirect_rone2nutg,
redirect_rone2nutg_tll,
redirect_rone2nutg_rd,
redirect_rone2nutg_tll_rd,
redirect_rone2nut_tll_rdbogus,
redirect_rone2nut_tll_rd_multidst,
);
@valid_ra_msg=(
"Redirect, dst=link-local, w/o TLL, w/o RDed",
"Redirect, dst=link-local, w/ TLL, w/o RDed",
"Redirect, dst=link-local, w/o TLL, w/ RDed",
"Redirect, dst=link-local, w/ TLL, w/ RDed",
"Redirect, dst=global, w/o TLL, w/o RDed",
"Redirect, dst=global, w/ TLL, w/o RDed",
"Redirect, dst=global, w/o TLL, w/ RDed",
"Redirect, dst=global, w/ TLL, w/ RDed",
"Redirect, dst=link-local w/ TLL, w/ *RDed(>1280, bogus)",
"Redirect, *dst=multicast, w/ TLL, w/ RDed",
);
@invalid_ra_ptn=(
redirect_rone2nut_tll_rd_invalid_globalsrc,
redirect_rone2nut_tll_rd_invalid_hoplimit,
redirect_rone2nut_tll_rd_invalid_icmpcode,
redirect_rone2nut_tll_rd_invalid_chksum,
redirect_rone2nut_tll_rd_invalid_router,
);
@invalid_ra_msg=(
"Redirect, src=global (INVALID)",
"Redirect, hoplimit!=255 (INVALID)",
"Redirect, icmp code!=0 (INVALID)",
"Redirect, invalid checksum (INVALID)",
"Redirect, invalid router (INVALID)",
);
#
#
#
$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;
}
#
#
#
vCapture($IF);
#
#
#
$i=0;
foreach(@valid_ra_ptn) {
my($ptn)=$_;
my($msg)=$valid_ra_msg[$i];
vLogHTML("
TN NUT ----------------------=end html =head1 TEST PROCEDURE B
State: NONCE (for R1, TN)
==== unsolicited RA ===> src=R1's link-local dst=all-node M=0, O=0 RouterLifetime=0 ReachableTime=0 RetransTimer=0
==== unsolicited RA ===> src=TN's link-local dst=all-node M=0, O=0 RouterLifetime=0 ReachableTime=0 RetransTimer=0
==== 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)
==== 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=TN's link-local TLLA=TN's LLA
State: REACHABLE (for R1, TN)
Wait (3 sec) for DAD NS
TN NUT ----------------------=end html =head1 JUDGMENT =for html 1. NUT must throw echo-reply whose destination is off-link global to the default router, ie R1. =for html 2. Valid redirect messages vs. Destination Cache ========================================================+=============+======================= Valid redirect message that NUT receives |Destination | Expected packet ---------------------+-----------------+----------------+Cache | IP |ICMP |Options |for H1 | ----------+----------+----------+------+-----+----------+-------+-----+ Src |Dst |Target |Dst |TLLA |Redirected|Before |After| ==========+==========+==========+======+=====+==========+=======+=====+======================= link-local|link-local|link-local|global|none |none |R1 |TN |echo-reply (R1) |(NUT) |(TN) |(H1) | | | | | src=NUT's global | | | | | | | | dst=H1's global | | | | | | | | but, LLA is TN's ----------+----------+----------+------+-----+----------+-------+-----+----------------------- - |- |- |- |none |exist |R1 |TN |echo-reply | | | | | | | | src=NUT's global | | | | | | | | dst=H1's global | | | | | | | | but, LLA is TN's ----------+----------+----------+------+-----+----------+-------+-----+----------------------- - |- |- |- |exist|none |R1 |TN |echo-reply | | | | | | | | src=NUT's global | | | | | | | | dst=H1's global | | | | | | | | but, LLA is TN's ----------+----------+----------+------+-----+----------+-------+-----+----------------------- - |- |- |- |exist|exist |R1 |TN |echo-reply | | | | | | | | src=NUT's global | | | | | | | | dst=H1's global | | | | | | | | but, LLA is TN's ----------+----------+----------+------+-----+----------+-------+-----+----------------------- - |global |- |- |none |none |R1 |TN |echo-reply |(NUT) | | | | | | | src=NUT's global | | | | | | | | dst=H1's global | | | | | | | | but, LLA is TN's ----------+----------+----------+------+-----+----------+-------+-----+----------------------- - |- |- |- |none |exist |R1 |TN |echo-reply | | | | | | | | src=NUT's global | | | | | | | | dst=H1's global | | | | | | | | but, LLA is TN's ----------+----------+----------+------+-----+----------+-------+-----+----------------------- - |- |- |- |exist|none |R1 |TN |echo-reply | | | | | | | | src=NUT's global | | | | | | | | dst=H1's global | | | | | | | | but, LLA is TN's ----------+----------+----------+------+-----+----------+-------+-----+----------------------- - |- |- |- |exist|exist |R1 |TN |echo-reply | | | | | | | | src=NUT's global | | | | | | | | dst=H1's global | | | | | | | | but, LLA is TN's ==========+==========+==========+======+=====+==========+=======+=====+======================= -: same as above =for html 3. Suspicious redirect messages vs. Destination Cache ========================================================+============+======================== Suspicious redirect message that NUT receives |Destination |Expected packet ---------------------+-----------------+----------------+Cache | IP |ICMP |Options |for H1 | ----------+----------+----------+------+-----+----------+------+-----+ Src |Dst |Target |Dst |TLLA |Redirected|Before|After| ==========+==========+==========+======+=====+==========+======+=====+======================== link-local|link-local|link-local|global|exist|exist |R1 |TN |echo-reply (R1) |(NUT) |(TN) |(H1) | |> 1280 and| | | src=NUT's global | | | | |bogus | | | dst=H1's global | | | | |*susp. | | | but, LLA is TN's ----------+----------+----------+------+-----+----------+------+-----+------------------------ - |all-node |- |- |exist|exist |R1 |TN |echo-reply |*susp. | | | | | | | src=NUT's global | | | | | | | | dst=H1's global | | | | | | | | but, LLA is TN's ==========+==========+==========+======+=====+==========+======+=====+======================== -: same as above =for html 4. Invalid redirect messages vs. Destination Cache ==============================================================+============+====================== Invalid redirect message that NUT receive |Destination |Expected packet ---------------------+----------------------------------------+Cache | IP |ICMP |for H1 | ----------+----------+--------+----+--------+----------+------+------------+ Src |Dst |Hoplimit|Code|Checksum|Target |Dst |Before|After| ==========+==========+========+====+========+==========+======+======+=====+====================== global |link-local|255 |0 |valid |link-local|global|R1 |R1 |echo-reply *invalid |(NUT) | | | |(TN) |(H1) | | | src=NUT's global | | | | | | | | | dst=H1's global | | | | | | | | | but LLA is R1's ----------+----------+--------+----+--------+----------+------+------+-----+---------------------- bogus |- |- |- |- |- |- |R1 |R1 |echo-reply router's | | | | | | | | | src=NUT's global link-local| | | | | | | | | dst=H1's global *invalid | | | | | | | | | but LLA is R1's ----------+----------+--------+----+--------+----------+------+------+-----+---------------------- link-local|- |!=255 |- |- |- |- |R1 |R1 |echo-reply (R1) | |*invalid| | | | | | | src=NUT's global | | | | | | | | | dst=H1's global | | | | | | | | | but LLA is R1's ----------+----------+--------+----+--------+----------+------+------+-----+---------------------- - |- |255 |!=0 |- |- |- |R1 |R1 |echo-reply | | |*inv| | | | | | src=NUT's global | | | | | | | | | dst=H1's global | | | | | | | | | but LLA is R1's ----------+----------+--------+----+--------+----------+------+------+-----+---------------------- - |- |- |0 |*invalid|- |- |R1 |R1 |echo-reply | | | | | | | | | src=NUT's global | | | | | | | | | dst=H1's global | | | | | | | | | but LLA is R1's ==========+==========+========+====+========+==========+======+======+=====+====================== -: same as above =head1 TERMINATION Send RAs to clear the Default Router List: - RA (src=R1) with RouterLifetime=0 - RA (src=TN) with RouterLifetime=0 Clear IPv6 routes by remote command. XXX =head1 NOTE The test invokes the following command: - Clear IPv6 routes =head1 SEE ALSO perldoc V6evalTool perldoc V6evalRemote =cut
State: REACHABLE (for R1, TN)
==== echo-request ===> src=H1(off-link global), prefix=3ffe:501:ffff:109::/64, but LLA is R1's one dst=NUT's global, prefix=3ffe:501:ffff:100::/64
<=== Judgment #1: echo-reply ==== src=NUT's global, prefix=3ffe:501:ffff:100::/64 dst=H1(off-link global), prefix=3ffe:501:ffff:109::/64, but LLA is R1's one
==== redirect ===> valid redirect OR suspicious redirect OR invalid redirect
==== echo-request ===> src=H1(off-link global), prefix=3ffe:501:ffff:109::/64, but LLA is R1's one dst=NUT's global, prefix=3ffe:501:ffff:100::/64
<=== echo-reply ==== If the message is either valid or suspicious, NUT throw echo-reply to TN (the better router) : src=NUT's global, prefix=3ffe:501:ffff:100::/64 dst=H1(off-link global), prefix=3ffe:501:ffff:109::/64,but LLA is TN's one OR If the message is invalid, NUT throw echo-reply to R1 (the default router) : src=NUT's global, prefix=3ffe:501:ffff:100::/64 dst=H1(off-link global), prefix=3ffe:501:ffff:109::/64,but LLA is R1's one