libnetfilter_queue callback and verdict order

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

 



I am developing an application base on libnetfilter_queue to filter http traffic(CentOS 5.5 x86_64). 
In order to make full use of multi-CPU, I try to use a read thread(where recv and nfq_handle_packet 
are called) and several verdict threads(where nfq_set_verdict2 is called). 

My questions are:
Can the parameter value in cb(qh, nfmsg, nfa, data) function used in verdict thread? 
Can the packet be verdict without order?

Sample code:
packet_pool pkt_pool[verdict_thread_num];

static int cb(struct nfq_q_handle *qh, struct nfgenmsg *nfmsg, struct nfq_data *nfa, void *data)
{
    //packet dispatch
    return packet_dispatch(pkt_pool[verdict_thread_seq], qh, nfmsg, nfa, data);
}
 
static void *read_thread(void *fd)
{
    for (;;) 
    {
        recv(fd, buf, sizeof(buf), 0);
        nfq_handle_packet(h, buf, rv);
    }
}
 
static void *verdict_thread(void *fd)
{
    for (;;) 
    {
        get_packet_from_pool(verdict_thread_seq);
        nfq_set_verdict(qh, id, verdict, 0, NULL);
        // or nfq_set_verdict(qh, id, verdict, data, length);
    }
}?韬{.n?????%??檩??w?{.n???租??庄z_??n?■???h?璀?{?夸z罐?+€?zf"?????i?????_璁?:+v??撸?





[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux