Subject: Re: Full story on PFIL_HOOKS rearrangement
To: None <itojun@iijlab.net>
From: Aidan Cully <aidan@kublai.com>
List: tech-net
Date: 11/11/2000 02:11:41
On Sat, Nov 11, 2000 at 01:00:35PM +0900, itojun@iijlab.net wrote:
>
> >I note that I'm not a kernel or networking guy, and acknowledge that
> >in practice this probably won't lose, but it strikes me as a mistake
> >to create a void * key by typecasting integers... It looks like the
> >void *'s are supposed to be globally unique? Taking the address of
> >a kernel variable buys you that automatically, but by using integers,
> >you'd need to verify each time you added a new integer key that it
> >doesn't clash with old keys.
>
> i don't think you have a clash with old keys. as we are using
> the address of the integer (not the value itself) there will be no
> collision.
>
> >extern int _pfil_inet4_key;
> >#define PFIL_INET4_KEY ((void *) &_pfil_inet4_key) <-- note ampersand
I think there's been a small misunderstanding... The _pfil_inet4_key
is mine. What Jason did was
pf_key = (void *) (u_long) AF_INET;
which can cause a clash. When I said "integer", I meant the
(void *) (u_long) typecast, rather than the (void *) &_actual_integer
thing I wrote.
--aidan