Commit Graph

6 Commits

Author SHA1 Message Date
Davide Caratti e1742e5983 mptcp: pr_debug: add missing \n at the end
JIRA: https://issues.redhat.com/browse/RHEL-62871
Upstream Status: net.git commit cb41b195e634d3f1ecfcd845314e64fd4bb3c7aa
Conflicts:
 - net/mptcp/protocol.c: preserve the old version of inet_csk_accept()
   as we don't have upstream commit 92ef0fd55ac8 ("net: change proto and
   proto_ops accept type")

commit cb41b195e634d3f1ecfcd845314e64fd4bb3c7aa
Author: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Date:   Mon Aug 26 19:11:21 2024 +0200

    mptcp: pr_debug: add missing \n at the end

    pr_debug() have been added in various places in MPTCP code to help
    developers to debug some situations. With the dynamic debug feature, it
    is easy to enable all or some of them, and asks users to reproduce
    issues with extra debug.

    Many of these pr_debug() don't end with a new line, while no 'pr_cont()'
    are used in MPTCP code. So the goal was not to display multiple debug
    messages on one line: they were then not missing the '\n' on purpose.
    Not having the new line at the end causes these messages to be printed
    with a delay, when something else needs to be printed. This issue is not
    visible when many messages need to be printed, but it is annoying and
    confusing when only specific messages are expected, e.g.

      # echo "func mptcp_pm_add_addr_echoed +fmp" \
            > /sys/kernel/debug/dynamic_debug/control
      # ./mptcp_join.sh "signal address"; \
            echo "$(awk '{print $1}' /proc/uptime) - end"; \
            sleep 5s; \
            echo "$(awk '{print $1}' /proc/uptime) - restart"; \
            ./mptcp_join.sh "signal address"
      013 signal address
          (...)
      10.75 - end
      15.76 - restart
      013 signal address
      [  10.367935] mptcp:mptcp_pm_add_addr_echoed: MPTCP: msk=(...)
          (...)

      => a delay of 5 seconds: printed with a 10.36 ts, but after 'restart'
         which was printed at the 15.76 ts.

    The 'Fixes' tag here below points to the first pr_debug() used without
    '\n' in net/mptcp. This patch could be split in many small ones, with
    different Fixes tag, but it doesn't seem worth it, because it is easy to
    re-generate this patch with this simple 'sed' command:

      git grep -l pr_debug -- net/mptcp |
        xargs sed -i "s/\(pr_debug(\".*[^n]\)\(\"[,)]\)/\1\\\n\2/g"

    So in case of conflicts, simply drop the modifications, and launch this
    command.

    Fixes: f870fa0b57 ("mptcp: Add MPTCP socket stubs")
    Cc: stable@vger.kernel.org
    Reviewed-by: Geliang Tang <geliang@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Link: https://patch.msgid.link/20240826-net-mptcp-close-extra-sf-fin-v1-4-905199fe1172@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Davide Caratti <dcaratti@redhat.com>
2024-11-12 10:19:01 +01:00
Davide Caratti d91c423354 mptcp: corner case locking for rx path fields initialization
JIRA: https://issues.redhat.com/browse/RHEL-32669
Upstream Status: net.git commit e4a0fa47e816e186f6b4c0055d07eeec42d11871

commit e4a0fa47e816e186f6b4c0055d07eeec42d11871
Author: Paolo Abeni <pabeni@redhat.com>
Date:   Thu Feb 8 19:03:52 2024 +0100

    mptcp: corner case locking for rx path fields initialization

    Most MPTCP-level related fields are under the mptcp data lock
    protection, but are written one-off without such lock at MPC
    complete time, both for the client and the server

    Leverage the mptcp_propagate_state() infrastructure to move such
    initialization under the proper lock client-wise.

    The server side critical init steps are done by
    mptcp_subflow_fully_established(): ensure the caller properly held the
    relevant lock, and avoid acquiring the same lock in the nested scopes.

    There are no real potential races, as write access to such fields
    is implicitly serialized by the MPTCP state machine; the primary
    goal is consistency.

    Fixes: d22f4988ff ("mptcp: process MP_CAPABLE data option")
    Cc: stable@vger.kernel.org
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Reviewed-by: Mat Martineau <martineau@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Davide Caratti <dcaratti@redhat.com>
2024-04-18 17:25:35 +02:00
Paolo Abeni 43a0d5d140 mptcp: properly account fastopen data
JIRA: https://issues.redhat.com/browse/RHEL-15036
Tested: LNST, Tier1

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

    mptcp: properly account fastopen data

    Currently the socket level counter aggregating the received data
    does not take in account the data received via fastopen.

    Address the issue updating the counter as required.

    Fixes: 38967f424b5b ("mptcp: track some aggregate data counters")
    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-2-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
Davide Caratti 59608311a6 mptcp: fix NULL pointer dereference on fastopen early fallback
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2193330
Upstream Status: net.git commit c0ff6f6da66a

commit c0ff6f6da66a7791a32c0234388b1bdc00244917
Author: Paolo Abeni <pabeni@redhat.com>
Date:   Tue Apr 11 22:42:11 2023 +0200

    mptcp: fix NULL pointer dereference on fastopen early fallback

    In case of early fallback to TCP, subflow_syn_recv_sock() deletes
    the subflow context before returning the newly allocated sock to
    the caller.

    The fastopen path does not cope with the above unconditionally
    dereferencing the subflow context.

    Fixes: 36b122baf6a8 ("mptcp: add subflow_v(4,6)_send_synack()")
    Cc: stable@vger.kernel.org
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Reviewed-by: Matthieu Baerts <matthieu.baerts@tessares.net>
    Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Davide Caratti <dcaratti@redhat.com>
2023-05-11 11:46:49 +02:00
Davide Caratti 475d2f3fa2 mptcp: add subflow_v(4,6)_send_synack()
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2193330
Upstream Status: net.git commit 36b122baf6a8

commit 36b122baf6a8bd46b4a591f12f4ed17b22257408
Author: Dmytro Shytyi <dmytro@shytyi.net>
Date:   Fri Nov 25 23:29:51 2022 +0100

    mptcp: add subflow_v(4,6)_send_synack()

    The send_synack() needs to be overridden for MPTCP to support TFO for
    two reasons:

    - There is not be enough space in the TCP options if the TFO cookie has
      to be added in the SYN+ACK with other options: MSS (4), SACK OK (2),
      Timestamps (10), Window Scale (3+1), TFO (10+2), MP_CAPABLE (12).
      MPTCPv1 specs -- RFC 8684, section B.1 [1] -- suggest to drop the TCP
      timestamps option in this case.

    - The data received in the SYN has to be handled: the SKB can be
      dequeued from the subflow sk and transferred to the MPTCP sk. Counters
      need to be updated accordingly and the application can be notified at
      the end because some bytes have been received.

    [1] https://www.rfc-editor.org/rfc/rfc8684.html#section-b.1

    Co-developed-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-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: Dmytro Shytyi <dmytro@shytyi.net>
    Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Davide Caratti <dcaratti@redhat.com>
2023-05-11 11:46:44 +02:00
Davide Caratti f1fc111f49 mptcp: implement delayed seq generation for passive fastopen
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2193330
Upstream Status: net.git commit dfc8d0603033

commit dfc8d06030335a816d81aa92fe5d1f84d06998ad
Author: Dmytro Shytyi <dmytro@shytyi.net>
Date:   Fri Nov 25 23:29:50 2022 +0100

    mptcp: implement delayed seq generation for passive fastopen

    With fastopen in place, the first subflow socket is created before the
    MPC handshake completes, and we need to properly initialize the sequence
    numbers at MPC ACK reception.

    Co-developed-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-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: Dmytro Shytyi <dmytro@shytyi.net>
    Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Davide Caratti <dcaratti@redhat.com>
2023-05-11 11:46:44 +02:00