#!/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_3_6_I.seq,v 1.3 2005/04/11 08:54:43 akisada Exp $ # ######################################################################## use redirect; BEGIN {} END {} if($V6evalTool::NutDef{'Type'} ne 'host') { exitHostOnly($Link0); #NOTREACHED } vCapture($Link0); unless(commonSetup_1_1($Link0)) { exitInitFail($Link0); #NOTREACHED } $pktdesc{'local_redirect'} = ' Send Redirect w/ TLL (Option has Length Zero): '. 'TR1 (link-local) -> HUT (global)'; unless(v6LC_2_3_6($Link0)) { exitFail($Link0); #NOTREACHED } exitPass($Link0); #NOTREACHED # # perldoc # ######################################################################## __END__ =head1 NAME =begin html
v6LC_2_3_6_I - Redirected to Alternate Router: Invalid (Option has Length Zero) =end html =begin html
=end html =head1 TARGET =begin html
Host
=end html =head1 TOPOLOGY =begin html
                   TN1
                    |
----+-------+-------+--- LinkX
    |       |
   TR1     TR2     HUT
    |       |       |
----+-------+-------+--- Link0

Link0 global 3ffe:501:ffff:100::/64
link-local fe80::/64
LinkX global 3ffe:501:ffff::/64
link-local fe80::/64
TR1 global 3ffe:501:ffff:100:200:ff:fe00:a0a0
link-local fe80::200:ff:fe00:a0a0
ether 00:00:00:00:a0:a0
TR2 global 3ffe:501:ffff:100:200:ff:fe00:a1a1
link-local fe80::200:ff:fe00:a1a1
ether 00:00:00:00:a1:a1
HUT global 3ffe:501:ffff:100::<NutDef.Link0_addr>
link-local fe80::<NutDef.Link0_addr>
ether <NutDef.Link0_addr>
TN1 global 3ffe:501:ffff::<TnDef.Link0_addr>
link-local fe80::<TnDef.Link0_addr>
ether <TnDef.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     = 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
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 TEST PROCEDURE =begin html
Verify that a host properly processes invalid Redirect messages when redirected on-link.
   TN1     TR1     TR2     HUT
    |       |       |       |
    | ------+-------------> | Echo Request (via TR1)
    | <-----+-------------- | Echo Reply   (via TR1) [Judgment #1]
    |       |       |       |
    |       |       | -->   | RA
    |       |       |       |
    |       | ------------> | Redirect
    |       |       |       |
    | ------+-------------> | Echo Request (via TR1)
    | <-----+-------------- | Echo Reply   (via TR1) [Judgment #2]
    |       |       |       |
    V       V       V       V

1. Send Echo Request (via TR1)
        IPv6 header
            source      = TN1 (global)
            destination = HUT (global)
        Echo Request
2. Observe Echo Reply (via TR1)
        IPv6 header
            source      = HUT (global)
            destination = TN1 (global)
        Echo Reply
3. Send RA
        IPv6 header
            hop limit          = 255
            source             = TR2 (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
        SLL option
        Prefix Information option
            prefix length      = 64
            L                  = 1
            A                  = 1
            valid Lifetime     = 2592000
            preferred lifetime = 604800
            prefix             = 3ffe:501:ffff:100::
4. Send Redirect
        IPv6 header
            hop limit   = 255
            source      = TR1 (link-local)
            destination = HUT (global)
        Redirect
            checksum    = 0
            target      = TR2 (link-local)
            destination = TN1 (global)
        TLL option
            length      = 0
5. Send Echo Request (via TR1)
        IPv6 header
            source      = TN1 (global)
            destination = HUT (global)
        Echo Request
6. Observe Echo Reply (via TR1)
        IPv6 header
            source      = HUT (global)
            destination = TN1 (global)
        Echo Reply
=end html =head1 JUDGEMENT =begin html
[Judgment #1] The HUT should respond to the first Echo Request using TR1 as a first hop.
[Judgment #2] The HUT should also respond to the second Echo Request using TR1 as a first hop, indicating the HUT did not process the invalid Redirect message.
=end html =head1 CLEANUP =begin html
The Cleanup procedure should cause the NUT to transition Neighbor Cache entries created in this test to state INCOMPLETE and remove any entries from its Default Router and Prefix Lists.
   TR1     TR2     HUT
    |       |       |
    |       | -->   | RA
    |       |       |
    | -->   |       | RA
    |       |       |
    |       | -->   | NA
    |       |       |
    |       | ----> | Echo Request
    |       | <---- | Echo Reply
    |       |       |
    |       *       | Wait (DELAY_FIRST_PROBE_TIME)
    |       |       |
    |       | <---- | NS
    |       | <---- | NS
    |       | <---- | NS
    |       |       |
    | -->   |       | NA
    |       |       |
    | ------------> | Echo Request
    | <------------ | Echo Reply
    |       |       |
    *       |       | Wait (DELAY_FIRST_PROBE_TIME)
    |       |       |
    | <------------ | NS
    | <------------ | NS
    | <------------ | NS
    |       |       |
    V       V       V

1. Send RA
        IPv6 header
            hop limit          = 255
            source             = TR2 (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     = 0
            preferred lifetime = 0
            prefix             = 3ffe:501:ffff:100::
2. 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     = 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::
3. Send NA w/ TLL (diff)
        IPv6 header
            hop limit   = 255
            source      = TR2 (link-local)
            destination = all-nodes multicast address
        NA
            R           = 1
            S           = 0
            O           = 1
            target      = TR1 (link-local)
        TLL option
            address     = TRX (ether)
4. Send Echo Request
        IPv6 header
            source      = TR2 (link-local)
            destination = HUT (link-local)
        Echo Request
5. Observe Echo Reply
        IPv6 header
            source      = HUT (link-local)
            destination = TR2 (link-local)
        Echo Reply
6. Wait (DELAY_FIRST_PROBE_TIME)
        Node constants:
            DELAY_FIRST_PROBE_TIME: 5 seconds
7. Observe MAX_UNICAST_SOLICIT NSs
        IPv6 header
            hop limit   = 255
            source      = HUT (link-local)
            destination = TR2 (link-local)
        NS
            target      = TR2 (link-local)
        SLL option
        Node constants:
            MAX_UNICAST_SOLICIT: 3 transmissions
8. Send NA w/ TLL (diff)
        IPv6 header
            hop limit   = 255
            source      = TR1 (link-local)
            destination = all-nodes multicast address
        NA
            R           = 1
            S           = 0
            O           = 1
            target      = TR1 (link-local)
        TLL option
            address     = TRX (ether)
9. Send Echo Request
        IPv6 header
            source      = TR1 (link-local)
            destination = HUT (link-local)
        Echo Request
10. Observe Echo Reply
        IPv6 header
            source      = HUT (link-local)
            destination = TR1 (link-local)
        Echo Reply
11. Wait (DELAY_FIRST_PROBE_TIME)
        Node constants:
            DELAY_FIRST_PROBE_TIME: 5 seconds
12. Observe MAX_UNICAST_SOLICIT NSs
        IPv6 header
            hop limit   = 255
            source      = HUT (link-local)
            destination = TR1 (link-local)
        NS
            target      = TR1 (link-local)
        SLL option
        Node constants:
            MAX_UNICAST_SOLICIT: 3 transmissions
=end html =cut # =head1 REFERENCE # # =begin html #
#
# 8.1.  Validation of Redirect Messages
# 
#
#    A host MUST silently discard any received Redirect message that does
#    not satisfy all of the following validity checks:
# 
#
#       - IP Source Address is a link-local address.  Routers must use
#         their link-local address as the source for Router Advertisement
#         and Redirect messages so that hosts can uniquely identify
#         routers.
# 
#
#       - 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 40 or more octets.
# 
#
#       - The IP source address of the Redirect is the same as the current
#         first-hop router for the specified ICMP Destination Address.
# 
#
#       - The ICMP Destination Address field in the redirect message does
#         not contain a multicast address.
# 
#
#       - The ICMP Target Address is either a link-local address (when
#         redirected to a router) or the same as the ICMP Destination
#         Address (when redirected to the on-link destination).
# 
#
#       - 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 Redirect messages MUST be ignored and the packet processed as
#    normal.  The only defined options that may appear are the Target
#    Link-Layer Address option and the Redirected Header option.
# 
#
#    A host MUST NOT consider a redirect invalid just because the Target
#    Address of the redirect is not covered under one of the link's
#    prefixes.  Part of the semantics of the Redirect message is that the
#    Target Address is on-link.
# 
#
#    A redirect that passes the validity checks is called a "valid
#    redirect".
# 
#
# # =end html # =pod =head1 REFERENCE =begin html
RFC 2461 - Neighbor Discovery for IPv6
=end html =cut