doubts about nf_register_queue_handler!!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi guys, i'm writing a netfilter module which must
enqueue packets in different queues and reinject each
one of them according to my decisions... but i have
some doubts.... 

module--------------------------------------
unsigned int hook_func_11(unsigned int hooknum,
                       struct sk_buff **skb,
                       const struct net_device *in,
                       const struct net_device *out,
                       int (*okfn)(struct sk_buff*))
{
    if (strcmp(in->name, interface_LAN) == 0)
    { return NF_ACCEPT; }
    if (strcmp(in->name, interface_WAN) == 0)
    { return NF_ACCEPT; }
    if (strcmp(in->name, interface_loopback) == 0)
    { return NF_QUEUE; }
    else
    { return NF_DROP; }
}      

unsigned int hook_func_41(unsigned int hooknum,
                       struct sk_buff **skb,
                       const struct net_device *in,
                       const struct net_device *out,
                       int (*okfn)(struct sk_buff*))
{
    return NF_ACCEPT;
}

int init_module(void)
{
    hook_1.hook     = hook_func_11;
    hook_1.hooknum  = NF_IP_PRE_ROUTING;
    hook_1.pf       = PF_INET;
    hook_1.priority = NF_IP_PRI_FIRST;
    
    hook_4.hook     = hook_func_41;
    hook_4.hooknum  = NF_IP_POST_ROUTING;
    hook_4.pf       = PF_INET;
    hook_4.priority = NF_IP_PRI_FIRST;
            
    nf_register_hook(&hook_1);
    nf_register_hook(&hook_4);
            
    return 0;
}

void cleanup_module(void)
{
    nf_unregister_hook(&hook_1);
    nf_unregister_hook(&hook_4);
}
---------------------------------------------

I've registered two hooks (NF_IP_PRE_ROUTING and
NF_IP_POST_ROUTING), but one of them enqueue some
packets (return NF_QUEUE)..... I know at this point,
all queued packets are dropped!, because no-one is
registered to handle queued packets...... and for
register interest in queued packets i must use
nf_register_queue_handler() and
nf_unregister_queue_handler()...

In "Processing queued packets - Netfilter hacking
howto" you wrote: you must register interest
in queued packets and then they begin queueing.  Can
you please explain me how do i do that? what happens
with packets when they're queued? where are they
stored? 

I've seen nf_register_queue_handler declarated in
netfilter.h, but i haven't seen it defined nowhere...
please, how must i register some queue_handlers in my
module (one per protocol)? Thanks for help!!!

Raul Rodriguez


	
	
		
______________________________________________ 
LLama Gratis a cualquier PC del Mundo. 
Llamadas a fijos y móviles desde 1 céntimo por minuto. 
http://es.voice.yahoo.com


[Index of Archives]     [Linux Netfilter Development]     [Linux Kernel Networking Development]     [Netem]     [Berkeley Packet Filter]     [Linux Kernel Development]     [Advanced Routing & Traffice Control]     [Bugtraq]

  Powered by Linux