kk Blog —— 通用基础


date [-d @int|str] [+%s|"+%F %T"]
netstat -ltunp
sar -n DEV 1

MPTCP mptcp_v6_mapped bug

https://github.com/multipath-tcp/mptcp/issues/501

git log -p -1 6baa3e5d7fd3e8efa6e9ced5f1ee22547c0889d1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
commit 6baa3e5d7fd3e8efa6e9ced5f1ee22547c0889d1
Author: Matthieu Baerts <matthieu.baerts@tessares.net>
Date:   Thu Dec 29 15:35:24 2022 +0100

    mptcp: set icsk_af_ops to mptcp_v6 one if mptcp
    
    abcdxyzk recently opened a very detailed bug report on Github where it
    is noticed that surprisingly, AF_INET{4,6} operations were set to MPTCP
    specific functions if the attached connection was *not* an MPTCP one.
    
    This is a typo of course.
    
    As explained by Christoph, there was no consequences: mptcp_v6_mapped
    only changes conn_request to mptcp_conn_request(): that's only important
    with listening sockets, not used here then.
    
    Anyway, it is still better to properly fix that just in case other
    functions from mptcp_v6_mapped are modified later.
    
    Closes: https://github.com/multipath-tcp/mptcp/issues/501
    Fixes: db745ef1568d ("mptcp: Only access the sysctl once to detect mptcp-enabled")
    Suggested-by: Christoph Paasch <cpaasch@apple.com>
    Reviewed-by: Timothée Boucher-Lambert <timothee.boucher-lambert@tessares.net>
    Acked-by: Christoph Paasch <cpaasch@apple.com>
    Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
    (cherry picked from commit edd63c2dab7ecb48b1613d112d2779c222d2bec1)
    Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
    (cherry picked from commit 772b4de2997d6bcda92ca37afa9f69ed853c6b7a)
    Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>

diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 2e262aa2674a..bbdd53191c35 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1161,7 +1161,7 @@ struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff *skb,
      /* We must check on the request-socket because the listener
       * socket's flag may have been changed halfway through.
       */
-     if (!inet_rsk(req)->saw_mpc)
+     if (inet_rsk(req)->saw_mpc)
          inet_csk(newsk)->icsk_af_ops = &mptcp_v6_mapped;
      else
 #endif