#!/usr/bin/perl
#
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
# 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.
#
# $TAHI: ct/nd.p2/V6LC_2_1_6_B.seq,v 1.12 2006/01/20 10:39:14 akisada Exp $
#
########################################################################
use nd;
BEGIN {}
END {}
startNdiscWorld($Link0);
vLogHTML('set RetransTimer=1
');
#-- AdvRetransTimer: 1 ------------------------------------------------#
if(setupCommon11_local($Link0) < 0) {
exitInitFail();
}
vLogHTML(''.
'TEST PROCEDURE
');
my $ereq = 'ndisc_ereq_GG';
vSend($Link0, $ereq);
my @frames = mcastNS($ereq);
my $recvCount = 0;
my $solicit = 0;
$TimeOut = 1 + 1;
my @recvTimes = ();
for( ; ; ) {
my %ret = vRecvWrapper($Link0, $TimeOut, 0, 0, @frames);
if($ret{'recvCount'}) {
$recvCount += $ret{'recvCount'};
foreach my $frame (@frames) {
if($ret{'recvFrame'} eq $frame) {
$solicit ++;
$recvCount --;
push(@recvTimes,
$ret{'recvTime'.$ret{'recvCount'}});
last;
}
}
if($solicit > $MAX_MULTICAST_SOLICIT) {
vLogHTML(''.
'Observed too many NSs
');
exitFail();
}
next;
}
last;
}
unless($solicit) {
vLogHTML(''.
'Could\'t observe NS
');
exitFail();
}
if($solicit < $MAX_MULTICAST_SOLICIT) {
vLogHTML(''.
'Observed too less NSs
');
exitFail();
}
my $retransTimer = 1;
if(checkInterval($retransTimer, @recvTimes) < 0) {
exitFail();
}
#-- AdvRetransTimer: 5 ------------------------------------------------#
if($V6evalTool::NutDef{'Type'} eq 'router') {
if(vRemote('racontrol.rmt', 'mode=stop')) {
vLogHTML('racontrol.rmt: '.
'Could\'t stop to send RA
');
exitFatal();
#NOTREACHED
}
$rut_rtadvd = 0;
vRecv($Link0,
$MAX_INITIAL_RTR_ADVERT_INTERVAL *
$MAX_INITIAL_RTR_ADVERTISEMENTS +
$MIN_DELAY_BETWEEN_RAS + 1,
0, 0);
if(vRemote('racontrol.rmt', 'mode=start',
'retrans=5000',
"link0=$V6evalTool::NutDef{'Link0_device'}")) {
vLogHTML(''.
'racontrol.rmt: Could\'t start to send RA'.
'
');
exitFatal();
#NOTREACHED
}
$rut_rtadvd = 1;
$rut_rtadvd_retrans = 1;
vRecv($Link0,
$MAX_INITIAL_RTR_ADVERT_INTERVAL *
$MAX_INITIAL_RTR_ADVERTISEMENTS +
$MIN_DELAY_BETWEEN_RAS + 1,
0, 0);
} else {
vSend($Link0, 'mcast_ra_retranstiemer5');
}
$force_cleanup_r0 = 1;
# send link-local Echo Request
vSend($Link0, $ereq);
$recvCount = 0;
$solicit = 0;
$TimeOut = 5 + 1;
@recvTimes = ();
for( ; ; ) {
my %ret = vRecvWrapper($Link0, $TimeOut, 0, 0, @frames);
if($ret{'recvCount'}) {
$recvCount += $ret{'recvCount'};
foreach my $frame (@frames) {
if($ret{'recvFrame'} eq $frame) {
$solicit ++;
$recvCount --;
push(@recvTimes,
$ret{'recvTime'.$ret{'recvCount'}});
last;
}
}
if($solicit > $MAX_MULTICAST_SOLICIT) {
vLogHTML(''.
'Observed too many NSs
');
exitFail();
}
next;
}
last;
}
unless($solicit) {
vLogHTML(''.
'Could\'t observe NS
');
exitFail();
}
if($solicit < $MAX_MULTICAST_SOLICIT) {
vLogHTML(''.
'Observed too less NSs
');
exitFail();
}
$retransTimer = 5;
if(checkInterval($retransTimer, @recvTimes) < 0) {
exitFail();
}
exitPass();
#NOTREACHED
#------------------------------#
# checkInterval #
#------------------------------#
sub
checkInterval($@)
{
my ($retransTimer, @recvtimes) = @_;
my $returnvalue = 0;
vLogHTML('
| Recv[$d] | "); vLogHTML(': | '); vLogHTML("$recvtimes[$d] sec. | "); if($d == 0) { vLogHTML(''); } vLogHTML(' | |||||
| '); } else { my $delta = $recvtimes[$d + 1] - $recvtimes[$d]; vLogHTML(" | Interval[$d] | "); vLogHTML(': | '); vLogHTML(sprintf("%.1f sec. | ", $delta)); my $margin = 0.5; if(($delta < $retransTimer - $margin) || ($delta > $retransTimer + $margin)) { vLogHTML(''); vLogHTML('*'); vLogHTML(' | '); $returnvalue = -1; } else { vLogHTML(''); } } vLogHTML(' | |||
V6LC_2_1_6_B - Verify that the NUT transmits NSs in INCOMPLETE (global => global) =end html =begin html=end html =head1 TARGET =begin html
Host/Router=end html =head1 TOPOLOGY =begin html
=end html =head1 SETUP =begin html| TN1 NUT R0 | | | ----+-------+-------+--- Link0
Link0 global 3ffe:501:ffff:100::/64 link-local fe80::/64 R0 global 3ffe:501:ffff:100:200:ff:fe00:a0a0 link-local fe80::200:ff:fe00:a0a0 ether 00:00:00:00:a0:a0 TN1 global 3ffe:501:ffff:100::<TnDef.Link0_addr> link-local fe80::<TnDef.Link0_addr> ether <TnDef.Link0_addr> NUT global 3ffe:501:ffff:100::<NutDef.Link0_addr> link-local fe80::<NutDef.Link0_addr> ether <NutDef.Link0_addr>
This minimal setup procedure provides the NUT with a default router TR1, a global prefix, and ensures that the NUT can communicate with TR1.=end html =head1 INITIALIZATION =begin htmlTR1 HUT | | | --> | RA | | * | Wait (MAX_RTR_SOLICITATION_DELAY + RetransTimer * DupAddrDetectTransmits) | | | ----> | Echo Request | <-- | NS | ----> | NA | <---- | Echo Reply | | V V
1. Send RAIPv6 header hop limit = 255 source = TR1 (link-local) destination = all-nodes multicast address RA cur hop limit = 64 M = 0 O = 0 router lifetime = 1800 reachable time = 30000 retrans timer = 1000 Prefix Information option prefix length = 64 L = 1 A = 1 valid Lifetime = 2592000 preferred lifetime = 604800 prefix = 3ffe:501:ffff:100::2. Wait (MAX_RTR_SOLICITATION_DELAY + RetransTimer * DupAddrDetectTransmits)Host constants: MAX_RTR_SOLICITATION_DELAY: 1 secondNode constants: RETRANS_TIMER : 1,000 millisecondsHost Variables: RetransTimer Default : RETRANS_TIMER millisecondsNode Variables: DupAddrDetectTransmits Default : 13. Send Echo RequestIPv6 header source = TR1 (link-local) destination = HUT (link-local) Echo Request4. Observe NSIPv6 header hop limit = 255 source = HUT (link-local) destination = TR1 (solicited-node multicast address) NS target = TR1 (link-local) SLL option5. Send NAIPv6 header hop limit = 255 source = TR1 (link-local) destination = HUT (link-local) NA R = 1 S = 1 O = 1 target = TR1 (link-local) TLL option6. Observe Echo ReplyIPv6 header source = HUT (link-local) destination = TR1 (link-local) Echo Reply
=end html =head1 TEST PROCEDURE =begin htmlnone
- Verify that NUT transmits valid NSs in INCOMPLETE state=end html =head1 JUDGEMENT =begin html
- Verify that NUT transmits multicast NSs 3 times
- Verify that NUT selects source address of NS correctly
TN1 NUT | | | ----> | Echo Request | <-- | NS (multicast) [Judgment #1] | <-- | NS (multicast) | <-- | NS (multicast) | | | --> | RA | ----> | Echo Request | <-- | NS (multicast) [Judgment #2] | <-- | NS (multicast) | <-- | NS (multicast) | | V V
1. Send Echo RequestIPv6 header source = TN1 (global) destination = NUT (global) Echo RequestState: INCOMPLETE (TN1) (global)2. Observe MAX_MULTICAST_SOLICIT NSs [Judgment #1]IPv6 header hop limit = 255 source = NUT (global) destination = TN1 (solicited-node multicast address) NS target = TN1 (global) SLL optionNode constants: MAX_MULTICAST_SOLICIT: 3 transmissions3. Send RAIPv6 header hop limit = 255 source = TR1 (link-local) destination = all-nodes multicast address RA cur hop limit = 64 M = 0 O = 0 router lifetime = 1800 reachable time = 30000 retrans timer = 5000 Prefix Information option prefix length = 64 L = 1 A = 1 valid Lifetime = 2592000 preferred lifetime = 604800 prefix = 3ffe:501:ffff:100::4. Send Echo RequestIPv6 header source = TN1 (global) destination = NUT (global) Echo RequestState: INCOMPLETE (TN1) (global)5. Observe MAX_MULTICAST_SOLICIT NSs [Judgment #2]IPv6 header hop limit = 255 source = NUT (global) destination = TN1 (solicited-node multicast address) NS target = TN1 (global) SLL optionNode constants: MAX_MULTICAST_SOLICIT: 3 transmissions
=end html =head1 CLEANUP =begin html[Judgment #1] NUT must transmit 3 NSs to TN1 (solicited-node multicast address) at intervals of 1 second [Judgment #2] NUT must transmit 3 NSs to TN1 (solicited-node multicast address) at intervals of 5 seconds
- Remove global address=end html =cut # =head1 REFERENCE # # =begin html #
TN1 NUT R0 | | | | | <-- | RA (rltime=0, vltime=0, pltime=0) (If NUT isn't Router) | | | V V V
State: NONE (TN1) (global)1. Send RA (If NUT isn't Router)IPv6 header hop limit = 255 source = R0 (link-local) destination = all-nodes multicast address RA cur hop limit = 64 M = 0 O = 0 router lifetime = 0 reachable time = 0 retrans timer = 0 Prefix Information option prefix length = 64 L = 1 A = 1 valid Lifetime = 0 preferred lifetime = 0 prefix = 3ffe:501:ffff:100::State: NONE (TN1) (global)
# RFC2461 Neighbor Discovery for IPv6 ## # =end html # =pod =head1 REFERENCE =begin html
## 7.2.2. Sending Neighbor Solicitations ### When a node has a unicast packet to send to a neighbor, but does not # know the neighbor's link-layer address, it performs address # resolution. For multicast-capable interfaces this entails creating a # Neighbor Cache entry in the INCOMPLETE state and transmitting a # Neighbor Solicitation message targeted at the neighbor. The # solicitation is sent to the solicited-node multicast address # corresponding to the target address. ### If the source address of the packet prompting the solicitation is the # same as one of the addresses assigned to the outgoing interface, that # address SHOULD be placed in the IP Source Address of the outgoing # solicitation. Otherwise, any one of the addresses assigned to the # interface should be used. Using the prompting packet's source # address when possible insures that the recipient of the Neighbor # Solicitation installs in its Neighbor Cache the IP address that is # highly likely to be used in subsequent return traffic belonging to # the prompting packet's "connection". ### If the solicitation is being sent to a solicited-node multicast # address, the sender MUST include its link-layer address (if it has # one) as a Source Link-Layer Address option. Otherwise, the sender # SHOULD include its link-layer address (if it has one) as a Source # Link-Layer Address option. Including the source link-layer address # in a multicast solicitation is required to give the target an address # to which it can send the Neighbor Advertisement. On unicast # solicitations, an implementation MAY omit the Source Link-Layer # Address option. The assumption here is that if the sender has a # peer's link-layer address in its cache, there is a high probability # that the peer will also have an entry in its cache for the sender. # Consequently, it need not be sent. ### RFC2461 Neighbor Discovery for IPv6 #
## 7.2.2. Sending Neighbor Solicitations ### If no Neighbor Advertisement is received after MAX_MULTICAST_SOLICIT # solicitations, address resolution has failed. The sender MUST return # ICMP destination unreachable indications with code 3 (Address # Unreachable) for each packet queued awaiting address resolution. ##
=end html =cutRFC 2461 - Neighbor Discovery for IPv6