#!/usr/bin/perl # # $Copyright$ # # $Id: hostRecvRedirect4OnlinkDC.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; $idx=0; $wait_dad=3; $wait_echo=2; $wait_mns=$nd::RETRANS_TIMER * $nd::MAX_MULTICAST_SOLICIT; $wait_uns=$nd::DELAY_FIRST_PROBE_TIME + ($nd::RETRANS_TIMER * $nd::MAX_UNICAST_SOLICIT); # # # @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("
*** $msg ***
"); $title{$idx}="$msgexp:accepted"; $s=chkRedirect($IF, $ptn); if($s eq "ACCEPTED") { $title{$idx}.="result:accepted"; $result{$idx}=$V6evalTool::exitPass; vLogHTML("OK
"); } else { $title{$idx}.="result:ignored"; $exit_rtn=$V6evalTool::exitFail; $result{$idx}=$V6evalTool::exitFail; vLogHTML("".ndErrmsg(NG)."
"); } $i++; $idx++; } # # # $i=0; foreach(@invalid_ra_ptn) { my($ptn)=$_; my($msg)=$invalid_ra_msg[$i]; vLogHTML("
*** $msg ***
"); $title{$idx}="$msgexp:ignored"; $s=chkRedirect($IF, $ptn); if($s eq "IGNORED") { $title{$idx}.="result:ignored"; $result{$idx}=$V6evalTool::exitPass; vLogHTML("OK
"); } else { $title{$idx}.="result:accepted"; $exit_rtn=$V6evalTool::exitFail; $result{$idx}=$V6evalTool::exitFail; vLogHTML("".ndErrmsg(NG)."
"); } $i++; $idx++; } $idx--; # # # vLogHTML("
Termination
"); clear(); # # # @col=('PTN', 'EXP', 'RESULT'); ndPrintSummaryHTML("*** Test Summary: Redirect to a host". " vs. Destination Cache ***", @col, %title, %result, $idx); # # # vLogHTML("*** EOT ***
"); exit $exit_rtn; error: vLogHTML("
Termination
"); clear(); vLogHTML(vErrmsg(%ret)."
"); exit $V6evalTool::exitFail; ######################################################################## sub chkRedirect($$) { my($if, $redirect)=@_; my(%ret, $s); # # # vLogHTML("
Initialization
"); # # # # goto error if ndClearPrefix() != 0; # goto error if ndClearDefr() != 0; clear(); vSleep(1); goto error if ndClearRoutes() != 0; goto error if nd2NoNce($if) != 0; # # # vLogHTML("Set R1 as the default router
"); $pktdesc{ra_rone2allnode_sll}= 'Router R1 sends RA, then NC[R1]=STALE'; $pktdesc{unicast_na_rone2nut_RSO_tll}= 'Router R1 sends, then NC[R1]=REACHABLE'; vSend($if, ra_rone2allnode_sll, unicast_na_rone2nut_RSO_tll, ); # # # vLogHTML("Wait for DAD
"); vRecv($if, $wait_dad, 0, 0); # # # vLogHTML("
Test
"); # # # vLogHTML("*** Verify that the default router works ***
"); $pktdesc{echo_request_a}= "Send echo-request that is forwarded from the default router (R1)"; %ret=vSend($if, echo_request_a); $pktdesc{echo_reply_a}= 'Got echo-reply that was thrown to the default router (R1)'; %ret=vRecv($if, $wait_echo, $ret{sentTime1}, 0, echo_reply_a); goto error if $ret{status} != 0; # # # vLogHTML("*** Verify that redirect works ***
"); $pktdesc{$redirect}="Send redirect to the second router (TN)"; %ret=vSend($if, $redirect); # # # $pktdesc{echo_request_b}= "Send echo-request that is forwarded from the default router (R1)"; %ret=vSend($if, echo_request_b); $pktdesc{echo_reply_b}= 'Got echo-reply that was thrown to the default router (R1)'; $pktdesc{echo_reply_b_onlink}= 'Got echo-reply whose destination is on-link'; $pktdesc{multicast_ns_nut2tn}= 'Got multicast NS for on-link determination'; $pktdesc{multicast_ns_nut2tn_sll}= 'Got multicast NS for on-link determination'; %ret=vRecv($if, $wait_echo, $ret{sentTime1}, 0, echo_reply_b, echo_reply_b_onlink, multicast_ns_nut2tn, multicast_ns_nut2tn_sll, ); goto error if $ret{status} != 0; # # # if($ret{recvFrame} eq echo_reply_b) { vLogHTML("The redirect message was ignored
"); $s="IGNORED"; } elsif($ret{recvFrame} eq echo_reply_b_onlink) { vLogHTML("The redirect message was accepted
"); $s="ACCEPTED"; vRecv($if, $wait_uns, 0, 0); } elsif($ret{recvFrame} eq multicast_ns_nut2tn || $ret{recvFrame} eq multicast_ns_nut2tn_sll) { vLogHTML("The redirect message was accepted
"); vRecv($if, $wait_mns, 0, 0); $s="ACCEPTED"; } else { vLogHTML(ndErrmsg("ERROR: Got unexpected packet
")); goto error; } return $s; error: vLogHTML(vErrmsg(%ret)."
"); return ERROR; } sub clear() { $pktdesc{ra_rone2allnode_clrrtr}="Clear the Default Router List"; vSend($IF, ra_rone2allnode_clrrtr); } ######################################################################## __END__ =head1 NAME hostRecvRedirect4OnlinkDC - Verifying Redirect (to a better router) vs. Destination Cache =head1 TARGET Host only =head1 SYNOPSIS hostRecvRedirect4OnlinkDC.seq [-tooloption ...] -p hostRecvRedirect4OnlinkDC.def =head1 INITIALIZATION =begin html
  1. Clear IPv6 routes.
  2. Send RA with RouterLifetime=0 to clear the Default Router List.
  3. Set R1 as the default router by sending RA and NA.

  TN                 NUT
  ----------------------

State: NONCE (for R1)
==== unsolicited RA ===> src=R1'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)
==== 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)
Wait (3 sec) for DAD NS
=end html =head1 TEST PROCEDURE B verifies that a redirect message (ICMP Destination == ICMP Target) updates a Destination Cache entry. =begin html
  1. Send echo-request (src:H1, dst:NUT)
  2. Verify that NUT send echo-reply to the default router, R1
  3. Send redirect message to NUT.
  4. Send echo-request (src:H1, dst:NUT) again.
  5. Verify echo-reply that NUT throw:
    1. If the redirect message is ether valid or suspicious:
      1. If the redirect message has TLLA option:
        NUT must send echo-reply to the better router TN.
      2. If the redirect message has no TLLA option:
        NUT must send multicast NS for LLA resolution.
    2. If the redirect message is invalid:
      NUT must send echo-reply to the default router R1
  TN               NUT
  ----------------------

State: REACHABLE (for R1), NONCE (for H1)
==== 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
State: REACHABLE (for R1), NONCE/STALE (for H1)
==== 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: Expected packet that NUT should throw is depend on the redirect message that NUT has received: Valid redirect message OR Suspicious redirect message OR Invalid redirect message
=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 |H1 |NS (R1) |(NUT) |(H1) |(H1) | | | | | src=NUT's global | | | | | | | | dst=solicited[H1] | | | | | | | | target=H1's global | | | | | | | | w/ or w/o SLLA ----------+----------+----------+------+-----+----------+-------+-----+----------------------- - |- |- |- |none |exist |R1 |H1 |NS | | | | | | | | src=NUT's global | | | | | | | | dst=solicited[H1] | | | | | | | | target=H1's global | | | | | | | | w/ or w/o SLLA ----------+----------+----------+------+-----+----------+-------+-----+----------------------- - |- |- |- |exist|none |R1 |H1 |echo-reply | | | | | | | | src=NUT's global | | | | | | | | dst=H1's global ----------+----------+----------+------+-----+----------+-------+-----+----------------------- - |- |- |- |exist|exist |R1 |H1 |echo-reply | | | | | | | | src=NUT's global | | | | | | | | dst=H1's global ----------+----------+----------+------+-----+----------+-------+-----+----------------------- - |global |- |- |none |none |R1 |H1 |NS |(NUT) | | | | | | | src=NUT's global | | | | | | | | dst=solicited[H1] | | | | | | | | target=H1's global | | | | | | | | w/ or w/o SLLA ----------+----------+----------+------+-----+----------+-------+-----+----------------------- - |- |- |- |none |exist |R1 |H1 |NS | | | | | | | | src=NUT's global | | | | | | | | dst=solicited[H1] | | | | | | | | target=H1's global | | | | | | | | w/ or w/o SLLA ----------+----------+----------+------+-----+----------+-------+-----+----------------------- - |- |- |- |exist|none |R1 |H1 |echo-reply | | | | | | | | src=NUT's global | | | | | | | | dst=H1's global ----------+----------+----------+------+-----+----------+-------+-----+----------------------- - |- |- |- |exist|exist |R1 |H1 |echo-reply | | | | | | | | src=NUT's global | | | | | | | | dst=H1's global ==========+==========+==========+======+=====+==========+=======+=====+======================= -: 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 |H1 |echo-reply (R1) |(NUT) |(H1) |(H1) | |> 1280 and| | | src=NUT's global | | | | |bogus | | | dst=H1's global | | | | |*susp. | | | ----------+----------+----------+------+-----+----------+------+-----+------------------- - |all-node |- |- |exist|exist |R1 |H1 |echo-reply |*susp. | | | | | | | src=NUT's global | | | | | | | | dst=H1's global ==========+==========+==========+======+=====+==========+======+=====+=================== -: same as above =for html 4. Invalid redirect messages vs. Destination Cache ==============================================================+============+======================= Invalid redirect message that NUT receive |Destination | ---------------------+----------------------------------------+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) | | | |(H1) |(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 RA with RouterLifetime=0 to clear the Default Router List. Clear IPv6 routes by remote command. XXX =head1 NOTE The test invokes the following command: - Clear the IPv6 routes =head1 SEE ALSO perldoc V6evalTool perldoc V6evalRemote =cut