lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] lwIP UDP and TFTP


From: Atte Kojo
Subject: [lwip-devel] lwIP UDP and TFTP
Date: Wed, 26 Nov 2003 09:00:33 +0200

While writing a TFTP client on top of lwIP I noticed that udp_init()
doesn't work properly when a response to a request emanates from a
different port than where it was originally sent. This is the case with
TFTP where you send request to port 69 and get response from a random
port. udp_init() throws these packets away with icmp_dest_unreach()
(port unreachable).

Also RFC 768 states that the source port field is optional (actually the
field itself is mandatory but it doesn't have to contain any
information) in UDP header so it shouldn't be checked when trying to
match incoming UDP packets to an existing pcb.

Obvious patch would be (this is against STABLE-0_6_4, sorry):

Index: lwip/src/core/udp.c
===================================================================
--- lwip/src/core/udp.c 19 Nov 2003 06:59:59 -0000      1.2
+++ lwip/src/core/udp.c 26 Nov 2003 06:39:10 -0000
@@ -209,9 +209,7 @@
           ip4_addr1(&pcb->remote_ip), ip4_addr2(&pcb->remote_ip),
           ip4_addr3(&pcb->remote_ip), ip4_addr4(&pcb->remote_ip),
pcb->remote_port));
  
-    /* PCB remote port matches UDP source port? */
-    if ((pcb->remote_port == src) &&
-        /* PCB local port matches UDP destination port? */
+    if (/* PCB local port matches UDP destination port? */
         (pcb->local_port == dest) &&
         /* accepting from any remote (source) IP address? or... */
         (ip_addr_isany(&pcb->remote_ip) ||

-- 
No proper program contains an indication which as an operator-applied
occurrence identifies an operator-defining occurrence which as an
indication-applied occurrence identifies an indication-defining
occurrence different from the one identified by the given indication as
an indication-applied occurrence. 
-- ALGOL 68 Report





reply via email to

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