#!/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_1_D.seq,v 1.5 2006/04/28 08:28:51 akisada Exp $ # ######################################################################## use rdisc; BEGIN {} END {} vCapture($Link0); if($V6evalTool::NutDef{'Type'} eq 'host') { vSend($Link0, 'tr1_ra_common'); $tr1_default = $true; $tr1_prefix = $true; ignoreDAD($Link0); } else { if(vRemote( 'route.rmt', 'cmd=add', 'prefix=default', "gateway=fe80::200:ff:fe00:a0a0", "if=$V6evalTool::NutDef{'Link0_device'}" )) { vLogHTML(''. 'route.rmt: Could\'t set route'. '
'); exitFatal($Link0); } $tr1_default = $true; } unless(v6LC_2_1_1_D($Link0)) { exitFail($Link0); #NOTREACHED } exitPass($Link0); #NOTREACHED #------------------------------# # v6LC_2_1_1_D() # #------------------------------# sub v6LC_2_1_1_D($) { my ($Link) = @_; vLogHTML(''. 'Test Procedure'. '
'); vSend($Link, 'tn2_ereq_offlink_via_tr1'); return(is_tr1_incomplete($Link)); } #------------------------------# # is_tr1_incomplete() # #------------------------------# sub is_tr1_incomplete($) { my ($Link) = @_; my $bool = $false; my @frames = sort(keys(%tr1_mcast_nd_common)); %ret = vRecv($Link, $TimeOut, 0, 0, @frames); foreach my $frame (@frames) { if($ret{'recvFrame'} eq $frame) { $bool = $true; last; } } unless($bool) { vLogHTML(''. 'Could\'t observe NS'. '
'); return($false); } vRecv($Link, $TimeOut * ($MAX_MULTICAST_SOLICIT - 1), 0, 0); $tr1_cache = $false; return($true); } # # perldoc # ######################################################################## __END__ =head1 NAME =begin html
V6LC_2_1_1_D - On-Link Determination (Global Address, On-link Prefix does not cover TN2) =end html =begin html
=end html =head1 TARGET =begin html
Host
=end html =head1 TOPOLOGY =begin html
           TN2
            |
----+-------+--- Link1
    |
   TN1     NUT
    |       |
----+-------+--- Link0

Link0 link-local fe80::/64
TN 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>
H0 global 3ffe:501:ffff:101:200:ff:fe00:a0a0

=end html =head1 SETUP =begin html
If the NUT is a router, configure a default route with TR1 as next hop.
=end html =head1 TEST PROCEDURE =begin html
- Verify that NUT assumes the destination is off-link
    H0     TR1     NUT
    |       |       |
    |       | -->   | RA
    |       |       |
    |       *       | Wait (MAX_RTR_SOLICITATION_DELAY + RetransTimer * DupAddrDetectTransmits)
    |       |       |
    | ------------> | Echo Request
    |       |   <-- | NS (multicast) [Judgment #1]
    |       |   <-- | NS (multicast)
    |       |   <-- | NS (multicast)
    |       |       |
    V       V       V

    State: NONE (TN) (link-local)
1. Send RA
        IPv6 header
            hop limit          = 255
            source             = TN (link-local)
            destination        = all-nodes multicast address
        RA
            cur hop limit      = 64
            M                  = 0
            O                  = 0
            router lifetime    = 1800
            reachable time     = 0
            retrans timer      = 0
        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 second
        Node constants:
            RETRANS_TIMER             : 1,000 milliseconds
        Host Variables:
            RetransTimer
                Default               : RETRANS_TIMER milliseconds
        Node Variables:
            DupAddrDetectTransmits
                Default               : 1
    State: NONE (TN) (link-local)
3. Send Echo Request
        IPv6 header
            source      = H0  (global)
            destination = NUT (global)
        Echo Request
    State: INCOMPLETE (TN) (link-local)
4. Observe MAX_MULTICAST_SOLICIT NSs [Judgment #1]
        IPv6 header
            hop limit   = 255
            source      = NUT (global)
            destination = TN  (solicited-node multicast address)
        NS
            target      = TN  (link-local)
        SLL option
        Node constants:
            MAX_MULTICAST_SOLICIT: 3 transmissions
    State: NONE (TN) (link-local)
=end html =head1 JUDGEMENT =begin html
[Judgment #1] NUT must transmit 3 NSs to TN (solicited-node multicast address)
=end html =head1 CLEANUP =begin html
- Remove global address
- Clear default router
    TN     NUT
    |       |
    | ----> | RA (rltime=0, vltime=0, pltime=0)
    |       |
    V       V

    State: NONE (TN) (link-local)
1. Send RA
        IPv6 header
            hop limit          = 255
            source             = TN (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 (TN) (link-local)
=end html =cut # =head1 REFERENCE # # =begin html #
# RFC2461 Neighbor Discovery for IPv6 #
#
# 5.2.  Conceptual Sending Algorithm
# 
#
#    Next-hop determination for a given unicast destination operates as
#    follows.  The sender performs a longest prefix match against the
#    Prefix List to determine whether the packet's destination is on- or
#    off-link.  If the destination is on-link, the next-hop address is the
#    same as the packet's destination address.  Otherwise, the sender
#    selects a router from the Default Router List (following the rules
#    described in Section 6.3.6).  If the Default Router List is empty,
#    the sender assumes that the destination is on-link.
# 
#
# # =end html # =pod =head1 REFERENCE =begin html
RFC 2461 - Neighbor Discovery for IPv6
=end html =cut