Find the answer to your Linux question:
Results 1 to 2 of 2
Hi all, I am writing a kernel module that hooks into netfilter. netfilter_ops.hook = main_hook; netfilter_ops.pf = PF_INET; netfilter_ops.hooknum = NF_IP_PRE_ROUTING; netfilter_ops.priority = NF_IP_PRI_FIRST; nf_register_hook(&netfilter_ops); In the main_hook function, I ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2008
    Posts
    1

    Netfilter module help


    Hi all,
    I am writing a kernel module that hooks into netfilter.
    netfilter_ops.hook = main_hook;
    netfilter_ops.pf = PF_INET;
    netfilter_ops.hooknum = NF_IP_PRE_ROUTING;
    netfilter_ops.priority = NF_IP_PRI_FIRST;
    nf_register_hook(&netfilter_ops);

    In the main_hook function, I needs to put the process to sleep and
    will be woken up by another process because the decision to Accept or
    Deny a packet depends on a process running in the user space. However,
    all sleeping mechanisms I tried cause the kernel hang. I tried msleep,
    wait_event_interrupt,wait_event_interrupt_timeout, ... (of course I
    have a process to wake up the main_hook process). I tested these
    sleeping machenisms in different modules and they worked fine. My
    question is can we make the process sleep in the main_hook function
    without causing the kernel hang and how to do it?
    Thank you very much.
    Tung.

  2. #2
    Just Joined! raj.aprilfool's Avatar
    Join Date
    Dec 2006
    Location
    Mumbai, India
    Posts
    36
    i just want to know ur purpose to put the module in the sleep... cause pkts on n/w interface r not gonna stop.... and whenever u give NF_QUEUE it'll queue it up and send it to userspace.... where u can process and pass the verdict down to kernel....

    also i want to ask u.... hv u tried capturing the pkts in multiple threads???

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •