ipfw initialization: SI_ORDER_ANY -> SI_ORDER_MIDDLE?

Luigi Rizzo luigi at onelab2.iet.unipi.it
Sun Mar 2 07:17:46 PST 2008


On Sun, Mar 02, 2008 at 03:49:39PM +0100, Paolo Pisati wrote:
> Hi,
> 
> i just found out that depending on a KLD doesn't imply any
> initialization order, thus depending on a lock initialized in the ipfw
> init path is _really_ a bad idea from another KLD init path (see
> ip_fw_nat.c::ipfw_nat_init()).
> 
> A fix would be to move ipfw init priority from SI_ORDER_ANY to
> SI_ORDER_MIDDLE, but i guess there are side effects that i'm
> unaware in this modification...

The SI_ORDER_* definitions in /sys/sys/kernel.h are enumerated on a
large range, so if the existing code does not have races,
you can safely move the non-leaf modules
(such as ipfw,ko in your case) to (SI_ORDER_ANY - some_small_integer)
without breaking anything.

If this change breaks something, it means that there was already a
race condition and you are just pointing it out  - so it is a
worthwhile change...

	cheers
	luigi


More information about the freebsd-net mailing list