#!/usr/bin/perl # # Copyright (C) 2002, 2003, 2004, 2005 Yokogawa Electric Corporation, # INTAP(Interoperability Technology Association for Information # Processing, Japan), 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. # $TINY: LLA_DAD_NSPreDAD_SrcUni.seq,v 1.6 2002/03/05 03:04:56 masaxmasa Exp $ # ######################################################################## BEGIN { $V6evalTool::TestVersion = '$Name: REL_2_1_2 $ '; } use V6evalTool; use SAA; #------------------------------------------------------ #----- get sequence arguments #------------------------------------------------------ $howto_initNUT="none"; $send = "ok"; foreach (@ARGV) { # How to configure address of NUT? # sample: boot, ra, manual+_GLOBAL0A0N_UCAST /^addrconf=(\S+)/ && do {$SAA::howto_addrconf=$1; next; }; # How to initialize NUT? # sample: none, DADSuccess_boot, DADFail_boot /^init=(\S+)/ && do {$howto_initNUT=$1; next; }; # "none" if send no pakcet to NUT in state DADPostSendNS # sample: ok, none /^send=(\S+)/ && do {$send=$1; next; }; # sequence debug options # sample: qR /^sd=(\S+)/ && do {$seqdebugopt=$1; next; }; seqERROR("Unknown sequence option '$_'"); } #------------------------------------------------------ #----- test condition $IF=Link0; # network interface $max_retry_count = 10; # retry if NUT state becomes DADPostSendNS $max_retry_count = 2 if $SAA::sd =~ /q/; # quick retry $send_interval = 0.1; # 1[sec] time between DAD NS and DAD NS, send to NUT # (RandomDelay is 0-1sec e.g. default RetransTimer 1000msec) $loopcnt=0; $recvna=0; $recvdadns=0; ########################################################## #----- Check Target Type $type=$V6evalTool::NutDef{Type}; if($type eq host) { vCPP('-DRFLAG=0'); } if($type eq router) { vCPP('-DRFLAG=1'); } #----- start Capturing vCapture($IF); #----- Store Start time $t0 = time(); #manual address configuration or reboot start time #----- send DAD NS to NUT with interval_time for a couple of minits #----- or wait until receiving a DAD NS from NUT in every interval. vLog("TN transmits DAD NS($SAA::dadpkt_to_NUT) with unicast source address"); vLog(" than NUT and wait for $send_interval [sec],"); vLog(" TN expects to receive DAD NS or NA($SAA::dadns_from_NUT, $SAA::chkconf_dadna_from_NUT) from NUT for $send_interval [sec],"); vLog(" NUT MUST not detect the address duplication with such packets."); vLog(" Try this process for $SAA::wait_dadns{$SAA::howto_addrconf} [sec]."); # sleep $send_interval; #random wait 0.0-1.0sec do { if ($loopcnt == 0){ #----- initialize NUT vLog("*** Target initialization phase ***"); $rret=vRemote("reboot_async.rmt","","timeout=$SAA::wait_rebootcmd"); vLog("reboot_async.rmt returned status $rret"); # Just send trigger to reboot. vLog("*** Target testing phase ***"); } #--- Send NS vLog("Send DAD NS to other Target: SOLNS_from_TN_SameTgt"); %ret=vSend($IF, SOLNS_from_TN_SameTgt); seqERROR(vErrmsg(%ret)) if $ret{status} != 0 ; if ($loopcnt == 0){ $firstDADnsTime=$ret{sentTime1}; } #--- Wait NS or NA vLog("Waiting for DAD NS or NA: DADNS_from_NUT or NA_from_NUT"); %ret=vRecv($IF,$send_interval,0,0,DADNS_from_NUT,NA_from_NUT); if ($ret{status} == 0 && $ret{recvTime1} > $firstDADnsTime) { if ($ret{recvFrame} eq NA_from_NUT) { $recvna=1; }else{ vLog("Received packet count=$ret{recvCount}"); $recvdadns=1; } } $td = $SAA::wait_dadns{$SAA::howto_addrconf} - (time()-$t0); $td = 0 if $td < 0; vLog("countdown timer: $td [sec]"); $loopcnt++; } while($recvdadns == 0 && $td > 0 ); ################## if ($recvdadns == 1){ #----- if received DAD NS vLog("NUT sent DAD NS"); if($recvna == 1){ vLog("But, NUT transmitted NA for non-DAD NS before transmitting DAD NS."); seqNG(); } #----- check if NUT's address is configured vLog("Confirming that NUT had assigned the address....."); vSleep($SAA::RetransTimerSec); if (seqCheckNUTAddrConfigured($IF) eq TRUE) { vLog("OK! NUT assigned the address to the interface."); if ($SAA::DupAddrDetectTransmits == 0) { vLog("But DupAddrDetectTransmits == 0"); seqNG(); }else{ seqOK(); } }else{ vLog("NG! NUT had not assigned the address to the interface."); seqNG(); } } elsif ( $recvna == 1 ){ vLog("TN received the NA, NUT's DAD state changed to DADfinish ..."); vLog("NUT seems not to be able to perform DAD."); #----- check if NUT's address is configured vLog("Confirming that NUT had assigned the address....."); if (seqCheckNUTAddrConfigured($IF) eq TRUE) { vLog("NUT assigned the address to the interface."); if ($SAA::DupAddrDetectTransmits == 0) { seqOK(); }else{ vLog("But DupAddrDetectTransmits == $SAA::DupAddrDetectTransmits"); seqNG(); } }else{ vLog("NG! NUT had not assigned the address to the interface."); seqNG(); } seqNG(); } else { #----- if timeout or could not receive DAD NS nor NA vLog("Although $SAA::wait_dadns{$SAA::howto_addrconf}\[sec] has past since NUT's address configured, no DAD NS came from NUT."); vLog("It seems that NUT has misunderstood to detect address duplication in state DADPreSendNS."); seqNG(); } #end ######################################################################## __END__ =head1 NAME LLA_DAD_NSPreDAD_SrcUni - check the process when NUT receives NS for address resolution(Src=Unicast) before transmitting DAD NS. =head1 TARGET All Node =head1 SYNOPSIS LLA_DAD_NSPreDAD_SrcUni.seq [-tooloption ...] -pkt [addrconf=] -tooloption : v6eval tool option : packet definition file (v6eval tool option) : how to configure address on NUT; boot/reboot =begin html
 detail of v6eval tool option: see perldoc V6evalTool.pm, perldoc V6evalRemote.pm
=end html =head1 INITIALIZATION =begin html
 Reboot NUT or Initialize interface of NUT or Initialize IPv6 stack of NUT.
=end html =head1 TEST PROCEDURE =over 1 =item Test for Unicast address configuration The following tests are prepared in this test package. See INDEX file. B NUT performs DAD for its Link-local unicast address made by stateless address autoconfiguration, though NUT receives NS which contains unicast as source address before transimitting DAD NS. B TN NUT --------------------------------- Initialize NUT Configure address of NUT (reboot or interface initialization etc...) ==== Action #1: NS =============> ==== #1: NS =============> : : ==== #1: NS =============> name: SOLNS_from_TN_SameTgt TN wait the DAD NS sent from NUT <=== Judgement #1: DAD NS ======= name: DADNS_from_NUT Wait for DupAddrDetectTransmits*RetransTimer Check if NUT's address is configured ==== Action #2: SOL NS =========> name: SOLNS_from_TN_SameTgt <=== Judgement #2: SOL NA ======= name: NA_from_NUT, NA_from_NUT_woTLL =back 1 =head1 JUDGEMENT =over 1 =item Test for Link-local Unicast address autoconfiguration B B Action #1. TN transmits NS which contains unicast as source address for NUT's tentative Link-local address name: SOLNS_from_TN_SameTgt src: TN's Link-local dst: solnode[NUT's tentative Link-local] TargetAddress: TN's Link-local Judgement #1. NUT MUST transmit DAD NS for its autoconfigured Link-local address. name: DADNS_from_NUT src: ::0 dst: solnode[NUT's tentative Link-local] TargetAddress: NUT's tentative Link-local Action #2. TN transmits SOL NS to check if NUT's address is configured name: SOLNS_from_TN_SameTgt src: TN's Link-local dst: solnode[NUT's Link-local] TargetAddress: NUT's Link-local Judgement #2. NUT MUST transmit SOL NA for its autoconfigured Link-local address. name: NA_from_NUT, NA_from_NUT_woTLL src: NUT's Link-local dst: TN's Link-local TargetAddress: NUT's Link-local RFlag: 0 ( if NUT is a Router then 1) SFlag: 1 OFlag: 1 TLLOPT: NUT's MAC address =back 1 =head1 REFERENCE =begin html
RFC2462


(omit) 5.4.2. Sending Neighbor Solicitation Messages
Before sending a Neighbor Solicitation, an interface MUST join the all-nodes multicast address and the solicited-node multicast address of the tentative address. The former insures that the node receives Neighbor Advertisements from other nodes already using the address; the latter insures that two nodes attempting to use the same address simultaneously detect each other's presence.
To check an address, a node sends DupAddrDetectTransmits Neighbor Solicitations, each separated by RetransTimer milliseconds. The solicitation's Target Address is set to the address being checked, the IP source is set to the unspecified address and the IP destination is set to the solicited-node multicast address of the target address.
If the Neighbor Solicitation is the first message to be sent from an interface after interface (re)initialization, the node should delay sending the message by a random delay between 0 and MAX_RTR_SOLICITATION_DELAY as specified in [DISCOVERY]. This serves to alleviate congestion when many nodes start up on the link at the same time, such as after a power failure, and may help to avoid race conditions when more than one node is trying to solicit for the same address at the same time. In order to improve the robustness of the Duplicate Address Detection algorithm, an interface MUST receive and process datagrams sent to the all-nodes multicast address or solicited-node multicast address of the tentative address while delaying transmission of the initial Neighbor Solicitation.
5.4.3. Receiving Neighbor Solicitation Messages
On receipt of a valid Neighbor Solicitation message on an interface, node behavior depends on whether the target address is tentative or not. If the target address is not tentative (i.e., it is assigned to the receiving interface), the solicitation is processed as described in [DISCOVERY]. If the target address is tentative, and the source address is a unicast address, the solicitation's sender is performing address resolution on the target; the solicitation should be silently ignored. Otherwise, processing takes place as described below. In all cases, a node MUST NOT respond to a Neighbor Solicitation for a tentative address.
(omit)
=end html =head1 SEE ALSO =begin html
 detail of v6eval tool option: see perldoc V6evalTool.pm, perldoc V6evalRemote.pm
=end html =cut