1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-21 22:04:01 +03:00
Matthieu Baerts (NGI0) 3f69070598 core/socket: allow MPTCP protocol
Multipath TCP (MPTCP), standardized in RFC8684 [1], is a TCP extension
that enables a TCP connection to use different paths. It allows a device
to make use of multiple interfaces at once to send and receive TCP
packets over a single MPTCP connection. MPTCP can aggregate the
bandwidth of multiple interfaces or prefer the one with the lowest
latency, it also allows a fail-over if one path is down, and the traffic
is seamlessly re-injected on other paths.

To benefit from MPTCP, both the client and the server have to support
it. Multipath TCP is a backward-compatible TCP extension that is enabled
by default on recent Linux distributions (Debian, Ubuntu, Redhat, ...).
Multipath TCP is included in the Linux kernel since version 5.6 [2]. To
use it on Linux, an application must explicitly enable it when creating
the socket:

  int sd = socket(AF_INET(6), SOCK_STREAM, IPPROTO_MPTCP);

No need to change anything else in the application.

This patch allows MPTCP protocol in the Socket unit configuration. So
now, a <unit>.socket can contain this to use MPTCP instead of TCP:

  [Socket]
  SocketProtocol=mptcp

MPTCP support has been allowed similarly to what has been already done
to allow SCTP: just one line in core/socket.c, a very simple addition
thanks to the flexible architecture already in place.

On top of that, IPPROTO_MPTCP has also been added in the list of allowed
protocols in two other places, and in the doc. It has also been added to
the missing_network.h file, for systems with an old libc -- note that it
was also required to include <netinet/in.h> in this file to avoid
redefinition errors.

Link: https://www.rfc-editor.org/rfc/rfc8684.html [1]
Link: https://www.mptcp.dev [2]
2024-06-12 00:14:08 +01:00

119 lines
2.6 KiB
SYSTEMD

socket
# SPDX-License-Identifier: LGPL-2.1-or-later
#
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
[Unit]
Description=Syslog Socket
Documentation=man:systemd.special(7)
Documentation=https://systemd.io/SYSLOG
DefaultDependencies=no
Before=sockets.target
# Don't allow logging until the very end
Conflicts=shutdown.target
Before=shutdown.target
# Don't try to activate syslog.service if sysinit.target has failed.
Conflicts=emergency.service
Before=emergency.service
[Socket]
ListenDatagram=/run/systemd/journal/syslog
SocketMode=0666
PassCredentials=yes
PassSecurity=yes
ReceiveBuffer=8M
# The default syslog implementation should make syslog.service a
# symlink to itself, so that this socket activates the right actual
# syslog service.
#
# Examples:
#
# /etc/systemd/system/syslog.service -> /lib/systemd/system/rsyslog.service
# /etc/systemd/system/syslog.service -> /lib/systemd/system/syslog-ng.service
#
# Best way to achieve that is by adding this to your unit file
# (i.e. to rsyslog.service or syslog-ng.service):
#
# [Install]
# Alias=syslog.service
#
# See https://systemd.io/SYSLOG for details.
[Socket]
ListenStream=1.2.3.4:1234
ListenDatagram=1.2.3.4:1234
ListenSequentialPacket=1.2.3.4:1234
ListenFIFO=
ListenSpecial=
#ListenNetlink=
ListenMessageQueue=
ListenUSBFunction=
SocketProtocol=udplite
SocketProtocol=sctp
SocketProtocol=mptcp
SocketProtocol=
BindIPv6Only=false
Backlog=33
BindToDevice=eth0
SocketUser=daemon
SocketGroup=nobody
SocketMode=0111
DirectoryMode=0555
Accept=true
Accept=false
Writable=true
MaxConnections=11
MaxConnectionsPerSource=12
KeepAlive=yes
KeepAliveTimeSec=12345
KeepAliveIntervalSec=12345
KeepAliveProbes=12345
NoDelay=true
Priority=0
DeferAcceptSec=1
ReceiveBuffer=1G
SendBuffer=1G
IPTOS=low-delay
IPTOS=throughput
IPTOS=reliability
IPTOS=low-cost
IPTOS=
IPTTL=7
Mark=123
ReusePort=true
SmackLabel=smack-label
SmackLabelIPIn=smack-label
SmackLabelIPOut=no idea what to put here
SELinuxContextFromNet=true
PipeSize=11111
MessageQueueMaxMessages=200
MessageQueueMessageSize=200
FreeBind=false
Transparent=true
Broadcast=true
PassCredentials=true
PassSecurity=true
TCPCongestion=westwood
TCPCongestion=veno
TCPCongestion=cubic
TCPCongestion=lp
ExecStartPre=/bin/true "arg ' ' "
ExecStartPost=-!!/bin/false
ExecStopPre=/bin/true
ExecStopPost=-!!/bin/false
TimeoutSec=2343
Symlinks=a b c d e
Symlinks=
Symlinks=/a /b /c /d /e
FileDescriptorName=name
TriggerLimitIntervalSec=2343
TriggerLimitBurst=234