This is mainly to be sync with what is done in mptcp_write_options()
where after having written the ADD_ADDR option, we check if the RM_ADDR
option also needs to be added.
But if we have room, it makes sense to write the two options in the same
packet. So best to remove the 'else'.
While at it, also mention that mptcp_established_options_add_addr() can
remove options.
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
---
net/mptcp/options.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/net/mptcp/options.c b/net/mptcp/options.c
index 8553b928c5bf..06f64101d27b 100644
--- a/net/mptcp/options.c
+++ b/net/mptcp/options.c
@@ -864,11 +864,14 @@ bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,
*size += opt_size;
remaining -= opt_size;
+ /* Note: this can remove previously set options in some conditions */
if (mptcp_established_options_add_addr(sk, skb, &opt_size, remaining, opts)) {
*size += opt_size;
remaining -= opt_size;
ret = true;
- } else if (mptcp_established_options_rm_addr(sk, &opt_size, remaining, opts)) {
+ }
+
+ if (mptcp_established_options_rm_addr(sk, &opt_size, remaining, opts)) {
*size += opt_size;
remaining -= opt_size;
ret = true;
--
2.33.1