QUEUE Target

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

 



I am trying to copy IP packet to user-land application using QUEUE
target in netfilter.

So far I am able to read packet headers but I am not sure if I am
getting the payload.

nfq_get_payload() returns correct size of the packet but I don't find
anything in data. I used both strlen and sizeof to check the size of
data but it always returns 1 or is there better way to check.

I am running Ubuntu 8.10 server on x86.

 Here is what I have done so far:

main():
   nfq_bind_pf(h, AF_INET);
   qh = nfq_create_queue(h,  0, &cb, NULL);
   nh = nfq_nfnlh(h);
   fd = nfnl_fd(nh);
   nfq_set_mode(qh, NFQNL_COPY_PACKET, 0xffff)


static int cb(struct nfq_q_handle *qh, struct nfgenmsg *nfmsg,
              struct nfq_data *nfa, void *data)
{
        char *payloadData;
        int ret;

        ret = nfq_get_payload(nfa, &payloadData);
        printf("Len %d of data is: %d \n", ret, strlen(payloadData));

        u_int32_t id = print_pkt(nfa);

        return nfq_set_verdict(qh, id, NF_ACCEPT, 0, NULL);
}

Can anyone please point me what I am missing here ?

Thanks,
Bikrant
--
To unsubscribe from this list: send the line "unsubscribe netfilter" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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