[BusyBox 0001202]: tftp not work

bugs at busybox.net bugs at busybox.net
Wed Feb 7 21:20:12 UTC 2007


A NOTE has been added to this issue. 
====================================================================== 
http://busybox.net/bugs/view.php?id=1202 
====================================================================== 
Reported By:                regunkov
Assigned To:                BusyBox
====================================================================== 
Project:                    BusyBox
Issue ID:                   1202
Category:                   Documentation
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     assigned
====================================================================== 
Date Submitted:             02-06-2007 21:09 PST
Last Modified:              02-07-2007 13:20 PST
====================================================================== 
Summary:                    tftp not work
Description: 
http://busybox.net/cgi-bin/viewcvs.cgi/trunk/busybox/networking/tftp.c?rev=17749&r1=16980&r2=17749&diff_format=h
See Line 294 Line 273

#if ENABLE_FEATURE_IPV6
  if (from->sa_family == AF_INET6)
    if (((struct sockaddr_in6*)from)->sin6_port != port)
     goto recv_again;
#endif
  if (from->sa_family == AF_INET)
    if (((struct sockaddr_in*)from)->sin_port != port)
     goto recv_again;
  timeout = 0; 

It is not equivalent

  if (sa.sin_port == port) { 	 
    sa.sin_port = from.sin_port; 	 
  } 	 
  if (sa.sin_port == from.sin_port) { 	 
    break;
  }

In exampe. 1474 != 69

====================================================================== 

---------------------------------------------------------------------- 
 rockeychu - 02-06-07 23:00  
---------------------------------------------------------------------- 
You are right. You can correct it with following patch:

Index: tftp.c
===================================================================
--- tftp.c      (revision 17803)
+++ tftp.c      (working copy)
@@ -132,7 +132,7 @@
 #if ENABLE_FEATURE_TFTP_GET && ENABLE_FEATURE_TFTP_PUT
                const int cmd,
 #endif
-               const len_and_sockaddr *peer_lsa,
+               len_and_sockaddr *peer_lsa,
                const char *remotefile, const int localfd,
                unsigned port, int tftp_bufsize)
 {
@@ -265,7 +265,6 @@
                        }

                        /* receive packet */
- recv_again:
                        tv.tv_sec = TFTP_TIMEOUT;
                        tv.tv_usec = 0;

@@ -290,11 +289,11 @@
 #if ENABLE_FEATURE_IPV6
                                if (from->sa_family == AF_INET6)
                                        if (((struct
sockaddr_in6*)from)->sin6_port != port)
-                                               goto recv_again;
+                                              
peer_lsa->sin6.sin6_port=((struct sockaddr_in6*)from)->sin6_port;
 #endif
                                if (from->sa_family == AF_INET)
                                        if (((struct
sockaddr_in*)from)->sin_port != port)
-                                               goto recv_again;
+                                              
peer_lsa->sin.sin_port=((struct sockaddr_in*)from)->sin_port;
                                timeout = 0;
                                break;
                        case 0: 

---------------------------------------------------------------------- 
 regunkov - 02-07-07 00:53  
---------------------------------------------------------------------- 
I'm aplay your patch on 1.4.1 manualy. And it's work right now.

ps: How I can fix "Category"? I'm forget change this, when create issue.

 

---------------------------------------------------------------------- 
 rockeychu - 02-07-07 01:00  
---------------------------------------------------------------------- 
Good news.
You can ask the Manager to change "Category" as you wanted. 

---------------------------------------------------------------------- 
 vda - 02-07-07 12:49  
---------------------------------------------------------------------- 
I don't understand that tcpdump. We are sending a packet to tfpt port (69),
but are getting replies from port 1474? Is this okay? wow...

07:51:23.730535 IP 10.0.54.254.1024 > roman.nsg.tftp: 28 RRQ
nftlroot-ppc.tar.gz" octet
07:51:23.737704 IP roman.nsg.1474 > 10.0.54.254.1024: UDP, length 516 

---------------------------------------------------------------------- 
 vda - 02-07-07 13:20  
---------------------------------------------------------------------- 
Please test attached patch. Diffed agains current svn, but probably will
apply to 1.4.1 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
02-06-07 21:09  regunkov       New Issue                                    
02-06-07 21:09  regunkov       Status                   new => assigned     
02-06-07 21:09  regunkov       Assigned To               => BusyBox         
02-06-07 23:00  rockeychu      Note Added: 0002130                          
02-07-07 00:03  regunkov       Note Added: 0002131                          
02-07-07 00:53  regunkov       Note Edited: 0002131                         
02-07-07 01:00  rockeychu      Note Added: 0002132                          
02-07-07 12:49  vda            Note Added: 0002135                          
02-07-07 13:19  vda            File Added: 1.patch                          
02-07-07 13:20  vda            Note Added: 0002136                          
======================================================================




More information about the busybox-cvs mailing list