[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [PATCH] tftp: Fix tftp -put issue with ECMP configured routes.
From:       Oscar Ravadilla <oscar.ravadilla () alliedtelesis ! co ! nz>
Date:       2014-07-27 22:11:59
Message-ID: 1406499119-1456-1-git-send-email-oscar.ravadilla () alliedtelesis ! co ! nz
[Download RAW message or body]

With the latest linux kernel, route caching has been removed.
This breaks tftp because routes can now change everytime.
---
 networking/tftp.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

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. */
-- 
1.7.9.5


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.
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic