aboutsummaryrefslogtreecommitdiff
path: root/lib/tftp.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2007-10-04 10:01:41 +0000
committerDaniel Stenberg <daniel@haxx.se>2007-10-04 10:01:41 +0000
commit67d94514b0d1501832a52fd42db8f5a41151d7f5 (patch)
treeb1c4f029b0c92dd4579ed33e3dcd71f8a74bbadf /lib/tftp.c
parent91b38857ef9ab1f345f0c8914ef3feec803f8752 (diff)
Kim Rinnewitz reported that --local-port didn't work with TFTP transfers.
This happened because the tftp code always uncondionally did a bind() without caring if one already had been done and then it failed. I wrote a test case (1009) to verify this, but it is a bit error-prone since it will have to pick a fixed local port number and since the tests are run on so many different hosts in different situations I add it in disabled state.
Diffstat (limited to 'lib/tftp.c')
-rw-r--r--lib/tftp.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/tftp.c b/lib/tftp.c
index a3a69cf6c..938c2e239 100644
--- a/lib/tftp.c
+++ b/lib/tftp.c
@@ -598,9 +598,9 @@ CURLcode Curl_tftp_connect(struct connectdata *conn, bool *done)
tftp_set_timeouts(state);
- if(!conn->bits.reuse) {
- /* If not reused, bind to any interface, random UDP port. If it is reused,
- * this has already been done!
+ if(!conn->bits.bound) {
+ /* If not already bound, bind to any interface, random UDP port. If it is
+ * reused or a custom local port was desired, this has already been done!
*
* We once used the size of the local_addr struct as the third argument for
* bind() to better work with IPv6 or whatever size the struct could have,
@@ -619,6 +619,7 @@ CURLcode Curl_tftp_connect(struct connectdata *conn, bool *done)
Curl_strerror(conn, SOCKERRNO));
return CURLE_COULDNT_CONNECT;
}
+ conn->bits.bound = TRUE;
}
Curl_pgrsStartNow(conn->data);