#!/usr/bin/perl # # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 # Yokogawa Electric Corporation. # 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. # # 5. The copyrighters, the project and the contributors may prohibit # the use of this software at any time. # # 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: RA_GA_Success.seq,v 1.14 2002/03/05 17:13:55 miyata Exp $ # ######################################################################## BEGIN { $V6evalTool::TestVersion = '$Name: V6LC_4_0_5 $ '; } use V6evalTool; use SAA; #------------------------------------------------------ #----- get sequence arguments #------------------------------------------------------ $howto_initNUT="none"; $send = "ok"; $DAD_GA=$SAA::DADTransmitsGA; $DAD_GA =~ tr/a-z/A-Z/ ; 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 = 1; # 1[sec] time between DAD NS and DAD NS, send to NUT # (RandomDelay is 0-1sec e.g. default RetransTimer 1000msec) $recvVLT=40; #30 ########################################################## $type=$V6evalTool::NutDef{Type}; if($type eq host) { vCPP('-DRFLAG=0'); } if($type eq router) { vCPP('-DRFLAG=1'); } if($type eq special) { vCPP('-DRFLAG=any'); } if($V6evalTool::NutDef{'Type'} ne 'host') { $TargetAddress = 'Frame_Ether.Packet_IPv6.ICMPv6_NS.TargetAddress'; %ret0 = vSend($IF, 'dummy'); unless(defined($ret0{$TargetAddress})) { vLogHTML('Can\'t get TargetAddress.
'); seqNG(); } } #----- initialize NUT vLog("*** Target initialization phase ***"); if($V6evalTool::NutDef{System} ne "manual"){ vSleep($SAA::test_interval); } $rret=vRemote("reboot_async.rmt","","timeout=$SAA::wait_rebootcmd"); vLog("reboot_async.rmt returned status $rret"); #----- start Capturing vLog("*** Target testing phase ***"); vCapture($IF); #----- LLA PHASE #----- Wait DAD NS from NUT or timeout vLog("TN wait DAD NS(DADNS_from_NUT) from NUT for $SAA::wait_dadns{$SAA::howto_addrconf} [sec],"); my @frames = ('DADNS_from_NUT'); # link-local DAD NS if($V6evalTool::NutDef{'Type'} ne 'host') { push(@frames, 'DADNS_from_NUT_GA0Tgt'); # global DAD NS } # host: # - DADNS_from_NUT # router/special: # - DADNS_from_NUT # - DADNS_from_NUT_GA0Tgt %ret1 = vRecv($IF, $SAA::wait_dadns{$SAA::howto_addrconf}, 0, 0, @frames); if($ret1{'recvFrame'} eq 'DADNS_from_NUT') { vLog("TN received DAD NS from NUT."); vLog("OK! Let's go ahead!"); if($V6evalTool::NutDef{'Type'} ne 'router') { vSleep($SAA::wait_addrconf); vClear($IF); vSend($IF, RA_GA0_VLT40); } else { if(vRemote( 'manualaddrconf.rmt', "if=$V6evalTool::NutDef{'Link0_device'}", "addr=$ret0{$TargetAddress}", 'len=64', 'type=unicast' )) { vLogHTML(''. 'manualaddrconf.rmt: Could\'t set the address'. '
'); seqNG(); } } vLog("TN wait DAD NS for Global address from NUT for $SAA::wait_dadns{ra} [sec],"); %ret1 = vRecv($IF, $SAA::wait_dadns{ra}, 0, 0, 'DADNS_from_NUT_GA0Tgt'); } if($ret1{'recvFrame'} ne 'DADNS_from_NUT_GA0Tgt') { vLog("NUT had not transmitted DAD NS for Global address."); seqNG(); } #----- check if NUT's address is configured vLog("NUT had transmitted DAD NS for its Global address."); vSleep($SAA::wait_addrconf_with_RA); if(seqCheckNUTAddrConfiguredGADAD($IF, DADNS_from_TN_GA0Tgt, DADNA_from_NUT_GA0Tgt, DADNA_from_NUT_GA0Tgt_woTLL, DADNA_from_GA0NUT_GA0Tgt, DADNA_from_GA0NUT_GA0Tgt_woTLL) eq TRUE) { vLog("NUT assigned Global address to the interface."); if ($DAD_GA eq "NO") { vLog("NUT transmit DAD NS though DADTransmitsGA == 0"); seqNG(); }else{ seqOK(); } } vLog(" NUT had not assign Global address."); seqNG(); ######################################################################## __END__ =head1 NAME v6LC_3_2_1_C - Unicast Autoconfigured Address - Site-Local =head1 TARGET All Node =head1 SYNOPSIS v6LC_3_2_1_C.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 Verify taht a node performs DAD on its autoconfigured unicast address. =over 1 =item Test for Unicast address configuration The following tests are prepared in this test package. See INDEX file. B When NUT receives RA which contains Prefix (FEC0::), NUT assignes autoconfigured address. NUT must perform DAD for its address prior to assigning it. B TN NUT --------------------------------- Initialize NUT Configure address of NUT (reboot or interface initialization etc...) TN wait the DAD NS sent from NUT <=== Judgement #1: DAD NS ======= name: DADNS_from_NUT <=== Judgement #2: RS =========== name: RS_from_NUT, RS_from_NUT_wSLL ==== Action #1: RA =============> name: RA_GA0 (If NUT is a Router, configure a address) (Prefix : FEC0::) <=== Judgement #3: DAD NS ======= name: DADNS_from_NUT_GA0Tgt Wait for 5+DupAddrDetectTransmits*(RetransTimer/1000)[sec] Check if NUT's address is configured ==== Action #2: DAD NS =========> name: DADNS_from_TN_GA0Tgt <=== Judgement #4: DAD NA ======= name: DADNA_from_NUT_GA0Tgt, DADNA_from_NUT_GA0Tgt_woTLL, DADNA_from_GA0NUT_GA0Tgt, DADNA_from_GA0NUT_GA0Tgt_woTLL =back 1 =head1 JUDGEMENT =over 1 =item Test for Global Unicast address autoconfiguration B B 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 Judgement #2. NUT SHOULD transmit RS. name: RS_from_NUT src: NUT's Link-local dst: allrouter Action #1. TN transmits RA which contains Global Prefix. name: RA_GA0 src: TN's Link-local dst: allnode PXOPT: Global0 (Prefix : FEC0::) Judgement #3. NUT MUST transmit DAD NS for its autoconfigured Global address. (* If the address is consisits of EUI64, as same as Link-local address, This DAD MAY be omitted.) name: DADNS_from_NUT_GA0Tgt src: ::0 dst: solnode[NUT's tentative Global0] TargetAddress: NUT's tentative Global0 Action #2. TN transmits DAD NS to check if NUT's address is configured. name: DADNS_from_TN_GA0Tgt src: ::0 dst: solnode[NUT's Global0] TargetAddress: NUT's Global0 Judgement #4. NUT MUST transmit DAD NA for its autoconfigured Global address. name: DADNA_from_NUT_GA0Tgt, DADNA_from_NUT_GA0Tgt_woTLL src: NUT's Link-local dst: allnode TargetAddress: NUT's Global0 RFlag: 0 SFlag: 0 OFlag: 1 TLLOPT: NUT's MAC address (* TLLOPT may be omitted) =back 1 =head1 CLEANUP NONE =cut # =head1 REFERENCE # # =begin html #
# RFC2462
# 
# (omit) #
# 5.5. Creation of Global and Site-Local Addresses #
# Global and site-local addresses are formed by appending an interface # identifier to a prefix of appropriate length. Prefixes are obtained # from Prefix Information options contained in Router Advertisements. # Creation of global and site-local addresses and configuration of # other parameters as described in this section SHOULD be locally # configurable. However, the processing described below MUST be enabled # by default. #
# (omit) #
# 5.5.3. Router Advertisement Processing #
# (omit) #
# For each Prefix-Information option in the Router Advertisement: #
# a) If the Autonomous flag is not set, silently ignore the # Prefix Information # option. #
# b) If the prefix is the link-local prefix, silently ignore the # Prefix Information option. #
# c) If the preferred lifetime is greater than the valid lifetime, # silently ignore the Prefix Information option. A node MAY wish to # log a system management error in this case. #
# d) If the prefix advertised does not match the prefix of an address # already in the list, and the Valid Lifetime is not 0, form an # address (and add it to the list) by combining the advertised # prefix with the link's interface identifier as follows: #
# | 128 - N bits | N bits | # +---------------------------------------+------------------------+ # | link prefix | interface identifier | # +----------------------------------------------------------------+ #
#
# If the sum of the prefix length and interface identifier length # does not equal 128 bits, the Prefix Information option MUST be # ignored. An implementation MAY wish to log a system management # error in this case. It is the responsibility of the system # administrator to insure that the lengths of prefixes contained in # Router Advertisements are consistent with the length of interface # identifiers for that link type. Note that interface identifiers # will typically be 64-bits long and based on EUI-64 identifiers as # described in [ADDR-ARCH]. #
# If an address is formed successfully, the host adds it to the # list of addresses assigned to the interface, initializing its # preferred and valid lifetime values from the Prefix Information # option. #
# (omit) #
# 5.5.4. Address Lifetime Expiry #
# A preferred address becomes deprecated when its preferred lifetime # expires. A deprecated address SHOULD continue to be used as a source # address in existing communications, but SHOULD NOT be used in new # communications if an alternate (non-deprecated) address is available # and has sufficient scope. IP and higher layers (e.g., TCP, UDP) MUST # continue to accept datagrams destined to a deprecated address since a # deprecated address is still a valid address for the interface. An # implementation MAY prevent any new communication from using a # deprecated address, but system management MUST have the ability to # disable such a facility, and the facility MUST be disabled by # default. #
# An address (and its association with an interface) becomes invalid # when its valid lifetime expires. An invalid address MUST NOT be used # as a source address in outgoing communications and MUST NOT be # recognized as a destination on a receiving interface. #
# RFC2461 #
#
# (omit) #
# 7.2.4. Sending Solicited Neighbor Advertisements #
# A node sends a Neighbor Advertisement in response to a valid Neighbor # Solicitation targeting one of the node's assigned addresses. The # Target Address of the advertisement is copied from the Target Address # of the solicitation. If the solicitation's IP Destination Address is # not a multicast address, the Target Link-Layer Address option MAY be # omitted; the neighboring node's cached value must already be current # in order for the solicitation to have been received. If the # solicitation's IP Destination Address is a multicast address, the # Target Link-Layer option MUST be included in the advertisement. # Furthermore, if the node is a router, it MUST set the Router flag to # one; otherwise it MUST set the flag to zero. #
# If the Target Address is either an anycast address or a unicast # address for which the node is providing proxy service, or the Target # Link-Layer Address option is not included, the Override flag SHOULD # be set to zero. Otherwise, the Override flag SHOULD be set to one. # Proper setting of the Override flag ensures that nodes give # preference to non-proxy advertisements, even when received after # proxy advertisements, and also ensures that the first advertisement # for an anycast address "wins". #
# If the source of the solicitation is the unspecified address, the # node MUST set the Solicited flag to zero and multicast the # advertisement to the all-nodes address. Otherwise, the node MUST set # the Solicited flag to one and unicast the advertisement to the Source # Address of the solicitation. #
# If the Target Address is an anycast address the sender SHOULD delay # sending a response for a random time between 0 and # MAX_ANYCAST_DELAY_TIME seconds. # Because unicast Neighbor Solicitations are not required to include a # Source Link-Layer Address, it is possible that a node sending a # solicited Neighbor Advertisement does not have a corresponding link- # layer address for its neighbor in its Neighbor Cache. In such # situations, a node will first have to use Neighbor Discovery to # determine the link-layer address of its neighbor (i.e, send out a # multicast Neighbor Solicitation). #
# (omit) #
# # =end html # =pod =head1 REFERENCE =begin html
RFC 4862 - IPv6 Stateless Address Autoconfiguration
=end html =head1 SEE ALSO =begin html
 detail of v6eval tool option: see perldoc V6evalTool.pm, perldoc V6evalRemote.pm
=end html =cut