# NAME

            rfc2765_3.3_icmpv4error.seq - Verify IPv6 <-> IPv4 header
            translation in accordance with RFC2765 [SIIT]

# TARGET

            Router

# SYNOPSIS

            rfc2765_3.3_icmpv4error.seq [-tooloption ...]
            -p rfc2765_3.3_icmpv4error.def

# INITIALIZATION

    	Before this test starts, run initialize.seq.

# TEST PROCEDURE

            This test verifies that NUT can translate ICMPv6 error messages
            in accordance to RFC2765.

            Network Topology

            Link0
            --------------------------
                |               |
               TN              NUT
                |               |
            --------------------------
            Link1

            TN -- (Link0) -- NUT        NUT -- (Link1) -- TN

            ---------------------      ------------------------

       ICMPv6 (Type 1, Code 0)             =>  ICMPv4 (Type 3, Code 1)
       ICMPv6 (Type 1, Code 1)             =>  ICMPv4 (Type 3, Code 10)
       ICMPv6 (Type 1, Code 2)             =>  ICMPv4 (Type 3, Code 1)
       ICMPv6 (Type 1, Code 3)             =>  ICMPv4 (Type 3, Code 1)
       ICMPv6 (Type 1, Code 4)             =>  ICMPv4 (Type 3, Code 3)
       ICMPv6 (Type 2, Code 0, MTU 1280)   =>  ICMPv4 (Type 3, Code 4, MTU 1252)
       ICMPv6 (Type 3, Code 0)             =>  ICMPv4 (Type 11, Code 0)
       ICMPv6 (Type 4, Code 0, Pointer 0)  <=  ICMPv4 (Type 12, Code 0, Pointer 0)
       ICMPv6 (Type 4, Code 0, Pointer 4)  <=  ICMPv4 (Type 12, Code 0, Pointer 2)
       ICMPv6 (Type 4, Code 0, Pointer 6)  <=  ICMPv4 (Type 12, Code 0, Pointer 9)
       ICMPv6 (Type 4, Code 0, Pointer 7)  <=  ICMPv4 (Type 12, Code 0, Pointer 8)
       ICMPv6 (Type 4, Code 0, Pointer 8)  <=  ICMPv4 (Type 12, Code 0, Pointer 12)
       ICMPv6 (Type 4, Code 0, Pointer 24) <=  ICMPv4 (Type 12, Code 0, Pointer 16)
       ICMPv6 (Type 4, Code 0, Pointer 1)  <=  ICMPv4 (Type 12, Code 0, Pointer -1)
       ICMPv6 (Type 4, Code 1)             =>  ICMPv4 (Type 3, Code 2)

# JUDGMENT

            << PASS >>
                    NUT translates ICMPv6 error messages in accordance with
                    RFC2765, including translating the inner IP-header.

            << FAIL >>
                    NUT fails to translate ICMPv6 errors correctly, or doesn't
                    drop untranslatable ICMPv6 error types.

# NOTE

# REFERENCE

RFC2765

4.2. Translating ICMPv6 Headers into ICMPv4 Headers

       All ICMP messages that are to be translated require that the ICMP
       checksum field be updated as part of the translation since ICMPv6,
       unlike ICMPv4, has a pseudo-header checksum just like UDP and TCP.

       In addition all ICMP packets need to have the Type value translated
       and for ICMP error messages the included IP header also needs
       translation.

       The actions needed to translate various ICMPv6 messages are:

          ICMPv6 error messages:

            Destination Unreachable (Type 1)
               Set the Type field to 3.  Translate the code field as
               follows:
                  Code 0 (no route to destination):
                         Set Code to 1 (host unreachable).

                  Code 1 (communication with destination administratively
                         prohibited):
                         Set Code to 10 (communication with destination host
                         administratively prohibited).

                  Code 2 (beyond scope of source address):
                         Set Code to 1 (host unreachable).  Note that this
                         error is very unlikely since the IPv4-translatable
                         source address is considered to have global scope.

                  Code 3 (address unreachable):
                         Set Code to 1 (host unreachable).

                  Code 4 (port unreachable):
                         Set Code to 3 (port unreachable).

            Packet Too Big (Type 2)
               Translate to an ICMPv4 Destination Unreachable with code 4.
               The MTU field needs to be adjusted for the difference between
               the IPv4 and IPv6 header sizes taking into account whether or
               not the packet in error includes a Fragment header.

            Time Exceeded (Type 3)
               Set the Type to 11.  The Code field is unchanged.

            Parameter Problem (Type 4)
               If the Code is 1 translate this to an ICMPv4 protocol
               unreachable (Type 3, Code 2).  Otherwise set the Type to 12
               and the Code to zero.  The Pointer needs to be updated to
               point to the corresponding field in the translated include IP
               header.

            Unknown error messages
               Silently drop.

http://www.cs.washington.edu/research/networking/napt/reports/usenix98/

A.4 Translating ICMPv6 to ICMPv4

         Parameter Problem (Type 4):
         If the Code is 2 then set Type to 12, Code to 0, and Pointer to -1.
         If the Code is 1 translate this to an ICMPv4 protocol unreachable
         (Type 3, Code 2) message.
         If the Code is 0 then set the Type to 12, the Code to 0, and
         translate the Pointer values as follows:
         0-to-0, 4-to-2, 7-to-8, 6-to-9, 8-to-12, 24-to-16, and for all
         other ICMPv6 Pointer values set the ICMPv4 Pointer value to -1.

# SEE ALSO

            perldoc V6evalTool