-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
Support bind to interface and IP #13719
base: master
Are you sure you want to change the base?
Conversation
Can you suggest a way to add unit tests, at least for the parsing part? I'd love to use real callbacks for the actual bind to interface (setsockopt) and bind to ip (bind) parts, but that would be cumbersome, and require additional exported symbols. Are there tests for similar features? |
5fdd421
to
75eb8c5
Compare
Please provide a description when you make a pull request so that we can get a better understanding what is proposed without having to read the patch. |
Sure. Please just let me know which approach you prefer from the ones discussed in #13688 and then I'll prepare a single commit with a proper commit message and update the PR. |
Maybe use dynbufs instead of those local buffers to make it easier to manage without strcpys ? |
971b4a8
to
669b7ed
Compare
Done |
79bc900
to
efde1d8
Compare
Introduce new notation for CURLOPT_INTERFACE / --interface: ifhost!<interface>!<host> Binding to an interface doesn't set the address, and an interface can have multiple addresses. When binding to an address (without interface), the kernel is free to choose the route, and it can route through any device that can access the target address, not necessarily the one with the chosen address. Moreover, it is possible for different interfaces to have the same IP address, on which case we need to provide a way to be more specific. Factor out the parsing part of interface option, and add unit tests.
@bagder any comments on this? |
Support bind to interface and IP
Introduce new notation for CURLOPT_INTERFACE / --interface:
ifhost!<interface>!<host>
Binding to an interface doesn't set the address, and an interface can have multiple addresses.
When binding to an address (without interface), the kernel is free to choose the route, and it can route through any device that can access the target address, not necessarily the one with the chosen address.
Moreover, it is possible for different interfaces to have the same IP address, on which case we need to provide a way to be more specific.
Factor out the parsing part of interface option, and add unit tests.