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

Fix _LLMP_BIND_ADDR for Windows #285

Merged
merged 4 commits into from
Sep 3, 2021
Merged

Fix _LLMP_BIND_ADDR for Windows #285

merged 4 commits into from
Sep 3, 2021

Conversation

tokatoka
Copy link
Member

@tokatoka tokatoka commented Sep 2, 2021

#284
with "0.0.0.0" windows gives this error The requested address is not valid in its context. (os error 10049) when broker2broker is used.

@domenukk
Copy link
Member

domenukk commented Sep 2, 2021

Actually, can you try :: which is INADDR6_ANY vs ::1 which, again, will only bind to loopback? Sorry 🙈

@tokatoka
Copy link
Member Author

tokatoka commented Sep 3, 2021

ehm, ::1 was ok, but :: doesn't work 😵

@tokatoka
Copy link
Member Author

tokatoka commented Sep 3, 2021

The error occurs when LlmpClient calls create_attach_to_tcp to connect to 0.0.0.0's port XYZ.
I guess we can still listen on 0.0.0.0 port XYZ as a broker, but connect to localhost's port XYZ as the client

at this line

let mut stream = match TcpStream::connect(format!("{}:{}", _LLMP_BIND_ADDR, port)) {

@domenukk
Copy link
Member

domenukk commented Sep 3, 2021

Aah yes this makes sense, the connect needs to be localhost, unless we connect to a remote machine!
Still we can leave the bind address on :: then we are dual stack / ipv6 ready 💪

@domenukk
Copy link
Member

domenukk commented Sep 3, 2021

And, thinking about it, instead of format I'm pretty sure we can just pass in use a tuple here.

@tokatoka
Copy link
Member Author

tokatoka commented Sep 3, 2021

maybe we should fall back to ipv4 addr "0.0.0.0" when binding "::" fails?

let listener = TcpListener::bind((_LLMP_BIND_ADDR, port))?

@tokatoka
Copy link
Member Author

tokatoka commented Sep 3, 2021

apple is not happy with this change 🥴

@domenukk domenukk merged commit d136ee7 into main Sep 3, 2021
@tokatoka tokatoka deleted the fix_win_b2b branch September 4, 2021 00:05
khang06 pushed a commit to khang06/LibAFL that referenced this pull request Oct 11, 2022
* ipv6

* client connects to localhost

* v4 when v6 not available

* remove v6 addr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants