Skip to contentSkip to conversation

QUEUE, large udp message failure

DISCUSSION Scott MacKay 2 participants 3 messages May 6, 2004 netfilter

lore
Share & tools
lore
#0 lore raw

Hello,

I have a custom QUEUE target, loaded in
POSTROUTING, intended to catch all outgoing packets. I have a large buffer allocated (64000 bytes) and start up the configuration with:
static unsigned char readBuffer[PACKET_SIZE_MAX];

s = ipq_create_handle(0, PF_INET);
status = ipq_set_mode(s, IPQ_COPY_PACKET,
PACKET_SIZE_MAX);

Where PACKET_SIZE_MAX is 64000. I have a normal ipq_read() loop using the readBuffer and it normally works fine, allowing me to do my stuff with the packet.
The problem comes in when I get a large message (tested was 24000 bytes). ipq_read fails. I added some debug and it seems to be in ipq_netlink_recvfrom() where the recvfrom() fails with errno=105. Is there some artifical cap on the size of a message which can be passed to the QUEUE target?

-Scott

__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs
http://hotjobs.sweepstakes.yahoo.com/careermakeover

#1 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 11 lines · Scott MacKay

Where PACKET_SIZE_MAX is 64000. I have a normal ipq_read() loop using the readBuffer and it normally works fine, allowing me to do my stuff with the packet.
The problem comes in when I get a large message (tested was 24000 bytes). ipq_read fails. I added some debug and it seems to be in ipq_netlink_recvfrom() where the recvfrom() fails with errno=105. Is there some artifical cap on the size of a message which can be passed to the QUEUE target?

Don't know if this helps, but:

The payload size can be as high as 65536 bytes. If your buffer is not large enough to receive the payload, ipq_read will return with ENOBUFS, which means your buffer is not large enough. I bet if you set PACKET_SIZE_MAX to 65536, that problem goes away.

- --Russell

Quoted 9 lines

-Scott

Quoted 4 lines

__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs
http://hotjobs.sweepstakes.yahoo.com/careermakeover

- --

Russell Miller - [email protected] - Somewhere near Sioux City, IA. Youth cannot know age, but age is guilty if it forgets youth
- Professor Dumbledore
Hi! I'm a .signature virus! Copy me into your ~/.signature, please! -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAmp/cURTA4VCI9OARAtGgAJ40xCgkuud9kk/kckX9P8xQVFaQKgCeKCQ2 Pfb+kY6GjEFYoepess6CK98=
=2Hhi
-----END PGP SIGNATURE-----

#2 lore raw

I actually have tried it with 65535 (and larger, since I think the buffer space is also used for the packet msg), same problem. I am quite positive the 24K message I make is the largest being processed, so the
64000 buffer should be large enough). One thought I
have not looked at yet; I use a static buffer to read in ipq_read(). I then allocate a buffer large enough to hold the returned data, memcpy the buffer over, and then call ipq_msg_type(), ipt_get_packet, etc. Could this be causing any problems?

Quoted 22 lines · --- Russell Miller

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 2 lines · Scott MacKay

Where PACKET_SIZE_MAX is 64000. I have a normal ipq_read() loop using the readBuffer and it

normally

Quoted 4 lines

works fine, allowing me to do my stuff with the packet.
The problem comes in when I get a large message (tested was 24000 bytes). ipq_read fails. I

added

Quoted 2 lines

some debug and it seems to be in ipq_netlink_recvfrom() where the recvfrom() fails

with

Quoted 1 line

errno=105. Is there some artifical cap on the

size of

Quoted 2 lines

a message which can be passed to the QUEUE target?

Don't know if this helps, but:

Quoted 7 lines

The payload size can be as high as 65536 bytes. If your buffer is not large
enough to receive the payload, ipq_read will return with ENOBUFS, which means
your buffer is not large enough. I bet if you set PACKET_SIZE_MAX to 65536,
that problem goes away.

__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs
http://hotjobs.sweepstakes.yahoo.com/careermakeover