hifn(4) few small changes

Patrick Lamaizière patfbsd at davenulle.org
Thu Jan 1 18:31:06 UTC 2009


Hello and happy new year,

I would like to suggest few changes in the hifn driver:

diff between CURRENT:
http://user.lamaiziere.net/patrick/hifn-010109/hifn-patch.txt

hifn_attach()
- Useless bzero of softc

hifn_detach()
- Return EBUSY if there is active session
- Free the sessions
- Use callout_drain() instead callout_stop()

hifn_rng()
- Remove the unused macro RANDOM_BITS

hifn_newsession()
- 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()

hifn_freesession()
- Use a rwlock to lock the sessions

hifn_process()
- 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 http://www.FreeBSD.org/cgi/query-pr.cgi?pr=kern/91407

hifn_callback()
- Use a rwlock to lock the sessions.

I've tested on a Soekris vpn 1411 (hifn 7955) with ipsec and openssl.

Regards.
(With big thanks to Mike Tancsa)


More information about the freebsd-hackers mailing list