Skip to content

Commit 1e75629

Browse files
geliangtangkuba-moo
authored andcommitted
mptcp: add the mibs for MP_FASTCLOSE
This patch added two more mibs for MP_FASTCLOSE, MPTCP_MIB_MPFASTCLOSETX for the MP_FASTCLOSE sending and MPTCP_MIB_MPFASTCLOSERX for receiving. Also added a debug log for MP_FASTCLOSE receiving, printed out the recv_key of MP_FASTCLOSE in mptcp_parse_option to show that MP_RST is received. Signed-off-by: Geliang Tang <[email protected]> Signed-off-by: Mat Martineau <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 9a0a936 commit 1e75629

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

net/mptcp/mib.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ static const struct snmp_mib mptcp_snmp_list[] = {
4848
SNMP_MIB_ITEM("MPPrioRx", MPTCP_MIB_MPPRIORX),
4949
SNMP_MIB_ITEM("MPFailTx", MPTCP_MIB_MPFAILTX),
5050
SNMP_MIB_ITEM("MPFailRx", MPTCP_MIB_MPFAILRX),
51+
SNMP_MIB_ITEM("MPFastcloseTx", MPTCP_MIB_MPFASTCLOSETX),
52+
SNMP_MIB_ITEM("MPFastcloseRx", MPTCP_MIB_MPFASTCLOSERX),
5153
SNMP_MIB_ITEM("RcvPruned", MPTCP_MIB_RCVPRUNED),
5254
SNMP_MIB_ITEM("SubflowStale", MPTCP_MIB_SUBFLOWSTALE),
5355
SNMP_MIB_ITEM("SubflowRecover", MPTCP_MIB_SUBFLOWRECOVER),

net/mptcp/mib.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ enum linux_mptcp_mib_field {
4141
MPTCP_MIB_MPPRIORX, /* Received a MP_PRIO */
4242
MPTCP_MIB_MPFAILTX, /* Transmit a MP_FAIL */
4343
MPTCP_MIB_MPFAILRX, /* Received a MP_FAIL */
44+
MPTCP_MIB_MPFASTCLOSETX, /* Transmit a MP_FASTCLOSE */
45+
MPTCP_MIB_MPFASTCLOSERX, /* Received a MP_FASTCLOSE */
4446
MPTCP_MIB_RCVPRUNED, /* Incoming packet dropped due to memory limit */
4547
MPTCP_MIB_SUBFLOWSTALE, /* Subflows entered 'stale' status */
4648
MPTCP_MIB_SUBFLOWRECOVER, /* Subflows returned to active status after being stale */

net/mptcp/options.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ static void mptcp_parse_option(const struct sk_buff *skb,
323323
mp_opt->rcvr_key = get_unaligned_be64(ptr);
324324
ptr += 8;
325325
mp_opt->suboptions |= OPTION_MPTCP_FASTCLOSE;
326+
pr_debug("MP_FASTCLOSE: recv_key=%llu", mp_opt->rcvr_key);
326327
break;
327328

328329
case MPTCPOPT_RST:
@@ -832,6 +833,7 @@ bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,
832833
mptcp_established_options_mp_fail(sk, &opt_size, remaining, opts)) {
833834
*size += opt_size;
834835
remaining -= opt_size;
836+
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPFASTCLOSETX);
835837
}
836838
/* MP_RST can be used with MP_FASTCLOSE and MP_FAIL if there is room */
837839
if (mptcp_established_options_rst(sk, skb, &opt_size, remaining, opts)) {
@@ -1124,6 +1126,7 @@ bool mptcp_incoming_options(struct sock *sk, struct sk_buff *skb)
11241126
msk->local_key == mp_opt.rcvr_key) {
11251127
WRITE_ONCE(msk->rcv_fastclose, true);
11261128
mptcp_schedule_work((struct sock *)msk);
1129+
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPFASTCLOSERX);
11271130
}
11281131

11291132
if ((mp_opt.suboptions & OPTION_MPTCP_ADD_ADDR) &&

0 commit comments

Comments
 (0)