#!/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_NAPostDAD_SF1.seq,v 1.5 2002/03/05 03:04:55 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 = 1; # 1[sec] time between DAD NS and DAD NS, send to NUT # (RandomDelay is 0-1sec e.g. default RetransTimer 1000msec) ########################################################## #----- Check Target Type $type=$V6evalTool::NutDef{Type}; if($type eq host) { vCPP('-DRFLAG=0'); } if($type eq router) { vCPP('-DRFLAG=1'); } ########################################################## #----- initialize NUT vLog("*** Target initialization phase ***"); $rret=vRemote("reboot_async.rmt","","timeout=$SAA::wait_rebootcmd"); vLog("reboot_async.rmt returned status $rret"); #----- start Capturing vLog("*** Target testing phase ***"); vCapture($IF); #----- 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],"); %ret=vRecv($IF,$SAA::wait_dadns{$SAA::howto_addrconf},0,$count,DADNS_from_NUT); if ($ret{status} == 0){ %retSend=vSend($IF, DADNA_from_TN_SF1); #----- check if NUT's address is configured vSleep($SAA::RetransTimerSec); if (seqCheckNUTAddrConfigured($IF) eq TRUE) { vLog("NUT assigned the address to the interface."); if ($SAA::DupAddrDetectTransmits == 0) { vLog("NUT transmit DAD NS though DupAddrDetectTransmits == 0"); seqNG(); }else{ seqOK(); } }else{ vLog("Though source address of NS is unicast,"); vLog(" NUT seems to detect Address Duplication"); seqNG(); } } else{ vLog("TN wait DAD NS from NUT for $SAA::wait_dadns{$SAA::howto_addrconf}, but NUT had not transmit DAD NS"); seqNG(); } ########################################################## #end ######################################################################## __END__ =head1 NAME LLA_DAD_NAPostDAD_SF1 - check the process when NUT receives invalid DAD NA(SolicitedFlag==1) with same Target address after sending DAD NS. =head1 TARGET All Node =head1 SYNOPSIS LLA_DAD_NAPostDAD_SF1.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 assignes autoconfigured address, even though NUT receives invalid (SolicitedFlag==1) DAD NA for same target address as NUT, while DAD process (after transmitting DAD NS). 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 ==== Action #1: DAD NA =========> name: DADNA_from_TN_SF1 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 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 #1. TN transmits invalid DAD NA which contains 1 as SolicitedFlag. name: DADNA_from_TN_SF1 src: TN's Link-local dst: allnode TargetAddress: NUT's Link-local RFlag: 0 SFlag: 1 OFlag: 1 TLLOPT: TN's MAC address Action #2. TN transmits SOL NS to check if NUT's address is configured name: SOLNS_from_TN_SameTgt src: TN's Link-local0 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.1. Message Validation
A node MUST silently discard any Neighbor Solicitation or Advertisement message that does not pass the validity checks specified in [DISCOVERY]. A solicitation that passes these validity checks is called a valid solicitation or valid advertisement. (omit)

RFC2461

4.4. Neighbor Advertisement Message Format
(omit) A node sends Neighbor Advertisements in response to Neighbor Solicitations and sends unsolicited Neighbor Advertisements in order to (unreliably) propagate new information quickly.
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Code | Checksum | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |R|S|O| Reserved | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | + + | | + Target Address + | | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Options ... +-+-+-+-+-+-+-+-+-+-+-+-
(omit)
IP Fields:
(omit)
ICMP Fields:
Type 136
Code 0
Checksum The ICMP checksum. See [ICMPv6].
R Router flag. When set, the R-bit indicates that the sender is a router. The R-bit is used by Neighbor Unreachability Detection to detect a router that changes to a host.
S Solicited flag. When set, the S-bit indicates that the advertisement was sent in response to a Neighbor Solicitation from the Destination address. The S-bit is used as a reachability confirmation for Neighbor Unreachability Detection. It MUST NOT be set in multicast advertisements or in unsolicited unicast advertisements.
O Override flag. When set, the O-bit indicates that the advertisement should override an existing cache entry and update the cached link-layer address. When it is not set the advertisement will not update a cached link-layer address though it will update an existing Neighbor Cache entry for which no link-layer address is known. It SHOULD NOT be set in solicited advertisements for anycast addresses and in solicited proxy advertisements. It SHOULD be set in other solicited advertisements and in unsolicited advertisements.
Reserved 29-bit unused field. It MUST be initialized to zero by the sender and MUST be ignored by the receiver.
Target Address For solicited advertisements, the Target Address field in the Neighbor Solicitation message that prompted this advertisement. For an unsolicited advertisement, the address whose link-layer address has changed. The Target Address MUST NOT be a multicast address. (omit)

7.1.2. Validation of Neighbor Advertisements
A node MUST silently discard any received Neighbor Advertisement messages that do not satisfy all of the following validity checks:
- The IP Hop Limit field has a value of 255, i.e., the packet could not possibly have been forwarded by a router.
- If the message includes an IP Authentication Header, the message authenticates correctly.
- ICMP Checksum is valid.
- ICMP Code is 0.
- ICMP length (derived from the IP length) is 24 or more octets.
- Target Address is not a multicast address.
- If the IP Destination Address is a multicast address the Solicited flag is zero.
- All included options have a length that is greater than zero.
The contents of the Reserved field, and of any unrecognized options, MUST be ignored. Future, backward-compatible changes to the protocol may specify the contents of the Reserved field or add new options; backward-incompatible changes may use different Code values.
The contents of any defined options that are not specified to be used with Neighbor Advertisement messages MUST be ignored and the packet processed as normal. The only defined option that may appear is the Target Link-Layer Address option.
A Neighbor Advertisements that passes the validity checks is called a "valid advertisement".
(omit)
=end html =head1 SEE ALSO =begin html
 detail of v6eval tool option: see perldoc V6evalTool.pm, perldoc V6evalRemote.pm
=end html =cut