# NAME

recvNaRFlag - Verifying that a IsRouter flag is modified by a NA

# TARGET

Host only

# SYNOPSIS

     recvNaRFlag .seq [-tooloption ...] -p recvNaRFlag.def

# INITIALIZATION

1. Set the state of neighbor cache entry to REACHABLE whose IsRouter flag is true.
2. Cache either TN's LLA or a bogus LLA

## Cache a LLA of TN

      TN                 NUT
      ----------------------

      State: NONCE (for TN)

      ==== unsolicited RA ===>
           src=TN's link-local
           dst=all-node
           M=0, O=0
           RouterLifetime=600
           ReachableTime=0
           RetransTimer=0
           Prefix Option:
               L=1, A=1
    	   ValidLifetime=2592000
    	   PreferredLifetime=604800
               Prefix=3ffe:501:ffff:100::/64

      <=== Ns for DAD ====
           src=unspecified
           dst=solicited-node[NUT's global]
           target=NUT's global

      State: INCOMPLETE (for TN)

      <=== multicast NS ====
           src=NUT's link-local
           dst=solicited-node[TN's link-local]
           target=TN's link-local
           w/ SLLA
           timeout=RETRANS_TIMER * MAX_MULTICAST_SOLICIT

      ==== solicited NA ===>
           src=TN's link-local
           dst=NUT's link-local
           R=1, S=1, O=1
           target=TN's link-local
           TLLA=TN's LLA

      State: REACHABLE (for TN)

## Cache a bogus LLA

      TN                 NUT
      ----------------------

      State: NONCE (for TN)

      ==== unsolicited RA ===>
           src=TN's link-local
           dst=all-node
           M=0, O=0
           RouterLifetime=600
           ReachableTime=0
           RetransTimer=0
           Prefix Option:
               L=1, A=1
    	   ValidLifetime=2592000
    	   PreferredLifetime=604800
               Prefix=3ffe:501:ffff:100::/64

      <=== Ns for DAD ====
           src=unspecified
           dst=solicited-node[NUT's global]
           target=NUT's global

      State: INCOMPLETE (for TN)

      <=== multicast NS ====
           src=NUT's link-local
           dst=solicited-node[TN's link-local]
           target=TN's link-local
           w/ SLLA
           timeout=RETRANS_TIMER * MAX_MULTICAST_SOLICIT

      ==== solicited NA ===>
           src=TN's link-local
           dst=NUT's link-local
           R=1, S=1, O=1
           target=TN's link-local
           TLLA=a bogus LLA

      State: REACHABLE (for TN)

# TEST PROCEDURE

recvNaRFlag verifies that a IsRouter flag is modified by a NA. in REACHABLE state when receiving an NA.

#

#

#

#

#

      TN                 NUT
      ----------------------

      State: REACHABLE (for TN)

      ==== NA ===>
           src=TN's link-local
           dst=the NUT's link-local or all-node
           R=0, S=0/1, O=0/1
           Target=TN's link-local
           w/ or w/o TLL

      ==== echo-request ===>
           src=off-link global, but LLA is TN's one
           dst=NUT's global

      <=== Judgment #2: echo-reply ====
           src=NUT's global
           dst=off-link global, but LLA is TN's one

    JUDGMENT

      1. Modification of the IsRouter flag depend upon both
         its neighbor cache state and a NS.

      =========+================================+=================
      Current  |NA received by NUT              |IsRouter flag
      State    +---------------+-+--+-+---------+-------+---------
               |Destination    |r| s|o|TLLA     |Current|New
      =========+===============+=+==+=+=========+=======+=========
      REACHABLE Unicast         0  0 0 none      1       0
               +---------------+-+--+-+---------+-------+---------
                Unicast         0  0 1 none      1       0
               +---------------+-+--+-+---------+-------+---------
                Unicast         0  1 0 none      1       0
               +---------------+-+--+-+---------+-------+---------
                Unicast         0  1 1 none      1       0
               +===============+=+==+=+=========+=======+=========
                Unicast         0  0 0 same      1       0
               +---------------+-+--+-+---------+-------+---------
                Unicast         0  0 1 same      1       0
               +---------------+-+--+-+---------+-------+---------
                Unicast         0  1 0 same      1       0
               +---------------+-+--+-+---------+-------+---------
                Unicast         0  1 1 same      1       0
               +===============+=+==+=+=========+=======+=========
                Unicast         0  0 0 different 1       unchanged
               +---------------+-+--+-+---------+-------+---------
                Unicast         0  0 1 different 1       0
               +---------------+-+--+-+---------+-------+---------
                Unicast         0  1 0 different 1       unchanged
               +---------------+-+--+-+---------+-------+---------
                Unicast         0  1 1 different 1       0
               +===============+=+==+=+=========+=======+=========
                *Multicast      0  0 0 *none     1       unchanged
                                *invalid?
               +---------------+-+--+-+---------+-------+---------
                *Multicast      0  0 1 *none     1       unchanged
                                *invalid?
               +---------------+-+--+-+---------+-------+---------
                *Multicast      0 *1 0 *none     1       unchanged
                                *invalid
               +---------------+-+--+-+---------+-------+---------
                *Multicast      0 *1 1 *none     1       unchanged
                                invalid
               +===============+=+==+=+=========+=======+=========
                Multicast       0  0 0 same      1       0
               +---------------+-+--+-+---------+-------+---------
                Multicast       0  0 1 same      1       0
               +---------------+-+--+-+---------+-------+---------
                *Multicast      0 *1 0 same      1       unchanged
                                *invalid
               +---------------+-+--+-+---------+-------+---------
                *Multicast      0 *1 1 same      1       unchanged
                                *invalid
               +===============+=+==+=+=========+=======+=========
                Multicast       0  0 0 different 1       unchanged
               +---------------+-+--+-+---------+-------+---------
                Multicast       0  0 1 different 1       0
               +---------------+-+--+-+---------+-------+---------
                *Multicast      0 *1 0 different 1       unchanged
                                *invalid
               +---------------+-+--+-+---------+-------+---------
                *Multicast      0 *1 1 different 1       unchanged
                                *invalid
      =========+===============+=+==+=+=========+=======+=========

      2. If a IsRouter flag is modified by rule, NUT will NOT throw
         an echo-reply to the default router (i.e. TN).

    TERMINATION

      Send RA with RouterLifetime=0 to clear the Default Router List.

    NOTE

      1. The test does not invoke any remote command.

      2. An implementation may update Rflag of an NCE when receiving
         an multicast NA w/o TLL. The NA is not invalid as a receiver side,
         whereas it is invalid as a sender side (please see the following).
         In such case, this test judges "WARN" that never means the implementation
         is wrong. The test intends to inform such behavior.

    Sender side:

    4.4.  Neighbor Advertisement Message Format

       Possible options:

          Target link-layer address
                         The link-layer address for the target, i.e., the
                         sender of the advertisement.  This option MUST be
                         included on link layers that have addresses when
                         responding to multicast solicitations.  When
                         responding to a unicast Neighbor Solicitation this
                         option SHOULD be included.

    Receiver side:

    7.1.2.  Validation of Neighbor Advertisements

       A node MUST silently discard any received Neighbor Advertisement
       messages that do not satisfy all of the following validity checks:

          - 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 24 or more octets.

          - Target Address is not a multicast address.

          - If the IP Destination Address is a multicast address the
            Solicited flag is zero.

          - All included options have a length that is greater than zero.

    REFERENCE
    RFC2461

    7.2.5.  Receipt of Neighbor Advertisements

       When a valid Neighbor Advertisement is received (either solicited or
       unsolicited), the Neighbor Cache is searched for the target's entry.
       If no entry exists, the advertisement SHOULD be silently discarded.
       There is no need to create an entry if none exists, since the
       recipient has apparently not initiated any communication with the
       target.

       Once the appropriate Neighbor Cache entry has been located, the
       specific actions taken depend on the state of the Neighbor Cache
       entry, the flags in the advertisement and the actual link-layer
       address supplied.

         IF(State == INCOMPLETE) {
             If the target's Neighbor Cache entry is in the INCOMPLETE state when
             the advertisement is received, one of two things happens.  If the
             link layer has addresses and no Target Link-Layer address option is
             included, the receiving node should silently discard the received
             advertisement.  Otherwise, the receiving node performs the following
             steps:

             - It records the link-layer address in the Neighbor Cache entry.

             - If the advertisement's Solicited flag is set, the state of the
               entry is set to REACHABLE, otherwise it is set to STALE.

             - It sets the IsRouter flag in the cache entry based on the Router
               flag in the received advertisement.

             - It sends any packets queued for the neighbor awaiting address
               resolution.

             Note that the Override flag is ignored if the entry is in the
             INCOMPLETE state.
         } ELSIF(State != INCOMPLETE) {
             If the target's Neighbor Cache entry is in any state other than
             INCOMPLETE when the advertisement is received, processing becomes
             quite a bit more complex.

             IF(Override==0 && TLLA!=LLA) {
                 If the Override flag is clear and the supplied link-layer
                 address differs from that in the cache, then one of two
                 actions takes place:

                 IF(REACHABLE) {
                     if the state of the entry is REACHABLE, set it to STALE,
                     but do not update the entry in any other way;
                 } ELSE {
                     otherwise, the received advertisement should be ignored
                     and must not update the cache.
                 }
             } ELSIF(Override==1 ||
                     (Override==0 && TLLA==LLA) ||
                     TLLA==NULL) {
                 If the Override flag is set, both the Override
                 flag is clear and the supplied link-layer address is the same as that
                 in the cache, or no Target Link-layer address option was supplied,
                 the received advertisement must update the Neighbor Cache entry as
                 follows:

                 - The link-layer address in the Target Link-Layer Address option
                   must be inserted in the cache (if one is supplied and is different
                   than the already recorded address).

                 - If the Solicited flag is set, the state of the entry must be set
                   to REACHABLE.  If the Solicited flag is zero and the link-layer
                   address was updated with a different address the state must be set
                   to STALE.  Otherwise, the entry's state remains unchanged.

                 An advertisement's Solicited flag should only be set if the
                 advertisement is a response to a Neighbor Solicitation.  Because
                 Neighbor Unreachability Detection Solicitations are sent to the
                 cached link-layer address, receipt of a solicited advertisement
                 indicates that the forward path is working.  Receipt of an
                 unsolicited advertisement, however, suggests that a neighbor has
                 urgent information to announce (e.g., a changed link-layer
                 address).  If the urgent information indicates a change from what
                 a node is currently using, the node should verify the reachability
                 of the (new) path when it sends the next packet.  There is no need
                 to update the state for unsolicited advertisements that do not
                 change the contents of the cache.

                 - The IsRouter flag in the cache entry must be set based on the
                   Router flag in the received advertisement.  In those cases where
                   the IsRouter flag changes from TRUE to FALSE as a result of this
                   update, the node must remove that router from the Default Router
                   List and update the Destination Cache entries for all destinations
                   using that neighbor as a router as specified in Section 7.3.3.
                   This is needed to detect when a node that is used as a router
                   stops forwarding packets due to being configured as a host.
             }
         }

    SEE ALSO

      perldoc V6evalTool
      perldoc V6evalRemote