mptcp: mib: count MPJ with backup flag
authorMatthieu Baerts (NGI0) <matttbe@kernel.org>
Sat, 27 Jul 2024 10:01:26 +0000 (12:01 +0200)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 30 Jul 2024 08:27:30 +0000 (10:27 +0200)
Without such counters, it is difficult to easily debug issues with MPJ
not having the backup flags on production servers.

This is not strictly a fix, but it eases to validate the following
patches without requiring to take packet traces, to query ongoing
connections with Netlink with admin permissions, or to guess by looking
at the behaviour of the packet scheduler. Also, the modification is self
contained, isolated, well controlled, and the increments are done just
after others, there from the beginning. It looks then safe, and helpful
to backport this.

Fixes: 4596a2c1b7f5 ("mptcp: allow creating non-backup subflows")
Cc: stable@vger.kernel.org
Reviewed-by: Mat Martineau <martineau@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
net/mptcp/mib.c
net/mptcp/mib.h
net/mptcp/subflow.c

index c30405e7683370d3e3f422ac9a7b0c625348b1ae..7884217f33eb2f75ea76086c7f7fbea7106b0c1a 100644 (file)
@@ -19,7 +19,9 @@ static const struct snmp_mib mptcp_snmp_list[] = {
        SNMP_MIB_ITEM("MPTCPRetrans", MPTCP_MIB_RETRANSSEGS),
        SNMP_MIB_ITEM("MPJoinNoTokenFound", MPTCP_MIB_JOINNOTOKEN),
        SNMP_MIB_ITEM("MPJoinSynRx", MPTCP_MIB_JOINSYNRX),
+       SNMP_MIB_ITEM("MPJoinSynBackupRx", MPTCP_MIB_JOINSYNBACKUPRX),
        SNMP_MIB_ITEM("MPJoinSynAckRx", MPTCP_MIB_JOINSYNACKRX),
+       SNMP_MIB_ITEM("MPJoinSynAckBackupRx", MPTCP_MIB_JOINSYNACKBACKUPRX),
        SNMP_MIB_ITEM("MPJoinSynAckHMacFailure", MPTCP_MIB_JOINSYNACKMAC),
        SNMP_MIB_ITEM("MPJoinAckRx", MPTCP_MIB_JOINACKRX),
        SNMP_MIB_ITEM("MPJoinAckHMacFailure", MPTCP_MIB_JOINACKMAC),
index 2704afd0dfe45249b1789d1c31732a982eafee65..66aa67f49d032c75e2821ed69be24b41e30a956a 100644 (file)
@@ -14,7 +14,9 @@ enum linux_mptcp_mib_field {
        MPTCP_MIB_RETRANSSEGS,          /* Segments retransmitted at the MPTCP-level */
        MPTCP_MIB_JOINNOTOKEN,          /* Received MP_JOIN but the token was not found */
        MPTCP_MIB_JOINSYNRX,            /* Received a SYN + MP_JOIN */
+       MPTCP_MIB_JOINSYNBACKUPRX,      /* Received a SYN + MP_JOIN + backup flag */
        MPTCP_MIB_JOINSYNACKRX,         /* Received a SYN/ACK + MP_JOIN */
+       MPTCP_MIB_JOINSYNACKBACKUPRX,   /* Received a SYN/ACK + MP_JOIN + backup flag */
        MPTCP_MIB_JOINSYNACKMAC,        /* HMAC was wrong on SYN/ACK + MP_JOIN */
        MPTCP_MIB_JOINACKRX,            /* Received an ACK + MP_JOIN */
        MPTCP_MIB_JOINACKMAC,           /* HMAC was wrong on ACK + MP_JOIN */
index a3778aee4e77f8dadc0b32500ee976a65aef8f86..be406197b1c4fd87e9c8dfd22d30fd2380c0f2b7 100644 (file)
@@ -168,6 +168,9 @@ static int subflow_check_req(struct request_sock *req,
                        return 0;
        } else if (opt_mp_join) {
                SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINSYNRX);
+
+               if (mp_opt.backup)
+                       SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINSYNBACKUPRX);
        }
 
        if (opt_mp_capable && listener->request_mptcp) {
@@ -577,6 +580,9 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb)
                subflow->mp_join = 1;
                MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNACKRX);
 
+               if (subflow->backup)
+                       MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNACKBACKUPRX);
+
                if (subflow_use_different_dport(msk, sk)) {
                        pr_debug("synack inet_dport=%d %d",
                                 ntohs(inet_sk(sk)->inet_dport),