[BusyBox 0001202]: tftp not work

bugs at busybox.net bugs at busybox.net
Tue Feb 6 23:00:49 PST 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-06-2007 23:00 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: 

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                          
======================================================================



More information about the busybox-cvs mailing list