CcndNonce » History » Version 1
Junxiao Shi, 08/30/2014 08:54 AM
| 1 | 1 | Junxiao Shi | # ccnd Nonce handling |
|---|---|---|---|
| 2 | |||
| 3 | This document describes how ccnd 0.7.2 handles Nonce. |
||
| 4 | |||
| 5 | ## Global Nonce table |
||
| 6 | |||
| 7 | `nonce_ok` function performs lookup and insertion on the global Nonce table `ccnd_handle.nonce_tab`. |
||
| 8 | It has four possible return values beside error condition: |
||
| 9 | |||
| 10 | * 0: Nonce is duplicate, and this Nonce first comes from a different face |
||
| 11 | * 1: Nonce is new |
||
| 12 | * 2: Nonce is duplicate, and this Nonce first comes from the same face |
||
| 13 | * 3: Interest has no Nonce |
||
| 14 | |||
| 15 | An entry in the global Nonce table expires after 6 seconds (hard-coded). |
||
| 16 | If a duplicate Nonce is detected, its expiration time is reset to be 6 seconds after current time, but the incoming face is unchanged. |
||
| 17 | |||
| 18 | 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. |
||
| 19 | |||
| 20 | ## Loop Detection |
||
| 21 | |||
| 22 | Loop detection is based solely on the global Nonce table. |
||
| 23 | |||
| 24 | `process_incoming_interest` calls `nonce_ok` with the Interest packet. |
||
| 25 | This implies that the global Nonce table contains Nonces from incoming Interests. |
||
| 26 | |||
| 27 | An incoming Interest is considered to be looped if `nonce_ok` returns 0. |
||
| 28 | The return value 1 (duplicate from same face) is considered a refresh and not a loop. This is potentially unsafe, but [[CcndStrategy|ccnd's strategy]] only forwards new Interests, and won't forward the refresh Interest again. |
||
| 29 | |||
| 30 | ## Nonces in Outgoing Interests |
||
| 31 | |||
| 32 | 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. |
||
| 33 | Therefore, the global Nonce list contains not only Nonces from incoming Interests, but also Nonces from outgoing Interests. |