sleinen / samplicator

Send copies of (UDP) datagrams to multiple receivers, with optional sampling and spoofing
GNU General Public License v2.0
389 stars 132 forks source link

socket: Message too long #65

Open spasaintk opened 5 years ago

spasaintk commented 5 years ago

Hi,

I am experiencing an issue with the message lenght of the UDP packets (syslog data). As visible below, whenever the message exceeds 1500 bytes it will throw this error;

received 1647 bytes from 10.xx.xx.xx:60139 socket error: 0 socket: Message too long sending datagram to 10.xx.xx.xx:514 failed: Message too long

I've searched in every corner of the internet, but I cannot find how I could fix this issue.

I've landed on issue 34 (https://github.com/sleinen/samplicator/issues/34) which I thought described my problem, but looking at the code there I get a different error message. Also the fix implemented there allowes for a default big enough pdu size.

Any hints on where I should be looking in correcting my issue?

The system runs as a minimal install on Debian stretch with kernel version 4.9.0-9-amd64 #1 SMP Debian 4.9.168-1+deb9u3 (2019-06-16)

I am using the latest version that is published on github. This is the startup string I am testing with; /usr/local/bin/samplicate -S -c /etc/samplicator.conf -p 514 -d 1 -n

Cheers,

fredbcode commented 5 years ago

Perhaps this not well applied, you can check the pdu allowed size with

// Not tested

fprintf (stderr, "sending datagram to %s:%s size1: %ld size2: %d failed: %s\n", host, serv, sizeof (ctx->pdulen), n, strerror (errno));

I noted that pdulen is a long and n an int

fredbcode commented 5 years ago

Do you have a way to reproduce easily ?

spasaintk commented 5 years ago

Hi,

Thanks for your reply. Unfortunately I have about 0 coding skills, so I am not sure if I'm expected to put that bit into the code or straight on the CLI. If the latter is the case, then it errors out with a unexpected token 'stderr'.

I can easily reproduce the issue as I have a system that is constantly sending large messages, so the error is present every few seconds.

Cheers,