Re: Kernel network layer breakes recv_from() as the server (i think) (kernel-bug)

From: linux-os (Dick Johnson)
Date: Fri May 12 2006 - 08:18:05 EST



On Fri, 12 May 2006, [iso-8859-2] Paweł Jaworski wrote:

> $ brief-problem
> Kernel network layer breakes recv_from() as the server (i think)
>
> $ full-problem
> I am student of Jagiellonian University of Cracow. Recently I've been trying to
> write some network programs as a learning of network protocols. Everything went
> fine except for UDP. I was trying to send a structure through the UDP protocol
> to the server. Every time I was sending a packet, recv_from() returned "Invalid
> argument". As it was my homework, i brought the program to my teacher, but... it
> worked well on systems in my school.
>
> 1. It worked on Linux Mandrake (i think) 10
> 2. It worked on Debian Sarge with kernel-image-2.4.27-2-686-smp
> 3. It worked on Debian Sarge with kernel-image-2.6.8-2
> 4. It worked on IRIX (i know it's not Linux, but... it worked)
>

Not relevent.

[SNIPPED...]

> exit(1);
> };
>
> while (1)
> {
> int rd;
> int i;
> socklen_t from_size;
>
> rd = recvfrom( s, (char*)&p, sizeof(p), 0, (struct sockaddr *)&cli_address,
> &from_size);
^^^^^^^^______ Was NOT initialized....


Quote man pages: "The argument fromlen is a value-result parameter,
initialized to the size of the buffer associated with from...."
^^^^^^^^^^____ READ this!


recvfrom() returned -1 with errno EINVAL because you fed it
invalid parameters. If some other Unixes ignore parameters,
of if the value on the stack just happened to be okay, it
doesn't mean there is a problem with Linux or any operating
system. You must understand that millions of programs use
the O.S. (any OS). If you find a problem when coding, the
chances are millions:1 against your code!

[SNIPPED crap]


Cheers,
Dick Johnson
Penguin : Linux version 2.6.16.4 on an i686 machine (5592.89 BogoMips).
New book: http://www.lymanschool.com
_


****************************************************************
The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to DeliveryErrors@xxxxxxxxxxxx - and destroy all copies of this information, including any attachments, without reading or disclosing them.

Thank you.
-
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/