Commit 0c1f78a4 authored by Paolo Abeni's avatar Paolo Abeni Committed by Jakub Kicinski

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: eb7f3365 ("mptcp: add the mibs for MP_FAIL")
Fixes: 1e75629c ("mptcp: add the mibs for MP_FASTCLOSE")
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
Signed-off-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent ab84db25
...@@ -765,6 +765,7 @@ static noinline bool mptcp_established_options_rst(struct sock *sk, struct sk_bu ...@@ -765,6 +765,7 @@ static noinline bool mptcp_established_options_rst(struct sock *sk, struct sk_bu
opts->suboptions |= OPTION_MPTCP_RST; opts->suboptions |= OPTION_MPTCP_RST;
opts->reset_transient = subflow->reset_transient; opts->reset_transient = subflow->reset_transient;
opts->reset_reason = subflow->reset_reason; opts->reset_reason = subflow->reset_reason;
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPRSTTX);
return true; return true;
} }
...@@ -788,6 +789,7 @@ static bool mptcp_established_options_fastclose(struct sock *sk, ...@@ -788,6 +789,7 @@ static bool mptcp_established_options_fastclose(struct sock *sk,
opts->rcvr_key = msk->remote_key; opts->rcvr_key = msk->remote_key;
pr_debug("FASTCLOSE key=%llu", opts->rcvr_key); pr_debug("FASTCLOSE key=%llu", opts->rcvr_key);
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPFASTCLOSETX);
return true; return true;
} }
...@@ -809,6 +811,7 @@ static bool mptcp_established_options_mp_fail(struct sock *sk, ...@@ -809,6 +811,7 @@ static bool mptcp_established_options_mp_fail(struct sock *sk,
opts->fail_seq = subflow->map_seq; opts->fail_seq = subflow->map_seq;
pr_debug("MP_FAIL fail_seq=%llu", opts->fail_seq); pr_debug("MP_FAIL fail_seq=%llu", opts->fail_seq);
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPFAILTX);
return true; return true;
} }
...@@ -833,13 +836,11 @@ bool mptcp_established_options(struct sock *sk, struct sk_buff *skb, ...@@ -833,13 +836,11 @@ bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,
mptcp_established_options_mp_fail(sk, &opt_size, remaining, opts)) { mptcp_established_options_mp_fail(sk, &opt_size, remaining, opts)) {
*size += opt_size; *size += opt_size;
remaining -= opt_size; remaining -= opt_size;
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPFASTCLOSETX);
} }
/* MP_RST can be used with MP_FASTCLOSE and MP_FAIL if there is room */ /* MP_RST can be used with MP_FASTCLOSE and MP_FAIL if there is room */
if (mptcp_established_options_rst(sk, skb, &opt_size, remaining, opts)) { if (mptcp_established_options_rst(sk, skb, &opt_size, remaining, opts)) {
*size += opt_size; *size += opt_size;
remaining -= opt_size; remaining -= opt_size;
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPRSTTX);
} }
return true; return true;
} }
......
...@@ -310,7 +310,6 @@ void mptcp_pm_mp_fail_received(struct sock *sk, u64 fail_seq) ...@@ -310,7 +310,6 @@ void mptcp_pm_mp_fail_received(struct sock *sk, u64 fail_seq)
pr_debug("send MP_FAIL response and infinite map"); pr_debug("send MP_FAIL response and infinite map");
subflow->send_mp_fail = 1; subflow->send_mp_fail = 1;
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPFAILTX);
subflow->send_infinite_map = 1; subflow->send_infinite_map = 1;
} else if (!sock_flag(sk, SOCK_DEAD)) { } else if (!sock_flag(sk, SOCK_DEAD)) {
pr_debug("MP_FAIL response received"); pr_debug("MP_FAIL response received");
......
...@@ -958,10 +958,8 @@ static enum mapping_status validate_data_csum(struct sock *ssk, struct sk_buff * ...@@ -958,10 +958,8 @@ static enum mapping_status validate_data_csum(struct sock *ssk, struct sk_buff *
subflow->map_data_csum); subflow->map_data_csum);
if (unlikely(csum)) { if (unlikely(csum)) {
MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_DATACSUMERR); MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_DATACSUMERR);
if (subflow->mp_join || subflow->valid_csum_seen) { if (subflow->mp_join || subflow->valid_csum_seen)
subflow->send_mp_fail = 1; subflow->send_mp_fail = 1;
MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_MPFAILTX);
}
return subflow->mp_join ? MAPPING_INVALID : MAPPING_DUMMY; return subflow->mp_join ? MAPPING_INVALID : MAPPING_DUMMY;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment