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

support SocketProtocol for both the client and server #547

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

matttbe
Copy link

@matttbe matttbe commented Dec 13, 2024

This adds a new option called SocketProtocol, to allow the users to change the socket protocol, the 3rd parameter of the socket syscall.

A typical use-case is to properly enable MPTCP [1] support: on Linux, to support it, apps have to create a stream socket with the IPPROTO_MPTCP (262) protocol, that's it:

socket(AF_INET(6), SOCK_STREAM, IPPROTO_MPTCP)

So now, to get MPTCP support with SSH commands, the SocketProtocol option can be set to 262, e.g.

$ ssh -o SocketProtocol=262 my-server

Or by adding SocketProtocol 262 in ssh_config or sshd_config.

Other protocols on other OS can then also be used that way, it is not Linux specific as #335 was.

Please note that so far, only workarounds could be used to enable MPTCP support with SSH on Linux, e.g. the LD_PRELOAD technique to change the behaviour of the socket() call. Such workaround has limitations:

  • On the server side:
    • The service to launch the ssh daemon -- something that is usually not modified -- needs to be overridden, it's not just a config to set in the sshd_config file.
    • Also, some sysadmins don't allow LD_PRELOAD techniques, because all TCP sockets created by the service will be modified without sshd's knowledge.
  • On the client side:
    • Each command (ssh, scp, git, etc.) needs to be executed with LD_PRELOAD being set. That's maybe OK for occasional commands, less for regular ones, or for GUI applications.
    • A ProxyCommand option could be used -- e.g. set to ssh -W %h:%p -l %r -p %p %h -- but it is not great because it needs to be adapted for each host to pass some options, e.g. use v4/v6 only, etc.

Hopefully this new option can help users to enable MPTCP support on both the client and server side.

This adds a new option called SocketProtocol, to allow the users to
change the socket protocol, the 3rd parameter of the socket syscall.

A typical use-case is to properly enable MPTCP [1] support: on Linux, to
support it, apps have to create a stream socket with the IPPROTO_MPTCP
(262) protocol, that's it:

  socket(AF_INET(6), SOCK_STREAM, IPPROTO_MPTCP)

So now, to get MPTCP support with SSH commands, the 'SocketProtocol'
option can be set to 262, e.g.

  $ ssh -o SocketProtocol=262 my-server

Or by adding "SocketProtocol 262" in ssh_config or sshd_config.

Other protocols on other OS can then also be used that way.

Link: https://www.mptcp.dev [1]
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
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.

1 participant