-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
Require host to be specified for WireGuardConf and set IPV6_V6ONLY #242
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for tackling this! Would it make sense to merge both implementations into a common function with an explanatory docstring?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, reading the PR title / commit message first and the actual code changes second I was very confused what this PR was actually doing 😅
As far as I can tell, you're
- dropping the unintended fallback to an IPv6 socket if binding to an IPv4 socket fails
- requiring the "host" argument not to be empty, and
- setting IPv6 only mode if the address is an IPv6 address.
The changes 1. and 3. look good to me, but I'm not sure I like losing the default behaviour of "if no host is specified, fall back to 0.0.0.0
, which is a good default IMO.
Maybe falling back to 0.0.0.0
would be ok if the "host" argument is empty? That should match the current behaviour in all cases except the pathological one where binding to 0.0.0.0
failed but binding to ::1
works for some strange reason.
I think there's an argument to be made that we should just mirror what std::net::UdpListener does, which also requires "host" to not be empty. What do you think? We could also just take |
Ok, if the UDP mode already does it this way, it makes sense to have consistent behaviour. |
Totally agreed 😅 I was drafting this in the middle of the night and I guess I just got too tired by the time I submitted the PR. Will make it clearer in the coming days :) |
Refs mitmproxy/mitmproxy#6671
Socket building logic copied from:
mitmproxy_rs/src/packet_sources/udp.rs
Line 39 in 79a03b8