#!/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_C-v3_8_2.seq,v 1.1 2006/04/26 05:34:48 akisada Exp $ # ######################################################################## use nd; BEGIN {} END {} my $ereq = 'ndisc_ereq_LG'; # $cleanup_tn_global = 1; startNdiscWorld($Link0); if(setupCase14($Link0) < 0) { exitFatal(); #NOTREACHED } if (setupCommon11($Link0) < 0) { exitInitFail(); #NOTREACHED } $NOT_USE_FAST_CHANGE_STATE ++; vLogHTML('TEST PROCEDURE'. '
'); if(ndiscNone2DelayLoose($Link0, $ereq) < 0) { exitFail(); #NOTREACHED } if(ndRetransTimerProbe($Link0, $ereq) < 0) { exitFail(); #NOTREACHED } exitPass(); #NOTREACHED #------------------------------# # setupCommon11() # #------------------------------# sub setupCommon11 { my ($Link) = @_; $NEED_COMMON_CLEANUP = 1; if ($V6evalTool::NutDef{'Type'} eq 'router') { 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'. '
'); return($false); } $tr1_default = $true; return(0); } my $ra = 'mcast_ra_commonsetup'; vLogHTML('START COMMON SETUP 1.1'. '
'); # transit REACHABLE # send RA vClear($Link); vSend($Link, $ra); vRecv($Link, 3, 0, 0); my $ereq = 'ereq_commonsetup'; my @frames = 'ns_setupcommon'; my $mcast_ns = ''; vSend($Link, $ereq); my %ret1 = vRecvWrapper($Link, $TimeOut, 0, 0, @frames); if($ret1{'recvCount'}) { foreach my $frame (@frames) { if($ret1{'recvFrame'} eq $frame) { $mcast_ns = $frame; last; } } } if($mcast_ns eq '') { vLogHTML(''. 'Could\'t observe NS
'); return(-1); } ## send NA my $erep = 'erep_commonsetup'; my $na = 'na_setupcommon'; vSend($Link, $na); my %ret2 = vRecvWrapper($Link, $TimeOut, 0, 0, $erep); if($ret2{'recvCount'}) { if($ret2{'recvFrame'} ne $erep) { return(-1); } } vLogHTML('FINISH COMMON SETUP 1.1'. '
'); } # # perldoc # ######################################################################## __END__ =head1 NAME =begin html
v6LC_2_1_6_C-v3_8_2 - Neighbor Solicitation Origination, Reachability Confirmation (Neighbor Solicitation Origination, Link-local => Global) =end html =begin html
=end html =head1 TARGET =begin html
Host/Router
=end html =head1 TOPOLOGY =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>

=end html =head1 SETUP =begin html
This minimal setup procedure provides the NUT with a default router TR1, a global prefix, and ensures that the NUT can communicate with TR1.
   TR1     HUT
    |       |
    | -->   | RA
    |       |
    *       | Wait (MAX_RTR_SOLICITATION_DELAY + RetransTimer * DupAddrDetectTransmits)
    |       |
    | ----> | Echo Request
    |   <-- | NS
    | ----> | NA
    | <---- | Echo Reply
    |       |
    V       V

1. Send RA
        IPv6 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 second
        Node constants:
            RETRANS_TIMER             : 1,000 milliseconds
        Host Variables:
            RetransTimer
                Default               : RETRANS_TIMER milliseconds
        Node Variables:
            DupAddrDetectTransmits
                Default               : 1
3. Send Echo Request
        IPv6 header
            source      = TR1 (link-local)
            destination = HUT (link-local)
        Echo Request
4. Observe NS
        IPv6 header
            hop limit   = 255
            source      = HUT (link-local)
            destination = TR1 (solicited-node multicast address)
        NS
            target      = TR1 (link-local)
        SLL option
5. Send NA
        IPv6 header
            hop limit   = 255
            source      = TR1 (link-local)
            destination = HUT (link-local)
        NA
            R           = 1
            S           = 1
            O           = 1
            target      = TR1 (link-local)
        TLL option
6. Observe Echo Reply
        IPv6 header
            source      = HUT (link-local)
            destination = TR1 (link-local)
        Echo Reply
=end html =head1 INITIALIZATION =begin html
none
=end html =head1 TEST PROCEDURE =begin html
- Verify that NUT transmits valid NSs in PROBE state
- Verify that NUT transmits multicast NSs 3 times
   TN1     NUT
    |       |
    | ----> | Echo Request
    |   <-- | NS (multicast)
    | ----> | NA
    | <---- | Echo Reply
    |       |
    *       | Wait (REACHABLE_TIME * MAX_RANDOM_FACTOR)
    |       |
    | ----> | Echo Request
    | <---- | Echo Reply
    |       |
    *       | Wait (DELAY_FIRST_PROBE_TIME)
    |       |
    | <---- | NS (unicast) [Judgment #1]
    | <---- | NS (unicast)
    | <---- | NS (unicast)
    |       |
    V       V

1. Send Echo Request
        IPv6 header
            source      = TN1 (link-local)
            destination = NUT (global)
        Echo Request
    State: INCOMPLETE (TN1) (link-local)
2. Observe NS
        IPv6 header
            hop limit   = 255
            source      = NUT (global)
            destination = TN1 (solicited-node multicast address)
        NS
            target      = TN1 (link-local)
        SLL option
3. Send NA
        IPv6 header
            hop limit   = 255
            source      = TN1 (link-local)
            destination = NUT (global)
        NA
            R           = 0
            S           = 1
            O           = 1
            target      = TN1 (link-local)
        TLL option
    State: REACHABLE (TN1) (link-local)
4. Observe Echo Reply
        IPv6 header
            source      = NUT (global)
            destination = TN1 (link-local)
        Echo Reply
5. Wait (REACHABLE_TIME * MAX_RANDOM_FACTOR)
        Node constants:
            REACHABLE_TIME   : 30,000 milliseconds
            MAX_RANDOM_FACTOR: 1.5
    State: STALE (TN1) (link-local)
6. Send Echo Request
        IPv6 header
            source      = TN1 (link-local)
            destination = NUT (global)
        Echo Request
7. Observe Echo Reply
        IPv6 header
            source      = NUT (global)
            destination = TN1 (link-local)
        Echo Reply
    State: DELAY (TN1) (link-local)
8. Wait (DELAY_FIRST_PROBE_TIME)
        Node constants:
            DELAY_FIRST_PROBE_TIME: 5 seconds
    State: PROBE (TN1) (link-local)
9. Observe MAX_UNICAST_SOLICIT NSs [Judgment #1]
        IPv6 header
            hop limit   = 255
            source      = NUT (link-local)
            destination = TN1 (link-local)
        NS
            target      = TN1 (link-local)
        SLL option
        Node constants:
            MAX_UNICAST_SOLICIT: 3 transmissions
    State: NONE (TN1) (link-local)
=end html =head1 JUDGEMENT =begin html
[Judgment #1] NUT must transmit 3 NSs to TN1
=end html =head1 CLEANUP =begin html
- Remove global address
   TN1     NUT      R0
    |       |       |
    |       |   <-- | RA (rltime=0, vltime=0, pltime=0) (If NUT isn't Router)
    |       |       |
    V       V       V

    State: NONE (TN1) (link-local)
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) (link-local)
=end html =cut # =head1 REFERENCE # # =begin html #
# RFC2461 Neighbor Discovery for IPv6 #
#
# 7.2.2.  Sending Neighbor Solicitations
# 
#
#    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.3.3.  Node Behavior
# 
#
#    Upon entering the PROBE state, a node sends a unicast Neighbor
#    Solicitation message to the neighbor using the cached link-layer
#    address.  While in the PROBE state, a node retransmits Neighbor
#    Solicitation messages every RetransTimer milliseconds until
#    reachability confirmation is obtained.  Probes are retransmitted even
#    if no additional packets are sent to the neighbor.  If no response is
#    received after waiting RetransTimer milliseconds after sending the
#    MAX_UNICAST_SOLICIT solicitations, retransmissions cease and the
#    entry SHOULD be deleted.  Subsequent traffic to that neighbor will
#    recreate the entry and performs address resolution again.
# 
#
# # =end html # =pod =head1 REFERENCE =begin html
RFC 2461 - Neighbor Discovery for IPv6
=end html =cut