Hello,
Unloading a network kernel extension that registers a socket filter can only be safely done once the sf_unregistered function has been called by the stack in response to a previous call to sflt_unregister from the kext.
Thus, when my kext is requested to unload, I first unregister the filter, then I do various cleanup (to gain some time). Eventually, I check wether or not sf_unregistered has been called. Unfortunately, most of the time it has not. But the timing is really close since sending two unload request in a row (from the terminal) is enough to get a 100% unload success rate on the second attempt. Bottom line, I should have waited a little longer to give sf_unregistered a chance to be called.
Now, I have a few options:
- I could use msleep (the would originate from the sf_unregistered function). - I could spin in a tight while loop (is it over yet ? is it over yet ? …) with a timeout exit condition (a few ms for instance). - Other suggestions on how to deal with this kind of situation...
What do you think ?
Jean
Jean Suisse Institut de Chimie Moléculaire de l’Université de Bourgogne (ICMUB) — UMR 6302 U.F.R. Sciences et Techniques, Bâtiment Mirande Aile B, bureau 411 9, avenue Alain Savary — B.P. 47870 21078 DIJON CEDEX |