#!/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/hostRecvRaRLifetime0.seq,v 1.24 2002/02/27 01:08:25 masaxmasa Exp $ ######################################################################## BEGIN { $V6evalTool::TestVersion = '$Name: REL_2_1_2 $ '; } use V6evalTool; use nd; sub checkDefaultRouter($); 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; $wait_dad=3; $wait_echo=2; # # # $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; } # # # vLogHTML("
Initialization
"); vCapture($IF); # # # #goto error if ndClearPrefix() != 0; #goto error if ndClearDefr() != 0; #goto error if nd2NoNce($IF) != 0; # # # $pktdesc{ra_tn2allnode_sll}='Router TN Send RA w/ SLL, NC[TN]=STALE'; $pktdesc{ra_y2allnode_sll}='Router Y Send RA w/ SLL, NC[Y]=STALE'; $pktdesc{ra_z2allnode_sll}='Router Z Send RA w/ SLL, NC[Y]=STALE'; %ret=vSend($IF, ra_tn2allnode_sll, ra_y2allnode_sll, ra_z2allnode_sll, ); goto error if $ret{status} != 0; vLogHTML("Wait for DAD NSs
"); vRecv($IF, $wait_dad, 0, 0); $pktdesc{unicast_na_tn2nut_RSO_tll}='Router TN send NA, NC[TN]=REACHABLE'; $pktdesc{unicast_na_y2nut_RSO_tll}='Router Y send NA, NC[Y]=REACHABLE'; $pktdesc{unicast_na_z2nut_RSO_tll}='TRouter Z send NA, NC[Z]=REACHABLE'; %ret=vSend($IF, unicast_na_tn2nut_RSO_tll, unicast_na_y2nut_RSO_tll, unicast_na_z2nut_RSO_tll, ); $i=0; $tn_done=0; $y_done=0; $z_done=0; vLogHTML("
Test
"); while(1) { $s=checkDefaultRouter($p); if($s eq echo_reply_nut2x_via_tn) { if($tn_done) { vLogHTML(ndErrmsg("ERROR: NUT doesn't recognize RA ". "(RouterLifetime=0)
")); goto error; } $pktdesc{ra_tn2allnode_sll_clear}= 'Router TN send RA w/ RouterLifetime=0'; $p='ra_tn2allnode_sll_clear'; $tn_done=1; } elsif($s eq echo_reply_nut2x_via_y) { if($y_done) { vLogHTML(ndErrmsg("ERROR: NUT doesn't recognize RA ". "(RouterLifetime=0)
")); goto error; } $pktdesc{ra_y2allnode_sll_clear}= 'Router Y send RA w/ RouterLifetime=0'; $p='ra_y2allnode_sll_clear'; $y_done=1; } elsif($s eq echo_reply_nut2x_via_z) { if($z_done) { vLogHTML(ndErrmsg("ERROR: NUT doesn't recognize RA ". "(RouterLifetime=0)
")); goto error; } $pktdesc{ra_z2allnode_sll_clear}= 'Router Z send RA w/ RouterLifetime=0'; $p='ra_z2allnode_sll_clear'; $z_done=1; } else { last; } $i++; } # # # clear(); # # # if($i < 2) { vLogHTML("*** NG ***
"); exit $V6evalTool::exitFail; } elsif($i == 2) { vLogHTML("*** OK ***
"); exit $V6evalTool::exitPass; } else { vLogHTML("Well done!! NUT retains more than two router addresses " . "in the Default Router List
"); vLogHTML("*** OK ***
"); exit $V6evalTool::exitPass; } error: clear(); vLogHTML(vErrmsg(%ret)."
"); vLogHTML(ndErrmsg("*** NG ***
")); exit $V6evalTool::exitFail; sub checkDefaultRouter($) { my($ra)=@_; if(! ($ra =~ /^\s*$/)) { vSend($IF, $ra); } $pktdesc{echo_request_x2nut_via_w}='Send off-link echo-requests'; %ret=vSend($IF, echo_request_x2nut_via_w); $pktdesc{echo_reply_nut2x_via_tn}= 'Got echo-reply thrown to Router TN'; $pktdesc{echo_reply_nut2x_via_y}= 'Got echo-reply thrown to Router Y'; $pktdesc{echo_reply_nut2x_via_z}= 'Got echo-reply thrown to Router Z'; $pktdesc{multicast_ns_nut2wsolnode}= 'Got multicast NS for neighbor discovery'; %ret=vRecv($IF, $wait_echo, $ret{sentTime1}, 1, echo_reply_nut2x_via_tn, echo_reply_nut2x_via_y, echo_reply_nut2x_via_z, multicast_ns_nut2wsolnode, ); if($ret{status} == 0) { return($ret{recvFrame}); } elsif($ret{status} == 1) { vLogHTML("Got nothing
"); return(''); } error: clear(); vLogHTML(vErrmsg(%ret)."
"); vLogHTML(ndErrmsg("*** NG ***
")); exit $V6evalTool::exitFail; } sub clear() { vLogHTML("
Termination
"); $pktdesc{ra_tn2allnode_sll_clear}= 'Clear Router TN form the Default Router List'; $pktdesc{ra_y2allnode_sll_clear}= 'Clear Router Y form the Default Router List'; $pktdesc{ra_z2allnode_sll_clear}= 'Clear Router Z form the Default Router List'; vSend($IF, ra_tn2allnode_sll_clear, ra_y2allnode_sll_clear, ra_z2allnode_sll_clear, ); } ######################################################################## __END__ =head1 NAME hostRecvRaRLifetime0 - Verifying that a host recognize RouterLifetime=0 =head1 TARGET Host only =head1 SYNOPSIS hostRecvRaRLifetime0.seq [-tooloption ...] -p hostRecvRaRLifetime0.def =head1 INITIALIZATION =begin html
  1. Create neighbor cache entries for NUT, Y, Z.
  2. Set their state to REACHABLEs.
  3. Give a global prefix, 3ffe:501:ffff:100::/64
  TN                 NUT
  ----------------------

State: NONCE (for all)
==== 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: STALE (for TN), NONCE (for Y, Z)
==== unsolicited RA ===> src=Y'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 TN, Y), NONCE (for Z)
==== unsolicited RA ===> src=Z'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 all)
<=== Ns for DAD ==== src=unspecified dst=solicited-node[NUT's global, prefix=3ffe:501:ffff:100::/64] target=NUT's global
Wait (3 sec)
==== 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 TN), STALE (for Y and Z) ==== solicited NA ===> src=Y's link-local dst=NUT's link-local R=1, S=1, O=1 target=Y's link-local TLLA=X's LLA
State: REACHABLE (for TN, Y), STALE (for Z) ==== solicited NA ===> src=Z's link-local dst=NUT's link-local R=1, S=1, O=1 target=Z's link-local TLLA=Z's LLA
State: REACHABLE (for all)
=end html =head1 TEST PROCEDURE =begin html
hostRecvRaRLifetime0 verifies that
  TN               NUT
  ----------------------

State: REACHABLE (for all)
==== echo-request ===> src=off-link global, but LLA is the W's one dst=NUT's global
<=== Judgment #4: echo-reply ==== src=NUT's global dst=off-link global, but LLA is one of the routers(TN, Y, Z)
==== unsolicited RA ===> src=TN's link-local dst=all-node M=0, O=0 RouterLifetime=0 ReachableTime=0 RetransTimer=0 w/ SLLA
==== echo-request ===> src=off-link global, but LLA is the W's one dst=NUT's global
<=== Judgment #5: echo-reply ==== src=NUT's global dst=off-link global, but LLA is one of the routers(Y, Z)
==== unsolicited RA ===> src=Y's link-local dst=all-node M=0, O=0 RouterLifetime=0 ReachableTime=0 RetransTimer=0 w/ SLLA
==== echo-request ===> src=off-link global, but LLA is the W's one dst=NUT's global
<=== Judgment #6: echo-reply ==== src=NUT's global dst=off-link global, but LLA is one of the routers(Z)
==== unsolicited RA ===> src=Z's link-local dst=all-node M=0, O=0 RouterLifetime=0 ReachableTime=0 RetransTimer=0 w/ SLLA
==== echo-request ===> src=off-link global, but LLA is the W's one dst=NUT's global
<=== Judgment #7: multicast NS (if any) ==== src=NUT's global dst=solicited-node[off-link global] w/ SLLA
=end html =head1 JUDGMENT =for html 1. If the address is already present in the host's Default Router List and the received Router Lifetime value is zero, immediately time-out the entry. =for html 2. Whenever the Lifetime of an entry in the Default Router List expires, that entry is discarded. When removing a router from the Default Router list, NUT must update the Destination Cache in such a way that all entries using the router perform next-hop determination again rather than continue sending traffic to the (deleted) router. =for html 3. NUT must retain at least two router addresses and should retain more. =for html 4. NUT must throw an echo-reply to the default router (NUT or Y or Z). =for html 5. NUT must throw an echo-reply to the default router (Y or Z). =for html 6. NUT must throw an echo-reply to the default router (i.e. Z). =for html 7. NUT must not throw an echo-reply to any routers. NUT may throw multicast NS for onlink determination. =head1 TERMINATION Send RAs to clear the Default Router List: - RA (src=TN) with RouterLifetime=0 - RA (src=Y) with RouterLifetime=0 - RA (src=Z) with RouterLifetime=0 =head1 NOTE The test does not invoke any remote command. =head1 SEE ALSO perldoc V6evalTool perldoc V6evalRemote =cut