Re: Problem with unix sockets: SOCK_DGRAM ignores MSG_TRUNC

From: Daniel Kabs
Date: Wed Feb 07 2007 - 04:32:25 EST


On Monday 05 February 2007 01:52, David Miller wrote:
> What UDP is doing is different, it's returning the full packet length
> when the packet is larger then the given buffer size, but it does this
> irregardless of whether you set MSG_TRUNC in the recvmsg() passed-in
> flags. UDP itself sets the MSG_TRUNC flag when it detects this
> situation.

I hope that I am researching the appropriate kernel source tree, but if I
am not mistaken, this behaviour was introduced with change 1.66 according
to bitkeeper:
http://linux.bkbits.net:8080/linux-2.6/net/ipv4/udp.c?PAGE=history

I think the bitkeeper comment on that change (1.66) is misleading:
"[UDP]: Return true length if user specifies MSG_TRUNC."

As you said, this is wrong. The true length is returned, regardless
whether the user specified MSG_TRUNC.

Exploring this topic I learned a lot about browsing and reading kernel
source code, e.g. that commit statements have to be taken with a grain of
salt :-)

Cheers
Daniel
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/