Commit Graph

14 Commits

Author SHA1 Message Date
Davide Caratti 57ea21e07f mptcp: prefer strscpy over strcpy
JIRA: https://issues.redhat.com/browse/RHEL-62871
Upstream Status: net.git commit 5eae7a8202f368a77ff0148729a9fa73cc24033a

commit 5eae7a8202f368a77ff0148729a9fa73cc24033a
Author: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Date:   Mon May 13 18:13:29 2024 -0700

    mptcp: prefer strscpy over strcpy

    strcpy() performs no bounds checking on the destination buffer. This
    could result in linear overflows beyond the end of the buffer, leading
    to all kinds of misbehaviors. The safe replacement is strscpy() [1].

    This is in preparation of a possible future step where all strcpy() uses
    will be removed in favour of strscpy() [2].

    This fixes CheckPatch warnings:

      WARNING: Prefer strscpy over strcpy

    Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy [1]
    Link: https://github.com/KSPP/linux/issues/88 [2]
    Reviewed-by: Geliang Tang <geliang@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Mat Martineau <martineau@kernel.org>
    Link: https://lore.kernel.org/r/20240514011335.176158-6-martineau@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Davide Caratti <dcaratti@redhat.com>
2024-11-12 10:18:59 +01:00
Paolo Abeni 0874ffceee mptcp: add a new sysctl for make after break timeout
JIRA: https://issues.redhat.com/browse/RHEL-15036
Tested: LNST, Tier1

Upstream commit:
commit d866ae9aaa4325f1097e8b7a50f202348ca89b87
Author: Paolo Abeni <pabeni@redhat.com>
Date:   Mon Oct 23 13:44:34 2023 -0700

    mptcp: add a new sysctl for make after break timeout

    The MPTCP protocol allows sockets with no alive subflows to stay
    in ESTABLISHED status for and user-defined timeout, to allow for
    later subflows creation.

    Currently such timeout is constant - TCP_TIMEWAIT_LEN. Let the
    user-space configure them via a newly added sysctl, to better cope
    with busy servers and simplify (make them faster) the relevant
    pktdrill tests.

    Note that the new know does not apply to orphaned MPTCP socket
    waiting for the data_fin handshake completion: they always wait
    TCP_TIMEWAIT_LEN.

    Reviewed-by: Mat Martineau <martineau@kernel.org>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Mat Martineau <martineau@kernel.org>
    Link: https://lore.kernel.org/r/20231023-send-net-next-20231023-2-v1-1-9dc60939d371@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2023-10-31 21:50:28 +01:00
Paolo Abeni 7060756d39 mptcp: add a new sysctl scheduler
JIRA: https://issues.redhat.com/browse/RHEL-15036
Tested: LNST, Tier1

Upstream commit:
commit e3b2870b6d220d1cbd2d52d7acc9f0de9fdfeccf
Author: Geliang Tang <geliang.tang@suse.com>
Date:   Mon Aug 21 15:25:15 2023 -0700

    mptcp: add a new sysctl scheduler

    This patch adds a new sysctl, named scheduler, to support for selection
    of different schedulers. Export mptcp_get_scheduler helper to get this
    sysctl.

    Acked-by: Paolo Abeni <pabeni@redhat.com>
    Reviewed-by: Mat Martineau <martineau@kernel.org>
    Signed-off-by: Geliang Tang <geliang.tang@suse.com>
    Signed-off-by: Mat Martineau <martineau@kernel.org>
    Link: https://lore.kernel.org/r/20230821-upstream-net-next-20230818-v1-4-0c860fb256a8@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2023-10-31 21:50:01 +01:00
Davide Caratti b941ea6459 mptcp: Add a per-namespace sysctl to set the default path manager type
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2079368
Upstream Status: net-next.git commit 6bb63ccc25d4

commit 6bb63ccc25d4a8cb8fe48efeda680cb13f84d1b0
Author: Mat Martineau <mathew.j.martineau@linux.intel.com>
Date:   Wed Apr 27 15:50:01 2022 -0700

    mptcp: Add a per-namespace sysctl to set the default path manager type

    The new net.mptcp.pm_type sysctl determines which path manager will be
    used by each newly-created MPTCP socket.

    v2: Handle builds without CONFIG_SYSCTL
    v3: Clarify logic for type-specific PM init (Geliang Tang and Paolo Abeni)

    Acked-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Davide Caratti <dcaratti@redhat.com>
2022-05-06 11:03:23 +02:00
Davide Caratti 4f799dd2da mptcp: disable by default
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2044392
Depends: https://bugzilla.redhat.com/show_bug.cgi?id=2028420
Upstream Status: RHEL only
Tested: boot-test + ran kselftests

set 0 as default value for net.mptcp.enabled and adjust the kselftest
scripts to:
 - expect the opposite default
 - explicitly enable MPTCP before requesting IPPROTO_MPTCP to the kernel

Same as RHEL8 commit 55d8d0e12006 ("mptcp: mark tech preview and disable
by default"), without tech preview marking.

Signed-off-by: Davide Caratti <dcaratti@redhat.com>
2022-01-25 16:28:49 +01:00
Paolo Abeni a3399656a5 mptcp: faster active backup recovery
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2028420
Tested: LNST, Tier1

Upstream commit:
commit ff5a0b421cb23bf6b2898939ffef5b683045d9d3
Author: Paolo Abeni <pabeni@redhat.com>
Date:   Fri Aug 13 15:15:45 2021 -0700

    mptcp: faster active backup recovery

    The msk can use backup subflows to transmit in-sequence data
    only if there are no other active subflow. On active backup
    scenario, the MPTCP connection can do forward progress only
    due to MPTCP retransmissions - rtx can pick backup subflows.

    This patch introduces a new flag flow MPTCP subflows: if the
    underlying TCP connection made no progresses for long time,
    and there are other less problematic subflows available, the
    given subflow become stale.

    Stale subflows are not considered active: if all non backup
    subflows become stale, the MPTCP scheduler can pick backup
    subflows for plain transmissions.

    Stale subflows can return in active state, as soon as any reply
    from the peer is observed.

    Active backup scenarios can now leverage the available b/w
    with no restrinction.

    Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/207
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2022-01-11 11:06:52 +01:00
Paolo Abeni 32403801b6 mptcp: cleanup sysctl data and helpers
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2028420
Tested: LNST, Tier1

Upstream commit:
commit 6da14d74e2bd07bca2cba10878dda5dc0485d59c
Author: Paolo Abeni <pabeni@redhat.com>
Date:   Fri Aug 13 15:15:44 2021 -0700

    mptcp: cleanup sysctl data and helpers

    Reorder the data in mptcp_pernet to avoid wasting space
    with no reasons and constify the access helpers.

    No functional changes intended.

    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2022-01-11 11:06:51 +01:00
Geliang Tang d2f77960e5 mptcp: add sysctl allow_join_initial_addr_port
This patch added a new sysctl, named allow_join_initial_addr_port, to
control whether allow peers to send join requests to the IP address and
port number used by the initial subflow.

Suggested-by: Florian Westphal <fw@strlen.de>
Acked-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-06-22 14:36:01 -07:00
Geliang Tang fc3c82eebf mptcp: add a new sysctl checksum_enabled
This patch added a new sysctl, named checksum_enabled, to control
whether DSS checksum can be enabled.

Acked-by: Paolo Abeni <pabeni@redhat.com>
Co-developed-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-06-18 11:40:11 -07:00
Matthieu Baerts 744ee14054 mptcp: restrict values of 'enabled' sysctl
To avoid confusions, it seems better to parse this sysctl parameter as a
boolean. We use it as a boolean, no need to parse an integer and bring
confusions if we see a value different from 0 and 1, especially with
this parameter name: enabled.

It seems fine to do this modification because the default value is 1
(enabled). Then the only other interesting value to set is 0 (disabled).
All other values would not have changed the default behaviour.

Suggested-by: Florian Westphal <fw@strlen.de>
Acked-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2021-05-28 13:59:16 -07:00
Matthieu Baerts 804c72eeec mptcp: support SYSCTL only if enabled
Since the introduction of the sysctl support in MPTCP with
commit 784325e9f0 ("mptcp: new sysctl to control the activation per NS"),
we don't check CONFIG_SYSCTL.

Until now, that was not an issue: the register and unregister functions
were replaced by NO-OP one if SYSCTL was not enabled in the config. The
only thing we could have avoid is not to reserve memory for the table
but that's for the moment only a small table per net-ns.

But the following commit is going to use SYSCTL_ZERO and SYSCTL_ONE
which are not be defined if SYSCTL is not enabled in the config. This
causes 'undefined reference' errors from the linker.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2021-05-28 13:59:16 -07:00
Geliang Tang 93f323b9cc mptcp: add a new sysctl add_addr_timeout
This patch added a new sysctl, named add_addr_timeout, to control the
timeout value (in seconds) of the ADD_ADDR retransmission.

Suggested-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Suggested-by: Paolo Abeni <pabeni@redhat.com>
Acked-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-04 17:45:53 -08:00
Florian Westphal 9466a1cceb mptcp: enable JOIN requests even if cookies are in use
JOIN requests do not work in syncookie mode -- for HMAC validation, the
peers nonce and the mptcp token (to obtain the desired connection socket
the join is for) are required, but this information is only present in the
initial syn.

So either we need to drop all JOIN requests once a listening socket enters
syncookie mode, or we need to store enough state to reconstruct the request
socket later.

This adds a state table (1024 entries) to store the data present in the
MP_JOIN syn request and the random nonce used for the cookie syn/ack.

When a MP_JOIN ACK passed cookie validation, the table is consulted
to rebuild the request socket from it.

An alternate approach would be to "cancel" syn-cookie mode and force
MP_JOIN to always use a syn queue entry.

However, doing so brings the backlog over the configured queue limit.

v2: use req->syncookie, not (removed) want_cookie arg

Suggested-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-07-31 16:55:32 -07:00
Matthieu Baerts 784325e9f0 mptcp: new sysctl to control the activation per NS
New MPTCP sockets will return -ENOPROTOOPT if MPTCP support is disabled
for the current net namespace.

We are providing here a way to control access to the feature for those
that need to turn it on or off.

The value of this new sysctl can be different per namespace. We can then
restrict the usage of MPTCP to the selected NS. In case of serious
issues with MPTCP, administrators can now easily turn MPTCP off.

Co-developed-by: Peter Krystad <peter.krystad@linux.intel.com>
Signed-off-by: Peter Krystad <peter.krystad@linux.intel.com>
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: Christoph Paasch <cpaasch@apple.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-24 13:44:08 +01:00