Bug 130286 - [patch] hifn(4) changes
Summary: [patch] hifn(4) changes
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 8.0-CURRENT
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2009-01-08 05:20 UTC by patfbsd
Modified: 2018-01-03 05:16 UTC (History)
0 users

See Also:

file.diff (7.35 KB, patch)
2009-01-08 05:20 UTC, patfbsd
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description patfbsd 2009-01-08 05:20:01 UTC
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:
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:01:34 UTC
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