ccnd Nonce handling

This document describes how ccnd 0.7.2 handles Nonce.

Global Nonce table

nonce_ok function performs lookup and insertion on the global Nonce table ccnd_handle.nonce_tab.
It has four possible return values beside error condition:

  • 0: Nonce is duplicate, and this Nonce first comes from a different face
  • 1: Nonce is new
  • 2: Nonce is duplicate, and this Nonce first comes from the same face
  • 3: Interest has no Nonce

An entry in the global Nonce table expires after 6 seconds (hard-coded).
If a duplicate Nonce is detected, its expiration time is reset to be 6 seconds after current time, but the incoming face is unchanged.

Having a global Nonce table implies that Nonces can be compared across all Interest passing through ccnd, instead of just those Interests with same Name and Selectors.

Loop Detection

Loop detection is based solely on the global Nonce table.

process_incoming_interest calls nonce_ok with the Interest packet.
This implies that the global Nonce table contains Nonces from incoming Interests.

An incoming Interest is considered to be looped if nonce_ok returns 0.
The return value 1 (duplicate from same face) is considered a refresh and not a loop. This is potentially unsafe, but ccnd's strategy only forwards new Interests, and won't forward the refresh Interest again.

Nonces in Outgoing Interests

In propagate_interest, if the outgoing Interest has no Nonce field, a random Nonce is generated, and nonce_ok is called to record this Nonce.
Therefore, the global Nonce list contains not only Nonces from incoming Interests, but also Nonces from outgoing Interests.

Updated by Junxiao Shi almost 6 years ago · 1 revisions