#!/usr/bin/perl # # $Copyright$ # # $Id: hostRecvRaRFlag.seq,v 1.1.1.1 2000/10/31 22:38:59 sekiya Exp $ ######################################################################## BEGIN { $V6evalTool::TestVersion = '$Name: $ '; } use V6evalTool; use nd; 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; $wait_dad=3; $wait_echo=2; $wait_expire=10; $wait_probe=$nd::DELAY_FIRST_PROBE_TIME + 1; $wait_ns=$nd::RETRANS_TIMER * $nd::MAX_UNICAST_SOLICIT + 1; %pktdesc=( ra_tn2allnode => 'Send RA w/o SLL to set the IsRouter flag', ra_tn2allnode_sll => 'Send RA w/ SLL to set the IsRouter flag', ); @ra_title=( "w/o SLL", "w/ SLL, same LLA as cached", "RA w/ SLL, different LLA than cached", ); @ra_ptn=( ra_tn2allnode, ra_tn2allnode_sll, ra_tn2allnode_sll, ); @ra_same_lla=( 1, 1, 0, ); # # # $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); # # # #goto error if ndClearPrefix() != 0; #goto error if ndClearDefr() != 0; # # # $idx=0; foreach(@ra_ptn) { vLogHTML("
"); vLogHTML("*** @ra_title[$idx] ***
"); $title{$idx}="$ra_title[$idx]"; if(checkRFlag($_, $ra_same_lla[$idx]) == 0) { $title{$idx}.="exp:updatedresult:updated"; $result{$idx}=$V6evalTool::exitPass; vLogHTML("OK
"); } else { $title{$idx}.="ex:updatedresult:unchanged"; $result{$idx}=$V6evalTool::exitFail; $exit_rtn=$V6evalTool::exitFail; vLogHTML("".ndErrmsg(NG)."
"); } $idx++; } $idx--; # # # clear(); # # # @col=('PTN', 'EXP', 'RESULT'); ndPrintSummaryHTML("*** Test Summary: Does RA set IsRouter flag ? ***", @col, %title, %result, $idx); # # # vLogHTML("*** EOT ***
"); exit $exit_rtn; error: clear(); exit $V6evalTool::exitFail; # # # sub checkRFlag($$) { my($ra, $same_lla)=@_; my($rtn); # goto error if ndClearPrefix() != 0; # goto error if ndClearDefr() != 0; clear(); vLogHTML("
Initialization
"); if($same_lla) { goto error if nd2Reachable($IF) != 0; } else { goto error if nd2ReachableZ($IF) != 0; } vClear($IF); $pktdesc{ra_x2allnode_sll}= 'Send RA (X ==>all-nodes) to be in STALE state'; vSend($IF, ra_x2allnode_sll); $pktdesc{unicast_na_x2nut_RSO_tll}= 'Send NA (X ==> NUT) to be in REACHABLE state'; vSend($IF, unicast_na_x2nut_RSO_tll); vLogHTML("Wait fro DAD NS
"); vRecv($IF, $wait_echo, 0, 0); $pktdesc{offlink_echo_request_x2nut}= 'Forward off-link echo-request (X ==> NUT)'; %ret=vSend($IF, offlink_echo_request_x2nut); $pktdesc{offlink_echo_reply_nut2x}= 'Got off-link echo-reply (NUT ==> X)'; %ret=vRecv($IF, $wait_echo, $ret{sentTime1}, 1, offlink_echo_reply_nut2x); goto error if $ret{status} != 0; vLogHTML("
Test
"); %ret=vSend($IF, $ra); goto error if $ret{status} != 0; vSleep($wait_expire); vLogHTML("The router lifetime of X was expired
"); $pktdesc{offlink_echo_request_tn2nut}= 'Forward off-link echo-request (TN ==> NUT)'; %ret=vSend($IF, offlink_echo_request_tn2nut); $pktdesc{offlink_echo_reply_nut2tn}='Got off-link echo-reply (NUT ==> TN)'; %ret=vRecv($IF, $wait_echo, $ret{sentTime1}, 1, offlink_echo_reply_nut2tn); if($ret{status} == 0) { vLogHTML("The IsRouter flag of TN is TURE
"); $rtn=0; } else { vLogHTML("Never got off-link echo-reply (NUT ==> TN)
"); vLogHTML("The IsRouter flag of TN is FALSE
"); $rtn=1; } if($same_lla == 0) { vLogHTML("Wait for unicast NS if any
"); vRecv($IF, $wait_probe+$wait_ns, 0, 0); } return $rtn; error: clear(); vLogHTML(vErrmsg(%ret)."
"); exit $V6evalTool::exitFail; } # # sub clear() { vLogHTML("
Termination
"); $pktdesc{ra_x2allnode_clrrtr}= 'Clear Router X from the Default Router list'; $pktdesc{ra_tn2allnode_clrrtr}= 'Clear Router TN from the Default Router list'; vSend($IF, ra_x2allnode_clrrtr, ra_tn2allnode_clrrtr, ); } ######################################################################## __END__ =head1 NAME hostRecvRaRFlag - Verifying that a RA sets a IsRouter flag true =head1 TARGET Host only =head1 SYNOPSIS hostRecvRaRFlag.seq [-tooloption ...] -p hostRecvRaRFlag.def =head1 INITIALIZATION =begin html
  1. Create an neighbor cache entry for TN where a IsRouter flag is FALSE.
  2. Set its state to REACHABLE.
  3. Cache either TN's LLA or a bogus LLA.
=end html =head2 Cache a LLA of TN =begin html
  TN                 NUT
  ----------------------
  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 SLLA=NUT's LLA timeout: RETRANS_TIMER * MAX_MULTICAST_SOLICIT
==== solicited NA ===> src:TN's link dst:NUT's link-local R=0, S=1, O=1 target=TN's link-local TLLA=TN's LLA
State: REACHABLE (for TN)
=end html =head2 Cache a bogus LLA =begin html
  TN                 NUT
  ----------------------
  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 SLLA=NUT's LLA timeout: RETRANS_TIMER * MAX_MULTICAST_SOLICIT
==== solicited NA ===> src:TN's link dst:NUT's link-local R=0, S=1, O=1 target=TN's link-local TLLA=a bogus LLA (0:0:0:0:a9:a9)
State: REACHABLE (for TN)
=end html =head1 TEST PROCEDURE B verifies that a RA sets a IsRouter flag true. =begin html
  TN                 NUT
  ----------------------

State: REACHABLE (for TN), NONCE(for X)
==== unsolicited RA ===> src=X's link-local dst=all-node M=0, O=0 RouterLifetime=10 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 TN), STALE(for X)
==== solicited NA ===> src:X's link dst:NUT's link-local R=1, S=1, O=1 target=X's link-local w/ TLLA
Wati for 2 sec to ignore DAD NS
State: REACHABLE (for TN, X)
==== echo-request ===> src=off-link global, but LLA is X's one dst=NUT's global
<=== Judgment #1: echo-reply ==== src=NUT's global dst=off-link global, but LLA is X's one
==== unsolicited RA ===> src=TN's link-local dst=all-node M=0, O=0 RouterLifetime=600 ReachableTime=0 RetransTimer=0 w/ or w/o SLLA Prefix Option: L=1, A=1 ValidLifetime=2592000 PreferredLifetime=604800 Prefix=3ffe:501:ffff:100::/64
State: REACHABLE/STALE (for TN), REACHABLE (for X)
Wait (10 sec) for X's router lifetime to be expired
==== echo-request ===> src=off-link global, but LLA is TN's one dst=NUT's global
<=== Judgment #3: echo-reply ==== src=NUT's global dst=off-link global, but LLA is TN's one
State: REACHABLE/DELAY (for TN), REACHABLE (for X)
=end html =head1 JUDGMENT =begin html
  1. NUT throw an echo-reply to the default router (i.e. X).

2. RA set IsRouter flag.
6.3.4. Processing Received Router Advertisements
After extracting information from the fixed part of the Router Advertisement message, the advertisement is scanned for valid options. If the advertisement contains a Source Link-Layer Address option the link-layer address SHOULD be recorded in the Neighbor Cache entry for the router (creating an entry if necessary) and the IsRouter flag in the Neighbor Cache entry MUST be set to TRUE. If no Source Link-Layer Address is included, but a corresponding Neighbor Cache entry exists, its IsRouter flag MUST be set to TRUE. The IsRouter flag is used by Neighbor Unreachability Detection to determine when a router changes to being a host (i.e., no longer capable of forwarding packets). If a Neighbor Cache entry is created for the router its reachability state MUST be set to STALE as specified in Section 7.3.3. If a cache entry already exists and is updated with a different link-layer address the reachability state MUST also be set to STALE.
============+===========+=============================== RA received by tne NUT | NUT's Neighbor Cache State ------------+-----------+---------+--------------------- Destination | SLLA | Current | New ============+===========+=========+===================== all-node | none | 0 | 1 ------------+-----------+---------+--------------------- all-node | same | 0 | 1 ------------+-----------+---------+--------------------- all-node | different | 0 | 1 ============+===========+=========+=====================
3. NUT throw an echo-reply to NUT instead of X.
=end html =head1 TERMINATION Send the following RAs to clear the Default Router List: - RA (src: TN) with RouterLifetime=0 - RA (src: X) with RouterLifetime=0 =head1 NOTE The test does not invoke any remote command. =head1 SEE ALSO perldoc V6evalTool perldoc V6evalRemote =cut