-
-
Notifications
You must be signed in to change notification settings - Fork 153
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 Mirrored mode networking for wsl2 #879
support Mirrored mode networking for wsl2 #879
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.
Thank you for this contribution.
However, I would request a couple of changes.
def controller_protocol(): | ||
protocol = 'tcp' if (has_shared_folder() or is_wsl()) else 'ipc' | ||
return protocol | ||
|
||
|
||
def controller_ip_address(): | ||
ip_address = get_host_ip() if has_shared_folder() else get_wsl_ip_address() | ||
ip_address = get_router_ip() if has_shared_folder() else get_wsl_ip_address() |
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.
ip_address = get_router_ip() if has_shared_folder() else get_wsl_ip_address() | |
ip_address = get_router_ip() if has_shared_folder() else get_wsl_host_ip() |
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.
I'm not sure the purpose of the function controller_ip_address. In mirrored mode, the return value of get_wsl_host_ip is fixed as 127.0.0.42
return ip_address | ||
|
||
|
||
def controller_url_prefix(port='1234'): | ||
if has_shared_folder() or is_wsl(): | ||
return 'tcp://' + (get_host_ip() if has_shared_folder() else get_wsl_ip_address()) + ':' + port + '/' | ||
return 'tcp://' + (get_router_ip() if has_shared_folder() else get_wsl_ip_address()) + ':' + port + '/' |
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.
return 'tcp://' + (get_router_ip() if has_shared_folder() else get_wsl_ip_address()) + ':' + port + '/' | |
return 'tcp://' + (get_router_ip() if has_shared_folder() else get_wsl_host_ip()) + ':' + port + '/' |
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.
but get_wsl_ip_address shoud be used here
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.
You renamed this get_wsl_ip_address function to get_wsl_host_ip.
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.
if the file /etc/resolv.conf
exist, the function get_wsl_host_ip never return 127.0.0.1
whatever the mode.
But get_wsl_ip_address can return get_wsl_host_ip or localhost
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.
What I mean here is that in this PR, get_wsl_ip_address
doesn't exist any more. You renamed it to get_wsl_host_ip
. So, the above line will fail due to an attempt to call an unknown function.
Co-authored-by: Olivier Michel <[email protected]>
Description
Mirrored mode networking is a new network mode of wsl2. In this mode, we can use localhost accessing Windows networking apps from Linux.
When the following is written in the
.wslconfig
file, the wsl2 is switched to Mirrored modeRelated Issues
maybe #759
Affected Packages
Tasks
Add the list of tasks of this PR.
Additional context