Skip to content

Commit 0c1f78a

Browse files
Paolo Abenikuba-moo
authored andcommitted
mptcp: fix error mibs accounting
The current accounting for MP_FAIL and FASTCLOSE is not very accurate: both can be increased even when the related option is not really sent. Move the accounting into the correct place. Fixes: eb7f336 ("mptcp: add the mibs for MP_FAIL") Fixes: 1e75629 ("mptcp: add the mibs for MP_FASTCLOSE") Signed-off-by: Paolo Abeni <[email protected]> Signed-off-by: Mat Martineau <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent ab84db2 commit 0c1f78a

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

net/mptcp/options.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,7 @@ static noinline bool mptcp_established_options_rst(struct sock *sk, struct sk_bu
765765
opts->suboptions |= OPTION_MPTCP_RST;
766766
opts->reset_transient = subflow->reset_transient;
767767
opts->reset_reason = subflow->reset_reason;
768+
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPRSTTX);
768769

769770
return true;
770771
}
@@ -788,6 +789,7 @@ static bool mptcp_established_options_fastclose(struct sock *sk,
788789
opts->rcvr_key = msk->remote_key;
789790

790791
pr_debug("FASTCLOSE key=%llu", opts->rcvr_key);
792+
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPFASTCLOSETX);
791793
return true;
792794
}
793795

@@ -809,6 +811,7 @@ static bool mptcp_established_options_mp_fail(struct sock *sk,
809811
opts->fail_seq = subflow->map_seq;
810812

811813
pr_debug("MP_FAIL fail_seq=%llu", opts->fail_seq);
814+
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPFAILTX);
812815

813816
return true;
814817
}
@@ -833,13 +836,11 @@ bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,
833836
mptcp_established_options_mp_fail(sk, &opt_size, remaining, opts)) {
834837
*size += opt_size;
835838
remaining -= opt_size;
836-
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPFASTCLOSETX);
837839
}
838840
/* MP_RST can be used with MP_FASTCLOSE and MP_FAIL if there is room */
839841
if (mptcp_established_options_rst(sk, skb, &opt_size, remaining, opts)) {
840842
*size += opt_size;
841843
remaining -= opt_size;
842-
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPRSTTX);
843844
}
844845
return true;
845846
}

net/mptcp/pm.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,6 @@ void mptcp_pm_mp_fail_received(struct sock *sk, u64 fail_seq)
310310
pr_debug("send MP_FAIL response and infinite map");
311311

312312
subflow->send_mp_fail = 1;
313-
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPFAILTX);
314313
subflow->send_infinite_map = 1;
315314
} else if (!sock_flag(sk, SOCK_DEAD)) {
316315
pr_debug("MP_FAIL response received");

net/mptcp/subflow.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -958,10 +958,8 @@ static enum mapping_status validate_data_csum(struct sock *ssk, struct sk_buff *
958958
subflow->map_data_csum);
959959
if (unlikely(csum)) {
960960
MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_DATACSUMERR);
961-
if (subflow->mp_join || subflow->valid_csum_seen) {
961+
if (subflow->mp_join || subflow->valid_csum_seen)
962962
subflow->send_mp_fail = 1;
963-
MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_MPFAILTX);
964-
}
965963
return subflow->mp_join ? MAPPING_INVALID : MAPPING_DUMMY;
966964
}
967965

0 commit comments

Comments
 (0)