lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [lwip-devel] lwIP UDP and TFTP


From: Kieran Mansley
Subject: RE: [lwip-devel] lwIP UDP and TFTP
Date: Wed, 26 Nov 2003 10:16:48 +0000 (GMT)

On Wed, 26 Nov 2003, Atte Kojo wrote:

> On Wed, 2003-11-26 at 09:25, Zschocke, Florian wrote:
> > That is not completely correct. In the case of a connected UDP socket you
> > will have to check the source port against the foreign port that the socket
> > is connected to. So the patch should instead read:
> >
> >  /* PCB remote port matches UDP source port for connected socket? */
> >  if(((pcb->flags&UDP_FLAGS_CONNECTED)?(pcb->remote_port == src):1)&&
> >    /* PCB local port matches UDP destination port? */
> >    (pcb->local_port == dest) &&
>
> This doesn't solve the problem with TFTP as the socket is connected to
> port 69 when sending the request. When the response arrives from the
> server (from a different port) it gets rejected (the UDP_FLAGS_CONNECTED
> is set and ports don't match).
>
> Furher thinking about the issue, the whole concept of a "connection" in
> case of UDP is erroneous. As UDP is a connectionless protocol the stack
> should _not_ be worried about where the packets come from. To repeat
> myslef: Sending and receiving UDP packets are two totally different
> operations; they shouldn't have anything to do with each other.

Having had a read through the relevant bit in TCP/IP Illustrated (Section
23.7 - udp_input) it would seem that the standard behaviour is to match
against both port numbers (as lwIP currently does) *if* they are not
wildcarded.  If the application has bound to both a local and destination
port, then those should match.  If the application wants to receive from
multiple remote ports, then it should leave the remote port wildcarded.
Maybe lwIP is filling in this value when it shouldn't, but I don't think
it's quite as simple as just never matching on the remote port.

The concept of a connection is valid in UDP.  Although it is a
connectionless protocol (meaning there is no handshake before data are
sent, or after all data have been received) that doesn't mean a UDP
socket can't be connected to a particular pair of ip addresses & port
numbers.  The problem is with English, where the word "connection" is
overloaded and means many different things.

Kieran





reply via email to

[Prev in Thread] Current Thread [Next in Thread]