Skip to contentSkip to conversation

Help to schedule nf_register_hook

DISCUSSION Bruno Fiss 1 participant 1 message Apr 22, 2009

lore
Share & tools
lore

Bruno Fiss

author
#0 lore raw

Hi,

I want to schedule the registration of a hook. I tried using kernel's struct timer_list, but I've been having problems with that. I thought that maybe you are not supposed to call nf_register_hook from within a function that's been registered in a kernel timer (wonder if it has to do with being or not being in the userspace). I'd like some help on that.

I'll give an example of what I'm trying to do:

void foo () { 
        unsigned long parameter;
        ...
        DEFINE_TIMER( timer, secfoo, jiffies + 250, parameter);
        ...
        add_timer(timer);
}
void secfoo( unsigned long param ) {
        ...
        nf_register_hook(...);
        ...
}

If I comment the "add_timer(timer);", and put this line instead:

secfoo( parameter );

It works out as I intended. But if I do it like it is written, I get a kernel panic.

I realize this may be simple, or maybe foolish, but I've been wanting to solve this problem for a while. If this panic was not supposed to happen, then I'll try to give all the information possible about the problem.

Thanks in advance,

Bruno Fiss

Veja quais são os assuntos do momento no Yahoo! +Buscados
http://br.maisbuscados.yahoo.com