Closed tubzby closed 4 months ago
Hi @tubzby
I have a TCP client written in Golang and I find out that MPTCP can't be enabled by mptcpize. (...) My guess is that the extra flags SOCK_CLOEXEC|SOCK_NONBLOCK added by GoLang std are causing this issue, am I right, how to avoid it?
If I'm not mistaken, the issue is due to Go itself: mptcpize
cannot work with Go applications.
mptcpize
is defining LD_PRELOAD
env var to change the behaviour of the linker to override some functions of the libc (here, the socket
function).
Go is not using a libc: they decided to re-implement syscall, etc. for various reasons. But because of that, this LD_PRELOAD
technique here cannot work.
If you control your application, the best is to modify it to use MPTCP. You might have to modify net.Dial("tcp", "192.168.0.1:4323")
to support a new argument ("mptcp"
). I don't know if you can easily create a socket without using net.Dial()
in Go.
Thanks, @matttbe, I just found out how mptcpize was updating my systemd script :).
It's hard to modify the Go std lib and make the application hard to maintain, so I'm looking for other alternatives:
I haven't used stap before, can it hook my socket syscall?
It's hard to modify the Go std lib and make the application hard to maintain
Is it something that could be reported to Go devs? We can help if a ticket is opened and if needed.
I haven't used stap before, can it hook my socket syscall?
Yes, I think stab
should work in your case. I never had to use it with Go apps but from how it works (from what I heard), it should work.
I think we can close this ticket:
GODEBUG=multipathtcp=1
to force an app to use MPTCP instead of TCP
Describe the bug I have a TCP client written in Golang and I find out that MPTCP can't be enabled by mptcpize.
My code is just serval lines (make a tcp connection to 192.168.0.1:4323 and quit, server is not running btw):
Using mptcpsize to run, the output lacks mptcpize debug message which means it changed protocol to IPPROTO_MPTCP (Please ignore the error):
Using strace to find out the syscall:
I have also verified TCP options via tcpdump, mptcp capable is not exist.
On the same machine, run iperf3 with mptcpsize, the output shows the protocol is changed(Please ignore the error):
Using strace to trace iperf3 socket syscall:
My guess is that the extra flags SOCK_CLOEXEC|SOCK_NONBLOCK added by GoLang std are causing this issue, am I right, how to avoid it?
To Reproduce Steps to reproduce the behavior:
Expected behavior MPTCP can be enabled by mptcpize on Golang process.
Screenshots NA.
Desktop (please complete the following information):
Additional context Add any other context about the problem here.