reference counting matches / ipt_pool

Rusty Russell rusty@linuxcare.com.au
Wed, 19 Apr 2000 20:02:09 +0930


In message <20000418210518.7213.qmail@oknodo.bof.de> you write:
> match will be used in the filter table. I can increment a reference count
> on R in the check() function. The question is: where is the "uncheck"
> hook where I can decrement the reference once the match is deleted
> from the table?

<SIGH>.  Hi Patrick!

	This is the second person who said they wanted this
`destructor' capability back.  And here's me thinking I'm clever for
getting rid of it because *I* didn't need it.

Try the below patch.  A few things you might have to be aware of
(depending on your implementation):

1) On SMP, after checking we make a copy of the rules for every other CPU
   (see how ipt_limit handles this).

2) Every user operation does a complete replacement of the table, so
   don't be surprised.

3) If an invalid rule is inserted, then all the rules which have been
   `check()'ed up to that rule will have `destroy()' called on them.

Rusty.
--
Hacking time.