* recv on nfq_fd receiving wrong number of bytes
@ 2009-02-18 18:52 Nick Martin
0 siblings, 0 replies; 2+ messages in thread
From: Nick Martin @ 2009-02-18 18:52 UTC (permalink / raw)
To: netfilter
Hi all,
The situation is:
I have a test set up that sends a UDP packet containing "Hello" to a
host. There is a rule that queues traffic to this host. Using wireshark
when sending such a packet when it is not being queued shows that it
should be either 48,34,20, or 6 bytes long (depending on which parts of
the frame are received from a netfilter_queue fd, maybe somebody could
explain that to me?).
The problem is:
recv returns 4 when receiving from the socket, which is too small to be
anything. It only returns 4 when a packet it queued. When no packet is
queued it returns -1 and sets errno to EAGAIN.
I'm obviously doing something wrong but I don't know what. This is what
I've done before I call recv():
1) open a connection to netfilter_queue with nfq_open()
2) unbind, then bind the connection to AF_INET
3) create a queue (queue 0)
4) set the mode to NFNL_COPY_PACKET
5) get a file descriptor for the netfilter_queue connection
6) allocate space for my packet and payload buffers
7) recv from the socket
Here's my code:
http://pastebin.com/m5c702182
And the test script I'm using:
http://pastebin.com/m63ad9715
If anybody has any ideas what might be going on or any good ways to find
out whats going on I'd appreciate it. Thanks for any help guys.
Regards,
Nick Martin
^ permalink raw reply [flat|nested] 2+ messages in thread
* recv on nfq_fd receiving wrong number of bytes
@ 2009-02-18 19:07 Nick Martin
0 siblings, 0 replies; 2+ messages in thread
From: Nick Martin @ 2009-02-18 19:07 UTC (permalink / raw)
To: netfilter
Hi all,
The situation is:
I have a test set up that sends a UDP packet containing "Hello" to a
host. There is a rule that queues traffic to this host. Using wireshark
when sending such a packet when it is not being queued shows that it
should be either 48,34,20, or 6 bytes long (depending on which parts of
the frame are received from a netfilter_queue fd, maybe somebody could
explain that to me?).
The problem is:
recv returns 4 when receiving from the socket, which is too small to be
anything. It only returns 4 when a packet it queued. When no packet is
queued it returns -1 and sets errno to EAGAIN.
I'm obviously doing something wrong but I don't know what. This is what
I've done before I call recv():
1) open a connection to netfilter_queue with nfq_open()
2) unbind, then bind the connection to AF_INET
3) create a queue (queue 0)
4) set the mode to NFNL_COPY_PACKET
5) get a file descriptor for the netfilter_queue connection
6) allocate space for my packet and payload buffers
7) recv from the socket
Here's my code:
http://pastebin.com/m5c702182
And the test script I'm using:
http://pastebin.com/m63ad9715
If anybody has any ideas what might be going on or any good ways to find
out whats going on I'd appreciate it. Thanks for any help guys.
Regards,
Nick Martin
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-02-18 19:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-18 19:07 recv on nfq_fd receiving wrong number of bytes Nick Martin
-- strict thread matches above, loose matches on Subject: below --
2009-02-18 18:52 Nick Martin
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.