WSL: setsockopt(fd, IPPROTO_IP, IP_MTU_DISCOVER, ...) fails
I’m a maintainer of Mosh (https://github.com/mobile-shell/mosh). I tried getting Mosh running on WSL, because it’ll obviously be very interesting to the Mosh community. mosh-server needs ptys, so that’s obviously not going to work right now, but mosh-client is much more relevant for Windows client users anyway. I ran into problems with two socket-related syscalls that Mosh makes, see cgull/mosh@90ce95bc33df04e2ebaff573485e2dce3d90013d for context and the workarounds I’ve got in place.
setsockopt( _fd, IPPROTO_IP, IP_MTU_DISCOVER, &flag, optlen )fails, with EINVAL if i recall correctly. I believe this code was incorrect (though working on Linux) originally, but even after I corrected the bug, it still fails.recvmsg()also fails with EINVAL. Setup for this syscall is complex so I’m less sure our code is correct, but again this works fine on any Linux system.
Since Mosh is a fairly sophisticated UDP user, neither of these calls are commonly used, and we have reasonable workarounds, I don’t expect fixes-- but it would be nice to at least track status on these issues.
With those workarounds, Mosh works surprisingly well, considering the currently very incomplete xterm emulation in WSL. Thanks for this work!
About this issue
- Original URL
- State: closed
- Created 11 years ago
- Reactions: 16
- Comments: 25 (11 by maintainers)
Just an update that the fix for IP_MTU_DISCOVER has been checked into the dev branch. I have verified that the
MOSH_KEY=AAAAAAAAAAAAAAAAAAAAAA mosh-client 127.0.0.1 60001command works fine with the fix (although, it logs an error about the IP_RECVTOS socket option, but that is not fatal). The fix should make it to the release branch.I forgot to comment earlier, I did test this on 15002 or 15007 and it works for me, mosh-1.3.0-rc2 passes all tests. I’ll note this as now working in Mosh release notes.
@cgull - We recently had the dependency of this met by the Windows TCP/IP team. We will be soon looking into lighting this up within WSL. Sorry, I don’t have an ETA at the moment.
IP_MTU_DISCOVER support is on the backlog.
@Pyrepenol - From the changelist, I can see that IP_MTU_DISCOVER is not in 14986, but you are most welcome to confirm the same at your end as well.
@Pyrepenol - It should be in the next insider build. Thanks for your patience.
The
setsockopt()issue in the first comment.This STC fails with
ip-mtu-discover: setsockopt(): Invalid argumenton 14926 andip-mtu-discover: setsockopt(): Protocol not availableon 14936. So something has changed, but not improved, for us.@sunilmut, any news? 14959 shows no change from 14936’s behavior.
@cgull - Update on this. The Windows networking team just finished providing us support for the IP_MTU_DISCOVER option in the TCP/IP stack (thanks to them). I am now looking into enabling this option in WSL. As part of the validation, I will also try to run the
mosh-client. Can you provide me detailed steps (or a link) for that? Thanks for your patience.