Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

curl --local-port does not try last port in range #3251

Closed
infinnovation-dev opened this issue Nov 8, 2018 · 1 comment
Closed

curl --local-port does not try last port in range #3251

infinnovation-dev opened this issue Nov 8, 2018 · 1 comment

Comments

@infinnovation-dev
Copy link

(Mentioned in passing in #3248 but now raising as a separate issue.)

I did this

freia013:~/work/curl $ src/curl --local-port 1023-1024 localhost
curl: (45) bind failed with errno 13: Permission denied
freia013:~/work/curl $ src/curl --local-port 1024 localhost
curl: (7) Failed to connect to localhost port 80: Connection refused
freia013:~/work/curl $ src/curl --local-port 1023-1025 localhost
curl: (7) Failed to connect to localhost port 80: Connection refused

I expected the following

With "1023-1024", curl should try to use port 1024 when 1023 fails, but it only tries 1023 then gives up. If I increase the range to "1023-1025" then it does use 1024. This can be seen in greater detail with additional -v or -libcurl.

localportrange needs to be incremented by one when subtracting last from first.

curl/libcurl version

f859b05

@bagder
Copy link
Member

bagder commented Nov 9, 2018

localportrange needs to be incremented by one when subtracting last from first

Ack, it does!

bagder added a commit that referenced this issue Nov 9, 2018
The end port number in a given range was not included in the range used,
as it is documented to be.

Reported-by: infinnovation-dev on github
Fixes #3251
@bagder bagder closed this as completed in fcf3f13 Nov 9, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Feb 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

2 participants