mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
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.
This commit is contained in:
parent
91b38857ef
commit
67d94514b0
12
CHANGES
12
CHANGES
@ -6,8 +6,18 @@
|
||||
|
||||
Changelog
|
||||
|
||||
Daniel S (4 October 2007)
|
||||
- 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'll add it in disabled state.
|
||||
|
||||
Yang Tse (3 October 2007)
|
||||
- Fixed issue related with the use of ares_timeout() result.
|
||||
|
||||
Daniel S (3 October 2007)
|
||||
- Yang Tse, fix issue related with the use of ares_timeout() result.
|
||||
|
||||
- Alexey Pesternikov introduced CURLOPT_OPENSOCKETFUNCTION and
|
||||
CURLOPT_OPENSOCKETDATA to set a callback that allows an application to
|
||||
|
@ -34,6 +34,7 @@ This release includes the following bugfixes:
|
||||
o curl_easy_escape() problem with byte values >= 128
|
||||
o handles chunked-encoded CONNECT responses
|
||||
o misuse of ares_timeout() result
|
||||
o --local-port on TFTP transfers
|
||||
|
||||
This release includes the following known bugs:
|
||||
|
||||
@ -52,6 +53,6 @@ advice from friends like these:
|
||||
|
||||
Dan Fandrich, Michal Marek, Günter Knauf, Rob Crittenden, Immanuel Gregoire,
|
||||
Mark Davies, Max Katsev, Philip Langdale, Alex Fishman, Johnny Luong,
|
||||
Alexey Pesternikov, Yang Tse
|
||||
Alexey Pesternikov, Yang Tse, Kim Rinnewitz
|
||||
|
||||
Thanks! (and sorry if I forgot to mention someone)
|
||||
|
@ -380,6 +380,7 @@ static CURLcode bindlocal(struct connectdata *conn,
|
||||
port = ntohs(((struct sockaddr_in6 *)&add)->sin6_port);
|
||||
#endif
|
||||
infof(data, "Local port: %d\n", port);
|
||||
conn->bits.bound = TRUE;
|
||||
return CURLE_OK;
|
||||
}
|
||||
if(--portnum > 0) {
|
||||
|
@ -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);
|
||||
|
@ -609,6 +609,8 @@ struct ConnectBits {
|
||||
bool proxy_connect_closed; /* set true if a proxy disconnected the
|
||||
connection in a CONNECT request with auth, so
|
||||
that libcurl should reconnect and continue. */
|
||||
bool bound; /* set true if bind() has already been done on this socket/
|
||||
connection */
|
||||
};
|
||||
|
||||
struct hostname {
|
||||
|
@ -3,5 +3,4 @@
|
||||
# test cases are run by runtests.pl. Just add the plain test case numbers, one
|
||||
# per line.
|
||||
# Lines starting with '#' letters are treated as comments.
|
||||
#230
|
||||
|
||||
1009
|
||||
|
@ -45,7 +45,7 @@ EXTRA_DIST = test1 test108 test117 test127 test20 test27 test34 test46 \
|
||||
test706 test707 test350 test351 test352 test353 test289 test540 test354 \
|
||||
test231 test1000 test1001 test1002 test1003 test1004 test1005 test1006 \
|
||||
test615 test1007 test541 test1010 test1011 test1012 test542 test543 \
|
||||
test536 test1008
|
||||
test536 test1008 test1009
|
||||
|
||||
filecheck:
|
||||
@mkdir test-place; \
|
||||
|
43
tests/data/test1009
Normal file
43
tests/data/test1009
Normal file
@ -0,0 +1,43 @@
|
||||
<testcase>
|
||||
<info>
|
||||
<keywords>
|
||||
TFTP
|
||||
TFTP RRQ
|
||||
</keywords>
|
||||
</info>
|
||||
|
||||
#
|
||||
# Server-side
|
||||
<reply>
|
||||
<data>
|
||||
a chunk of
|
||||
data
|
||||
returned
|
||||
to client
|
||||
</data>
|
||||
</reply>
|
||||
|
||||
#
|
||||
# Client-side
|
||||
<client>
|
||||
<server>
|
||||
tftp
|
||||
</server>
|
||||
<name>
|
||||
TFTP retrieve
|
||||
</name>
|
||||
<command>
|
||||
tftp://%HOSTIP:%TFTPPORT//1009 --local-port 44444
|
||||
</command>
|
||||
</client>
|
||||
|
||||
#
|
||||
# Verify pseudo protocol after the test has been "shot"
|
||||
<verify>
|
||||
<protocol>
|
||||
opcode: 1
|
||||
filename: /1009
|
||||
mode: octet
|
||||
</protocol>
|
||||
</verify>
|
||||
</testcase>
|
Loading…
Reference in New Issue
Block a user