Skip to content

Commit 04fac2c

Browse files
matttbedavem330
authored andcommitted
mptcp: fix opt size when sending DSS + MP_FAIL
When these two options had to be sent -- which is not common -- the DSS size was not being taken into account in the remaining size. Additionally in this situation, the reported size was only the one of the MP_FAIL which can cause issue if at the end, we need to write more in the TCP options than previously said. Here we use a dedicated variable for MP_FAIL size to keep the WARN_ON_ONCE() just after. Fixes: c25aeb4 ("mptcp: MP_FAIL suboption sending") Acked-and-tested-by: Geliang Tang <[email protected]> Signed-off-by: Matthieu Baerts <[email protected]> Signed-off-by: Mat Martineau <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 14676c0 commit 04fac2c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

net/mptcp/options.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -821,10 +821,13 @@ bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,
821821
if (mptcp_established_options_mp(sk, skb, snd_data_fin, &opt_size, remaining, opts))
822822
ret = true;
823823
else if (mptcp_established_options_dss(sk, skb, snd_data_fin, &opt_size, remaining, opts)) {
824+
unsigned int mp_fail_size;
825+
824826
ret = true;
825-
if (mptcp_established_options_mp_fail(sk, &opt_size, remaining, opts)) {
826-
*size += opt_size;
827-
remaining -= opt_size;
827+
if (mptcp_established_options_mp_fail(sk, &mp_fail_size,
828+
remaining - opt_size, opts)) {
829+
*size += opt_size + mp_fail_size;
830+
remaining -= opt_size - mp_fail_size;
828831
return true;
829832
}
830833
}

0 commit comments

Comments
 (0)