# 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 translates ICMPv4 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 0)
       ICMPv6 (Type 1, Code 0)             <=  ICMPv4 (Type 3, Code 1)
       ICMPv6 (Type 4, Code 1)             <=  ICMPv4 (Type 3, Code 2)
       ICMPv6 (Type 1, Code 4)             <=  ICMPv4 (Type 3, Code 3)
       ICMPv6 (Type 2, Code 0, MTU 1028)   <=  ICMPv4 (Type 3, Code 4, MTU 1000)
       ICMPv6 (Type 2, Code 0, MTU 1006)   <=  ICMPv4 (Type 3, Code 4, MTU 0)
       ICMPv6 (Type 1, Code 0)             <=  ICMPv4 (Type 3, Code 5)
       ICMPv6 (Type 1, Code 0)             <=  ICMPv4 (Type 3, Code 6)
       ICMPv6 (Type 1, Code 0)             <=  ICMPv4 (Type 3, Code 7)
       ICMPv6 (Type 1, Code 0)             <=  ICMPv4 (Type 3, Code 8)
       ICMPv6 (Type 1, Code 1)             <=  ICMPv4 (Type 3, Code 9)
       ICMPv6 (Type 1, Code 1)             <=  ICMPv4 (Type 3, Code 10)
       ICMPv6 (Type 1, Code 0)             <=  ICMPv4 (Type 3, Code 11)
       ICMPv6 (Type 1, Code 0)             <=  ICMPv4 (Type 3, Code 12)
       Silently drop                       <=  ICMPv4 (Type 5, Code 0)
       Silently drop                       <=  ICMPv4 (Type 4, Code 0)
       ICMPv6 (Type 3, Code 1)             <=  ICMPv4 (Type 11, Code 1)
       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 7)  <=  ICMPv4 (Type 12, Code 0, Pointer 8)
       ICMPv6 (Type 4, Code 0, Pointer 6)  <=  ICMPv4 (Type 12, Code 0, Pointer 9)
       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)

# JUDGMENT

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

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

# NOTE

# REFERENCE

RFC2765

3.3. Translating ICMPv4 Headers into ICMPv6 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 ICMPv4 messages are:

          ICMPv4 error messages:

            Destination Unreachable (Type 3)
               For all that are not explicitly listed below set the Type to
               1.

               Translate the code field as follows:
                  Code 0, 1 (net, host unreachable):
                         Set Code to 0 (no route to destination).

                  Code 2 (protocol unreachable):
                         Translate to an ICMPv6 Parameter Problem (Type 4,
                         Code 1) and make the Pointer point to the IPv6 Next
                         Header field.

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

                  Code 4 (fragmentation needed and DF set):
                         Translate to an ICMPv6 Packet Too Big message (Type
                         2) with code 0.  The MTU field needs to be adjusted
                         for the difference between the IPv4 and IPv6 header
                         sizes.  Note that if the IPv4 router did not set
                         the MTU field i.e. the router does not implement
                         [PMTUv4], then the translator must use the plateau
                         values specified in [PMTUv4] to determine a likely
                         path MTU and include that path MTU in the ICMPv6
                         packet. (Use the greatest plateau value that is
                         less than the returned Total Length field.)

                  Code 5 (source route failed):
                         Set Code to 0 (no route to destination).  Note that
                         this error is unlikely since source routes are not
                         translated.

                  Code 6,7:
                         Set Code to 0 (no route to destination).

                  Code 8:
                         Set Code to 0 (no route to destination).

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

                  Code 11, 12:
                         Set Code to 0 (no route to destination).

            Redirect (Type 5)
               Single hop message.  Silently drop.

            Source Quench (Type 4)
               Obsoleted in ICMPv6.  Silently drop.

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

            Parameter Problem (Type 12)
               Set the Type field to 4.  The Pointer needs to be updated to
               point to the corresponding field in the translated include
               IP header.

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

A.3 Translating ICMPv4 to ICMPv6

         Parameter Problem (Type 12): set the Type field to 4 and translate
         the Pointer values as follows:
         0-to-0, 2-to-4, 8-to-7, 9-to-6, 12-to-8, 16-to-24, and for all other
         ICMPv4 Pointer values set the ICMPv6 Pointer value to -1.

# SEE ALSO

            perldoc V6evalTool