* hook function in NF_IP_LOCAL_IN does not interruptible_sleep_on?
@ 2002-09-15 11:13 Kim Jong Tae
2002-09-15 14:05 ` Anders Fugmann
2002-09-16 3:18 ` James Morris
0 siblings, 2 replies; 4+ messages in thread
From: Kim Jong Tae @ 2002-09-15 11:13 UTC (permalink / raw)
To: netfilter
Hi all.
I makes hook function, which will communicate with user process
for each packet's arrival.
First, hook function sends data to user process and user process sends
back data. I think that before receiving data from user process, hook
function must wait. hook func's wait is using interruptible_sleep_on.
When hook func call interruptible_sleep_on, system hangs!!!
code is below .
static unsigned int
enpia_dr_in(unsigned int hooknum,
struct sk_buff **skb_p,
const struct net_device *in,
const struct net_device *out,
int (*okfn)(struct sk_buff *))
{
....
interruptible_sleep_on(waitq)
/* this point system hangs, and console prints "killing interrupt
handler " */
...
}
static struct nf_hook_ops in_ops = {
{ NULL, NULL },
hook_func, PF_INET, NF_IP_LOCAL_IN, 100
};
When hook fuction goes to interruptible_sleep_on, linux is down.
Same result comes when udp sock communication instead of
nf_register_sockopt.
Why this happens?
Is there a method to wait for some condition in netfilter hook func in
linux kernel?
If it is impossible, is there another methods to communicate user process?
any comment is appreciate!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: hook function in NF_IP_LOCAL_IN does not interruptible_sleep_on?
2002-09-15 11:13 hook function in NF_IP_LOCAL_IN does not interruptible_sleep_on? Kim Jong Tae
@ 2002-09-15 14:05 ` Anders Fugmann
2002-09-16 0:58 ` Kim Jong Tae
2002-09-16 3:18 ` James Morris
1 sibling, 1 reply; 4+ messages in thread
From: Anders Fugmann @ 2002-09-15 14:05 UTC (permalink / raw)
To: Kim Jong Tae; +Cc: netfilter
Kim Jong Tae wrote:
> Hi all.
>
> I makes hook function, which will communicate with user process
> for each packet's arrival.
> First, hook function sends data to user process and user process sends
> back data. I think that before receiving data from user process, hook
> function must wait. hook func's wait is using interruptible_sleep_on.
> When hook func call interruptible_sleep_on, system hangs!!!
You are calling sleep in_interrupt. This is not allowed.
You forgot to mention how you cummunicate with the userspace process.
Throgh a device-node?
Regards
Anders Fugmann
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: hook function in NF_IP_LOCAL_IN does not interruptible_sleep_on?
2002-09-15 14:05 ` Anders Fugmann
@ 2002-09-16 0:58 ` Kim Jong Tae
0 siblings, 0 replies; 4+ messages in thread
From: Kim Jong Tae @ 2002-09-16 0:58 UTC (permalink / raw)
To: Anders Fugmann; +Cc: netfilter
On Sun, 15 Sep 2002, Anders Fugmann wrote:
>Kim Jong Tae wrote:
>> Hi all.
>>
>> I makes hook function, which will communicate with user process
>> for each packet's arrival.
>> First, hook function sends data to user process and user process sends
>> back data. I think that before receiving data from user process, hook
>> function must wait. hook func's wait is using interruptible_sleep_on.
>> When hook func call interruptible_sleep_on, system hangs!!!
>You are calling sleep in_interrupt. This is not allowed.
I want to make hook func sleep , Is there any solution to avoid
problems?
>
>You forgot to mention how you cummunicate with the userspace process.
>Throgh a device-node?
I made that communication which is implemented by
setsockopts and getsockopts func registered by
nf_register_sockopt.
From kernel to user app, getsockopt works well.
From user app to kernel , setsockopt does not work because kernel
does not wait.
Eventually I want to route incoming packet by using DR (direct routing)
technique according to anther machine's policy.
It necessary to communicate with another machine's user application.
It will be implemeted by UDP/ TCP socket code.
>
>Regards
>Anders Fugmann
>
>
>
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: hook function in NF_IP_LOCAL_IN does not interruptible_sleep_on?
2002-09-15 11:13 hook function in NF_IP_LOCAL_IN does not interruptible_sleep_on? Kim Jong Tae
2002-09-15 14:05 ` Anders Fugmann
@ 2002-09-16 3:18 ` James Morris
1 sibling, 0 replies; 4+ messages in thread
From: James Morris @ 2002-09-16 3:18 UTC (permalink / raw)
To: Kim Jong Tae; +Cc: netfilter
On Sun, 15 Sep 2002, Kim Jong Tae wrote:
>
> Why this happens?
You can't sleep in interrupt context.
> If it is impossible, is there another methods to communicate user process?
Have you looked at the ip_queue module? It uses asynchronous techniques.
- James
--
James Morris
<jmorris@intercode.com.au>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-09-16 3:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-09-15 11:13 hook function in NF_IP_LOCAL_IN does not interruptible_sleep_on? Kim Jong Tae
2002-09-15 14:05 ` Anders Fugmann
2002-09-16 0:58 ` Kim Jong Tae
2002-09-16 3:18 ` James Morris
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.