I would like to suggest few small changes in the hifn(4) driver:
Please see the attached patch.
The main change is the use of a rwlock (sc->sc_sessions_lock) to protect the sessions.
We don't need to use the main driver lock for this. While i'm here, fix small others problems.
- Useless bzero of softc
- Return EBUSY if there is active session
- Free the sessions
- Use callout_drain() instead callout_stop()
- Remove the unused macro RANDOM_BITS
- Add and use a rwlock to lock the sessions (sc->sc_sessions_lock).
- Remove useless bzero of the sessions (use malloc with M_ZERO)
- Use arc4rand() instead read_random()
- Use a rwlock to lock the sessions
- Use a rwlock to lock the sessions. In the current driver there is
no lock to protect the sessions in hifn_process() but the sessions
can be reallocated in hifn_newsession().
I think this is the cause of PR kern/91407:
Anyway we should protect the sessions in hifn_process().
- Use a rwlock to lock the sessions.
I've tested on a Soekris vpn 1411 (hifn 7955) with ipsec and openssl.
(with big thanks to Mike Tancsa)
Fix: Patch attached with submission follows:
For bugs matching the following criteria:
Status: In Progress Changed: (is less than) 2014-06-01
Reset to default assignee and clear in-progress tags.
Mail being skipped