tftp: tftp -put with ECMP route fails

oscar ravadilla oscar.ravadilla at alliedtelesis.co.nz
Thu Jul 24 23:14:31 UTC 2014


Hi, 

When multi-path routing like ECMP is configured, tftp -put fails because in the latest linux kernel route caching has been removed and kernel selects a different route for each transaction. The tftp is receiving ICMP errors from the tftp server because the route gets changed in every transaction. 

Has anybody seen this issue before? 

The below changes seems to fix the issue: 

diff --git a/networking/tftp.c b/networking/tftp.c 
index 630fdaf..a1627bd 100644 
--- a/networking/tftp.c 
+++ b/networking/tftp.c 
@@ -254,9 +254,12 @@ static int tftp_protocol( 
         */ 
        char *xbuf = xmalloc(io_bufsize); 
        char *rbuf = xmalloc(io_bufsize); 
+       struct sockaddr sa_bind_address; 
  
        socket_fd = xsocket(peer_lsa->u.sa.sa_family, SOCK_DGRAM, 0); 
        setsockopt_reuseaddr(socket_fd); 
+       memset(&sa_bind_address, 0, sizeof(sa_bind_address)); 
+       xbind(socket_fd, &sa_bind_address, sizeof(sa_bind_address)); 
  
        if (!ENABLE_TFTP || our_lsa) { /* tftpd */ 
                /* Create a socket which is: 
@@ -510,11 +513,6 @@ static int tftp_protocol( 
                                our_lsa = ((void*)(ptrdiff_t)-1); /* not NULL */ 
                                len = recvfrom(socket_fd, rbuf, io_bufsize, 0, 
                                                &peer_lsa->u.sa, &peer_lsa->len); 
-                               /* Our first dgram went to port 69 
-                                * but reply may come from different one. 
-                                * Remember and use this new port (and IP) */ 
-                               if (len >= 0) 
-                                       xconnect(socket_fd, &peer_lsa->u.sa, peer_lsa->len); 
                        } else { 
                                /* tftpd, or not the very first packet: 
                                 * socket is connect()ed, can just read from it. */ 

NOTICE: This message contains privileged and confidential
information intended only for the use of the addressee
named above. If you are not the intended recipient of
this message you are hereby notified that you must not
disseminate, copy or take any action in reliance on it.
If you have received this message in error please
notify Allied Telesis Labs Ltd immediately.
Any views expressed in this message are those of the
individual sender, except where the sender has the
authority to issue and specifically states them to
be the views of Allied Telesis Labs.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20140725/07ffe2ab/attachment.html>


More information about the busybox mailing list