#!/usr/bin/perl # # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 # 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_14.seq,v 1.5 2008/02/07 10:45:41 akisada Exp $ # ######################################################################## use nd; BEGIN {} END {} if($V6evalTool::NutDef{'Type'} ne 'router') { exitRouterOnly(); #NOTREACHED } $pktdesc{'nd_mcast_ns_sll_anycast'} = ' Send NS w/ SLL: TN (global) -> Subnet-Router anycast address'; $pktdesc{'anycast_recv_na_RSo_tll'} = ' Recv NA (RSo) w/ TLL: NUT (global) -> TN (global)'; $pktdesc{'anycast_recv_na_RSo_tll_linklocal'} = ' Recv NA (RSo) w/ TLL: NUT (link-local) -> TN (global)'; $pktdesc{'anycast_recv_na_RSO_tll'} = ' Recv NA (RSO) w/ TLL: NUT (global) -> TN (global)'; $pktdesc{'anycast_recv_na_RSO_tll_linklocal'} = ' Recv NA (RSO) w/ TLL: NUT (link-local) -> TN (global)'; my $ns = 'nd_mcast_ns_sll_anycast'; startNdiscWorld($Link0); my @na = ndSetNa4mcastNsAnycast(); if(MaxAnycastDelayTime($Link0, 3, $ns, \@na) < 0) { exitFail(); #NOTREACHED } exitPass(); #NOTREACHED #------------------------------# # MaxAnycastDelayTime() # #------------------------------# sub MaxAnycastDelayTime($$$$) { my ($Link, $times, $ns, $na_ref) = @_; my @na = @$na_ref; my $returnv = 0; my @delays = (); vLogHTML('Procedure'. '
'); my $got_na = 0; vLogHTML(''. "Delay calculation". '
'); my %vsend = vSend($Link0, $ns); my %vrecv = vRecvWrapper($Link0, $MAX_ANYCAST_DELAY_TIME + 1, 0, 0, @na); if($vrecv{'recvCount'}) { foreach my $frame (@na) { if($vrecv{'recvFrame'} eq $frame) { $got_na ++; } } } unless($got_na) { vLogHTML('Could\'t observe NA'. '
'); return(-1); } my $sendtime = $vsend{'sentTime1'}; my $recvtime = $vrecv{'recvTime' . $vrecv{'recvCount'}}; vLogHTML(''); vLogHTML(''); vLogHTML(""); vLogHTML(''); vLogHTML(""); vLogHTML(''); vLogHTML(''); vLogHTML(""); vLogHTML(''); vLogHTML(""); vLogHTML(''); my $delta = $recvtime - $sendtime; vLogHTML(''); vLogHTML(""); vLogHTML(''); vLogHTML(""); vLogHTML(''); vLogHTML('
Send NS:$sendtime sec.
Recv NA:$recvtime sec.
Delay:$delta sec.
'); push(@delays, $delta); if($returnv < 0) { vLogHTML('If the Target Address is an anycast address the sender SHOULD delay
'); vLogHTML('sending a response for a random time between 0 and
'); vLogHTML('MAX_ANYCAST_DELAY_TIME seconds.
'); } if ($delta > $MAX_ANYCAST_DELAY_TIME) { vLogHTML('over MAX_ANYCAST_DELAY_TIME seconds.
'); exitFail(); } return($returnv); } #------------------------------# # ndSetNa4mcastNsAnycast() # #------------------------------# sub ndSetNa4mcastNsAnycast() { my @na = (); push(@na, 'anycast_recv_na_RSo_tll'); push(@na, 'anycast_recv_na_RSo_tll_linklocal'); if($IGN_NA_O_FLAG) { push(@na, 'anycast_recv_na_RSO_tll'); push(@na, 'anycast_recv_na_RSO_tll_linklocal'); } return(@na); } # # perldoc # ######################################################################## __END__ =head1 NAME =begin html
V6LC_2_1_14 -Neighbor Solicitation Processing Anycast =end html =begin html
=end html =head1 TARGET =begin html
Router
=end html =head1 TOPOLOGY =begin html
            |
    TN     NUT
    |       |
----+-------+--- Link0

Link0 global 3ffe:501:ffff:100::/64  
link-local fe80::/64  
TN global 3ffe:501:ffff:100::<TnDef.Link0_addr>  
link-local fe80::<TnDef.Link0_addr>  
ether <TnDef.Link0_addr>  
NUT
(Link0)
global 3ffe:501:ffff:100::<NutDef.Link0_addr> unicast
3ffe:501:ffff:100:: anycast
link-local fe80::<NutDef.Link0_addr>  
ether <NutDef.Link0_addr>  

=end html =head1 SETUP =begin html
none
=end html =head1 INITIALIZATION =begin html
none
=end html =head1 TEST PROCEDURE =begin html
- Verify that NA sent in response to a NS is delayed by a random time between 0 and MAX_ANYCAST_DELAY_TIME seconds.
    TN     NUT
    |       |
    | -->   | NS (multicast)
    | <---- | NA [Judgment #1]
    |       |
    V       V

    State: NONE (TN) (link-local)
1. Send NS
        IPv6 header
            hop limit   = 255
            source      = TN (global)
            destination = Subnet-Router anycast address (solicited-node multicast address)
        NS
            target      = Subnet-Router anycast address
        SLL option
    State: STALE (TN) (link-local)
2. Observe NA between 0 and MAX_ANYCAST_DELAY_TIME seconds after the receipt of NS [Judgment #1]
        IPv6 header
            hop limit   = 255
            source      = NUT (global)
            destination = TN  (global)
        NA
            R           = 1
            S           = 1
            O           = 0
            target      = Subnet-Router anycast address
        TLL option
        Node constants:
            MAX_ANYCAST_DELAY_TIME: 1 seconds
    State: DELAY (TN) (link-local)
=end html =head1 JUDGEMENT =begin html
[Judgment #1] NUT must transmit NA to TN between 0 and MAX_ANYCAST_DELAY_TIME seconds after the receipt of NS
=end html =head1 CLEANUP =begin html
none
=end html =cut # =head1 REFERENCE # # =begin html #
# RFC2461 Neighbor Discovery for IPv6 #
#
# 7.2.7.  Anycast Neighbor Advertisements
# 
#
#    From the perspective of Neighbor Discovery, anycast addresses are
#    treated just like unicast addresses in most cases.  Because an
#    anycast address is syntactically the same as a unicast address, nodes
#    performing address resolution or Neighbor Unreachability Detection on
#    an anycast address treat it as if it were a unicast address.  No
#    special processing takes place.
# 
#
#    Nodes that have an anycast address assigned to an interface treat
#    them exactly the same as if they were unicast addresses with two
#    exceptions.  First, Neighbor Advertisements sent in response to a
#    Neighbor Solicitation SHOULD be delayed by a random time between 0
#    and MAX_ANYCAST_DELAY_TIME to reduce the probability of network
#    congestion.  Second, the Override flag in Neighbor Advertisements
#    SHOULD be set to 0, so that when multiple advertisements are
#    received, the first received advertisement is used rather than the
#    most recently received advertisement.
# 
#
#    As with unicast addresses, Neighbor Unreachability Detection ensures
#    that a node quickly detects when the current binding for an anycast
#    address becomes invalid.
# 
#
# # =end html # =pod =head1 REFERENCE =begin html
RFC 2461 - Neighbor Discovery for IPv6
=end html =cut