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

List:       busybox
Subject:    tftp: tftp -put with ECMP route fails
From:       "oscar ravadilla" <oscar.ravadilla () alliedtelesis ! co ! nz>
Date:       2014-07-24 23:14:31
Message-ID: 53D23C17020000580001DD7F () gwia2 ! atlnz ! lc
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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.


[Attachment #5 (text/html)]

<html>
  <head>

  </head>
  <body style="margin-right: 4px; margin-bottom: 1px; line-height: normal; \
margin-top: 4px; margin-left: 4px; font-variant: normal">  <p style="margin-top: 0; \
margin-bottom: 0">  <font face="Dialog" size="2">Hi&#44;</font>    </p>
<br>      
    <p style="margin-top: 0; margin-bottom: 0">
      <font face="Dialog" size="2">When multi-path routing like ECMP is \
configured&#44; tftp -put fails because in the&nbsp;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.</font>    </p> <br>      
    <p style="margin-top: 0; margin-bottom: 0">
      <font face="Dialog" size="2">Has anybody seen this issue before&#63;</font>    \
</p> <br>      
    <p style="margin-top: 0; margin-bottom: 0">
      <font face="Dialog" size="2">The below changes seems to fix the issue:</font>   \
</p> <br>      
    <p style="margin-top: 0; margin-bottom: 0">
      <font face="Dialog" size="2">diff --git a/networking/tftp.c \
b/networking/tftp.c</font>    </p>  <p style="margin-top: 0; margin-bottom: 0">
      <font face="Dialog" size="2">index 630fdaf..a1627bd 100644</font>    </p>
    <p style="margin-top: 0; margin-bottom: 0">
      <font face="Dialog" size="2">--- a/networking/tftp.c</font>    </p>
    <p style="margin-top: 0; margin-bottom: 0">
      <font face="Dialog" size="2">&#43;&#43;&#43; b/networking/tftp.c</font>    </p>
    <p style="margin-top: 0; margin-bottom: 0">
      <font face="Dialog" size="2">@@ -254&#44;9 &#43;254&#44;12 @@ static int \
tftp_protocol&#40;</font>    </p>  <p style="margin-top: 0; margin-bottom: 0">
      <font face="Dialog" \
size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#42;/</font>    </p>  \
                <p style="margin-top: 0; margin-bottom: 0">
      <font face="Dialog" \
size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;char &#42;xbuf &#61; \
xmalloc&#40;io_bufsize&#41;&#59;</font>    </p>  <p style="margin-top: 0; \
                margin-bottom: 0">
      <font face="Dialog" \
size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;char &#42;rbuf &#61; \
xmalloc&#40;io_bufsize&#41;&#59;</font>    </p>  <p style="margin-top: 0; \
                margin-bottom: 0">
      <font face="Dialog" size="2">&#43; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;struct \
sockaddr sa_bind_address&#59;</font>    </p>  <p style="margin-top: 0; margin-bottom: \
0">  <font face="Dialog" size="2">&nbsp;</font>    </p>
    <p style="margin-top: 0; margin-bottom: 0">
      <font face="Dialog" \
size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;socket_fd &#61; \
xsocket&#40;peer_lsa-&gt;u.sa.sa_family&#44; SOCK_DGRAM&#44; 0&#41;&#59;</font>    \
</p>  <p style="margin-top: 0; margin-bottom: 0">
      <font face="Dialog" \
size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setsockopt_reuseaddr&#40;socket_fd&#41;&#59;</font> \
</p>  <p style="margin-top: 0; margin-bottom: 0">
      <font face="Dialog" size="2">&#43; \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;memset&#40;&amp;sa_bind_address&#44; 0&#44; \
sizeof&#40;sa_bind_address&#41;&#41;&#59;</font>    </p>  <p style="margin-top: 0; \
margin-bottom: 0">  <font face="Dialog" size="2">&#43; \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xbind&#40;socket_fd&#44; \
&amp;sa_bind_address&#44; sizeof&#40;sa_bind_address&#41;&#41;&#59;</font>    </p>  \
<p style="margin-top: 0; margin-bottom: 0">  <font face="Dialog" \
size="2">&nbsp;</font>    </p>  <p style="margin-top: 0; margin-bottom: 0">
      <font face="Dialog" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if \
&#40;&#33;ENABLE_TFTP&#32;&#124;&#124;&#32;our_lsa&#41;&#32;&#123;&#32;/&#42; tftpd \
&#42;/</font>    </p>  <p style="margin-top: 0; margin-bottom: 0">
      <font face="Dialog" \
size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/&#42; \
Create a socket which is:</font>    </p>  <p style="margin-top: 0; margin-bottom: 0">
      <font face="Dialog" size="2">@@ -510&#44;11 &#43;513&#44;6 @@ static int \
tftp_protocol&#40;</font>    </p>  <p style="margin-top: 0; margin-bottom: 0">
      <font face="Dialog" \
size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp \
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;our_lsa \
&#61; &#40;&#40;void&#42;&#41;&#40;ptrdiff_t&#41;-1&#41;&#59; /&#42; not NULL \
&#42;/</font>    </p>  <p style="margin-top: 0; margin-bottom: 0">
      <font face="Dialog" \
size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp \
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;len \
&#61; recvfrom&#40;socket_fd&#44; rbuf&#44; io_bufsize&#44; 0&#44;</font>    </p>  <p \
style="margin-top: 0; margin-bottom: 0">  <font face="Dialog" \
size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp \
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& \
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&amp;peer_lsa-&gt;u.sa&#44; \
&amp;peer_lsa-&gt;len&#41;&#59;</font>    </p>  <p style="margin-top: 0; \
margin-bottom: 0">  <font face="Dialog" size="2">- \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n \
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/&#42; \
Our first dgram went to port 69</font>    </p>  <p style="margin-top: 0; \
margin-bottom: 0">  <font face="Dialog" size="2">- \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n \
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#42; \
but reply may come from different one.</font>    </p>  <p style="margin-top: 0; \
margin-bottom: 0">  <font face="Dialog" size="2">- \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n \
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#42; \
Remember and use this new port &#40;and IP&#41; &#42;/</font>    </p>  <p \
style="margin-top: 0; margin-bottom: 0">  <font face="Dialog" size="2">- \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n \
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if \
&#40;len &gt;&#61; 0&#41;</font>    </p>  <p style="margin-top: 0; margin-bottom: 0">
      <font face="Dialog" size="2">- \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n \
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs \
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xconnect&#40;socket_fd&#44; \
&amp;peer_lsa-&gt;u.sa&#44; peer_lsa-&gt;len&#41;&#59;</font>    </p>  <p \
style="margin-top: 0; margin-bottom: 0">  <font face="Dialog" \
size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp \
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125;&#32;else&#32;&#123;</font> \
</p>  <p style="margin-top: 0; margin-bottom: 0">
      <font face="Dialog" \
size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp \
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/&#42; \
tftpd&#44; or not the very first packet:</font>    </p>  <p style="margin-top: 0; \
margin-bottom: 0">  <font face="Dialog" \
size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp \
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#42; \
socket is connect&#40;&#41;ed&#44; can just read from it. &#42;/</font>    </p> <br>  \
  
<P><BR>NOTICE: This message contains privileged and confidential<BR>information 
intended only for the use of the addressee<BR>named above. If you are not the 
intended recipient of<BR>this message you are hereby notified that you must 
not<BR>disseminate, copy or take any action in reliance on it.<BR>If you have 
received this message in error please<BR>notify Allied Telesis&nbsp;Labs Ltd 
immediately.<BR>Any views expressed in this message are those of 
the<BR>individual sender, except where the sender has the<BR>authority to issue 
and specifically states them to<BR>be the views of Allied Telesis Labs.</P>
<P>&nbsp;</P>
</body>
</html>



_______________________________________________
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