# NAME

ncStateByNa4Stale - Verifying State Machine: NA vs. STALE

# TARGET

Host and Router

# SYNOPSIS

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

# INITIALIZATION

1. Set the state of neighbor cache entry to STALE.
2. Cache either TN's LLA or a bogus LLA.

## Cache a LLA of TN

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

      State: NONCE (for TN)

      ==== echo-request ===>
            src=TN's link-local
            dst=NUT's link-local

      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
            target=TN's link-local
            TLLA=TN's LLA

      State: REACHABLE (for TN)

      <=== echo-reply ====
            src=NUT's link-local
            dst=TN's link-local
            timeout: 2 sec

      Wait (REACHABLE_TIME * MAX_RANDOM_FACTOR)

      State: STALE (for TN)

## Cache a bogus LLA

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

      State: NONCE (for TN)

      ==== echo-request ===>
            src=TN's link-local
            dst=NUT's link-local

      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
            target=TN's link-local
            TLLA=a bogus LLA

      State: REACHABLE (for TN)

      <=== echo-reply ====
            src=NUT's link-local
            dst=TN's link-local
            timeout: 2 sec

      Wait (REACHABLE_TIME * MAX_RANDOM_FACTOR)

      State: STALE (for TN)

# TEST PROCEDURE

ncStateByNa4Stale verifies that state transition for a NUT in STALE state when receiving a NA.

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

      State: STALE  (for TN)

      ==== NA ===>
            src=TN's link-local
            dst=NUT's link-local or all-node
            w/o or w/ TLLA
            r=0, s=0/1, o=0/1

      Judgment: Examining NUT's neighbor cache state

# JUDGMENT

    7.2.5.  Receipt of Neighbor Advertisements

         IF(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(Solicited flag==1) {
                       If the Solicited flag is set, the state of the entry must be set
                       to REACHABLE.
                   }
                   ELSIF(Solicited flag==0 && TLLA!=LLA) {
                       If the Solicited flag is zero and the link-layer
                       address was updated with a different address the state must be set
                       to STALE.
                   }
                   ELSE {
                       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.
             }
         }

      ================================+===============+=============
      NA                              |New State      |cached LLA
      ---------------+-+--+-+---------+               |
      Destination    |r| s|o|TLLA     |               |
      ===============+=+==+=+=========+===============+=============
      Unicast         0  0 0 none      STALE           unchanged
      ---------------+-+--+-+---------+---------------+-------------
      Unicast         0  0 1 none      STALE           unchanged
      ---------------+-+--+-+---------+---------------+-------------
      Unicast         0  1 0 none      REACHABLE       unchanged
      ---------------+-+--+-+---------+---------------+-------------
      Unicast         0  1 1 none      REACHABLE       unchanged
      ===============+=+==+=+=========+===============+=============
      Unicast         0  0 0 same      STALE           unchanged
      ---------------+-+--+-+---------+---------------+-------------
      Unicast         0  0 1 same      STALE           unchanged
      ---------------+-+--+-+---------+---------------+-------------
      Unicast         0  1 0 same      REACHABLE       unchanged
      ---------------+-+--+-+---------+---------------+-------------
      Unicast         0  1 1 same      REACHABLE       unchanged
      ===============+=+==+=+=========+===============+=============
      Unicast         0  0 0 different STALE           unchanged
      ---------------+-+--+-+---------+---------------+-------------
      Unicast         0  0 1 different STALE           *updated
      ---------------+-+--+-+---------+---------------+-------------
      Unicast         0  1 0 different STALE           unchanged
      ---------------+-+--+-+---------+---------------+-------------
      Unicast         0  1 1 different REACHABLE       *updated
      ===============+=+==+=+=========+===============+=============
      *Multicast      0  0 0 *none     STALE           unchanged
                      *invalid
      ---------------+-+--+-+---------+---------------+-------------
      *Multicast      0  0 1 *none     STALE           unchanged
                      *invalid
      ---------------+-+--+-+---------+---------------+-------------
      *Multicast      0 *1 0 *none     STALE           unchanged
                      *invalid
      ---------------+-+--+-+---------+---------------+-------------
      *Multicast      0 *1 1 *none     STALE           unchanged
                      *invalid
      ===============+=+==+=+=========+===============+=============
      Multicast       0  0 0 same      STALE           unchanged
      ---------------+-+--+-+---------+---------------+-------------
      Multicast       0  0 1 same      STALE           unchanged
      ---------------+-+--+-+---------+---------------+-------------
      *Multicast      0 *1 0 same      STALE           unchanged
                      *invalid
      ---------------+-+--+-+---------+---------------+-------------
      *Multicast      0 *1 1 same      STALE           unchanged
                      *invalid
      ===============+=+==+=+=========+===============+=============
      Multicast       0  0 0 different STALE           unchanged
      ---------------+-+--+-+---------+---------------+-------------
      Multicast       0  0 1 different STALE           *updated
      ---------------+-+--+-+---------+---------------+-------------
      *Multicast      0 *1 0 different STALE           unchanged
                      *invalid
      ---------------+-+--+-+---------+---------------+-------------
      *Multicast      0 *1 1 different STALE           unchanged
                      *invalid
      ===============+=+==+=+=========+===============+=============

# TERMINATION

      N/A

# NOTE

      The test does not invoke any remote command.

# SEE ALSO

      perldoc V6evalTool
      perldoc V6evalRemote