cozybit / authsae

Simultaneous Authentication of Equals: Unofficial official clone of the now stale http://sourceforge.net/projects/authsae
31 stars 28 forks source link

Delete timers before starting new ones #92

Closed ilyacodes closed 6 years ago

ilyacodes commented 6 years ago

In many cases, we start a new timeout with add_timeout without checking whether another timeout is already running. For timers defined by 802.11s (represented by candidate t0, t1, and t2 timers), this is not the correct behaviour – they expect a single timer to be running at a time.

Remove any existing timers with rem_timeout prior to add_timeouting a new timer setting.

Summary of behaviours:

  1. Previous timer id exists, timer running —> remove old one, create new one
  2. Previous timer id exists, timer expired —>
    1. case should not happen in authsae, timer id is deleted when timer expires
    2. other code using libsae MUST no-op removing an expired/non-existent timer
  3. Previous timer id = 0 —> timer id 0 is reserved by libsae, removing it is no-op per 2.ii above
bcopeland commented 6 years ago

Looks ok... I think if we transition to estab we should also kill any outstanding timers, but plink timer in ESTAB state is a no op so it doesn't actually matter. Would be nice to wrap delete+add in a helper function.