Skip to contentSkip to conversation

mptcp: sockopt: make sync_socket_options propagate SOCK_KEEPOPEN

PATCH Superseded Krister Johansen 4 participants 12 messages Sep 6, 2025 – Sep 8, 2025

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mptcp: sockopt: make sync_socket_options propagate SOCK_KEEPOPEN

Users reported a scenario where MPTCP connections that were configured with SO_KEEPALIVE prior to connect would fail to enable their keepalives if MTPCP fell back to TCP mode.

After investigating, this affects keepalives for any connection where sync_socket_options is called on a socket that is in the closed or listening state. Joins are handled properly. For connects, sync_socket_options is called when the socket is still in the closed state. The tcp_set_keepalive() function does not act on sockets that are closed or listening, hence keepalive is not immediately enabled. Since the SO_KEEPOPEN flag is absent, it is not enabled later in the connect sequence via tcp_finish_connect. Setting the keepalive via sockopt after connect does work, but would not address any subsequently created flows.

Fortunately, the fix here is straight-forward: set SOCK_KEEPOPEN on the subflow when calling sync_socket_options.

The fix was valdidated both by using tcpdump to observe keeplaive packets not being sent before the fix, and being sent after the fix. It was also possible to observe via ss that the keepalive timer was not enabled on these sockets before the fix, but was enabled afterwards.

Fixes 1b3e7ede1365 ("mptcp: setsockopt: handle SO_KEEPALIVE and SO_PRIORITY")
---
 net/mptcp/sockopt.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
net/mptcp/sockopt.c +4 -6
index 2c267aff95be..13108e9f982b 100644
@@ -1532,13 +1532,11 @@ static void sync_socket_options(struct mptcp_sock *msk, struct sock *ssk)
 {
 	static const unsigned int tx_rx_locks = SOCK_RCVBUF_LOCK | SOCK_SNDBUF_LOCK;
 	struct sock *sk = (struct sock *)msk;
+	int kaval = !!sock_flag(sk, SOCK_KEEPOPEN);
 
-	if (ssk->sk_prot->keepalive) {
-		if (sock_flag(sk, SOCK_KEEPOPEN))
-			ssk->sk_prot->keepalive(ssk, 1);
-		else
-			ssk->sk_prot->keepalive(ssk, 0);
-	}
+	if (ssk->sk_prot->keepalive)
+		ssk->sk_prot->keepalive(ssk, kaval);
+	sock_valbool_flag(ssk, SOCK_KEEPOPEN, kaval);
 
 	ssk->sk_priority = sk->sk_priority;
 	ssk->sk_bound_dev_if = sk->sk_bound_dev_if;

base-commit: 319f7385f22c85618235ab0169b80092fa3c7696

Signature · 1 line
2.43.0
reviewer Reviewed-by on v1 1/1
#1 lore raw

Hi Krister,

Quoted 28 lines · Krister Johansen

Users reported a scenario where MPTCP connections that were configured
with SO_KEEPALIVE prior to connect would fail to enable their keepalives
if MTPCP fell back to TCP mode.

After investigating, this affects keepalives for any connection where sync_socket_options is called on a socket that is in the closed or listening state.  Joins are handled properly. For connects, sync_socket_options is called when the socket is still in the closed state.  The tcp_set_keepalive() function does not act on sockets that are closed or listening, hence keepalive is not immediately enabled. Since the SO_KEEPOPEN flag is absent, it is not enabled later in the connect sequence via tcp_finish_connect.  Setting the keepalive via sockopt after connect does work, but would not address any subsequently
created flows.

Fortunately, the fix here is straight-forward: set SOCK_KEEPOPEN on the
subflow when calling sync_socket_options.

The fix was valdidated both by using tcpdump to observe keeplaive packets not being sent before the fix, and being sent after the fix. It
was also possible to observe via ss that the keepalive timer was not enabled on these sockets before the fix, but was enabled afterwards.

Quoted 4 lines
Fixes 1b3e7ede1365 ("mptcp: setsockopt: handle SO_KEEPALIVE and

SO_PRIORITY")

Thanks for this fix. Good catch!

-Geliang

Quoted 30 lines

---
 net/mptcp/sockopt.c | 10 ++++------

 1 file changed, 4 insertions(+), 6 deletions(-)
net/mptcp/sockopt.c +0 -0
index 2c267aff95be..13108e9f982b 100644
@@ -1532,13 +1532,11 @@ static void sync_socket_options(struct
 mptcp_sock *msk, struct sock *ssk)
  {

  static const unsigned int tx_rx_locks = SOCK_RCVBUF_LOCK | SOCK_SNDBUF_LOCK;
  struct sock *sk = (struct sock *)msk;

net/mptcp/sockopt.c +1 -0
+	int kaval = !!sock_flag(sk, SOCK_KEEPOPEN);

net/mptcp/sockopt.c +3 -6
-	if (ssk->sk_prot->keepalive) {
-		if (sock_flag(sk, SOCK_KEEPOPEN))
-			ssk->sk_prot->keepalive(ssk, 1);
-		else
-			ssk->sk_prot->keepalive(ssk, 0);
-	}
+	if (ssk->sk_prot->keepalive)
+		ssk->sk_prot->keepalive(ssk, kaval);
+	sock_valbool_flag(ssk, SOCK_KEEPOPEN, kaval);


  ssk->sk_priority = sk->sk_priority; ssk->sk_bound_dev_if = sk->sk_bound_dev_if;

base-commit: 319f7385f22c85618235ab0169b80092fa3c7696

#2 lore raw
In reply to Krister Johansen

Hi Krister,

Thank you for your modifications, that's great!

Our CI did some validations and here is its report:

- KVM Validation: normal: Unstable: 1 failed test(s): selftest_mptcp_connect 🔴
- KVM Validation: debug: Success! ✅
- KVM Validation: btf-normal (only bpftest_all): Success! ✅
- KVM Validation: btf-debug (only bpftest_all): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/17507741030

Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/b682ae8c4184
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=999551

If there are some issues, you can reproduce them using the same environment as the one used by the CI thanks to a docker image, e.g.:

    $ cd [kernel source code]
    $ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
        --pull always mptcp/mptcp-upstream-virtme-docker:latest \
        auto-normal

For more details:

https://github.com/multipath-tcp/mptcp-upstream-virtme-docker

Please note that despite all the efforts that have been already done to have a stable tests suite when executed on a public CI like here, it is possible some reported issues are not due to your modifications. Still, do not hesitate to help us improve that ;-)

Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (NGI0 Core)

maintainer Reviewed-by on v1 1/1
#3 lore raw
In reply to Krister Johansen

Hi Krister,

Quoted 15 lines · Krister Johansen

Users reported a scenario where MPTCP connections that were configured with SO_KEEPALIVE prior to connect would fail to enable their keepalives if MTPCP fell back to TCP mode.

After investigating, this affects keepalives for any connection where sync_socket_options is called on a socket that is in the closed or listening state. Joins are handled properly. For connects, sync_socket_options is called when the socket is still in the closed state. The tcp_set_keepalive() function does not act on sockets that are closed or listening, hence keepalive is not immediately enabled. Since the SO_KEEPOPEN flag is absent, it is not enabled later in the connect sequence via tcp_finish_connect. Setting the keepalive via sockopt after connect does work, but would not address any subsequently created flows.

Quoted 7 lines

Fortunately, the fix here is straight-forward: set SOCK_KEEPOPEN on the subflow when calling sync_socket_options.

The fix was valdidated both by using tcpdump to observe keeplaive packets not being sent before the fix, and being sent after the fix. It was also possible to observe via ss that the keepalive timer was not enabled on these sockets before the fix, but was enabled afterwards.

Thank you for the fix! Indeed, the SOCK_KEEPOPEN flag was missing! This patch looks good to me as well:

@Netdev Maintainers: please apply this patch in 'net' directly. But I can always re-send it later if preferred.

Cheers,
Matt

Signature · 1 line
Sponsored by the NGI0 Core fund.
reviewer
#4 lore raw

Hi Matt,

Quoted 43 lines · Matthieu Baerts

Hi Krister,

Quoted 27 lines · Krister Johansen

Users reported a scenario where MPTCP connections that were configured
with SO_KEEPALIVE prior to connect would fail to enable their keepalives
if MTPCP fell back to TCP mode.

After investigating, this affects keepalives for any connection where
sync_socket_options is called on a socket that is in the closed or listening state.  Joins are handled properly. For connects, sync_socket_options is called when the socket is still in the closed
state.  The tcp_set_keepalive() function does not act on sockets that
are closed or listening, hence keepalive is not immediately enabled.
Since the SO_KEEPOPEN flag is absent, it is not enabled later in the
connect sequence via tcp_finish_connect.  Setting the keepalive via sockopt after connect does work, but would not address any subsequently
created flows.

Fortunately, the fix here is straight-forward: set SOCK_KEEPOPEN on the
subflow when calling sync_socket_options.

Quoted 7 lines

The fix was valdidated both by using tcpdump to observe keeplaive packets not being sent before the fix, and being sent after the fix.  It
was also possible to observe via ss that the keepalive timer was not
enabled on these sockets before the fix, but was enabled afterwards.

Thank you for the fix! Indeed, the SOCK_KEEPOPEN flag was missing! This
patch looks good to me as well:

Quoted 5 lines

@Netdev Maintainers: please apply this patch in 'net' directly. But I can always re-send it later if preferred.

nit:

I just noticed his patch breaks 'Reverse X-Mas Tree' order in sync_socket_options(). If you think any changes are needed, please update this when you re-send it.

Thanks,
-Geliang

Quoted 3 lines

Cheers,
Matt

maintainer
#5 lore raw

Hi Geliang,

Quoted 49 lines · Geliang Tang

Hi Matt,

Quoted 46 lines · Matthieu Baerts

Hi Krister,

Quoted 27 lines · Krister Johansen

Users reported a scenario where MPTCP connections that were configured
with SO_KEEPALIVE prior to connect would fail to enable their keepalives
if MTPCP fell back to TCP mode.

After investigating, this affects keepalives for any connection where
sync_socket_options is called on a socket that is in the closed or listening state.  Joins are handled properly. For connects, sync_socket_options is called when the socket is still in the closed
state.  The tcp_set_keepalive() function does not act on sockets that
are closed or listening, hence keepalive is not immediately enabled.
Since the SO_KEEPOPEN flag is absent, it is not enabled later in the
connect sequence via tcp_finish_connect.  Setting the keepalive via sockopt after connect does work, but would not address any subsequently
created flows.

Fortunately, the fix here is straight-forward: set SOCK_KEEPOPEN on the
subflow when calling sync_socket_options.

Quoted 7 lines

The fix was valdidated both by using tcpdump to observe keeplaive packets not being sent before the fix, and being sent after the fix.  It
was also possible to observe via ss that the keepalive timer was not
enabled on these sockets before the fix, but was enabled afterwards.

Thank you for the fix! Indeed, the SOCK_KEEPOPEN flag was missing! This
patch looks good to me as well:

Quoted 8 lines
Quoted 2 lines

@Netdev Maintainers: please apply this patch in 'net' directly. But I can always re-send it later if preferred.

nit:

I just noticed his patch breaks 'Reverse X-Mas Tree' order in sync_socket_options(). If you think any changes are needed, please update this when you re-send it.

Sure, I can do the modification and send it with other fixes we have.

pw-bot: cr

Cheers,
Matt

Signature · 1 line
Sponsored by the NGI0 Core fund.
#6 lore raw
Quoted 55 lines · Matthieu Baerts

Hi Geliang,

Quoted 52 lines · Geliang Tang

Hi Matt,

Quoted 48 lines · Matthieu Baerts

Hi Krister,

Quoted 27 lines · Krister Johansen

Users reported a scenario where MPTCP connections that were configured
with SO_KEEPALIVE prior to connect would fail to enable their keepalives
if MTPCP fell back to TCP mode.

After investigating, this affects keepalives for any connection where
sync_socket_options is called on a socket that is in the closed or listening state.  Joins are handled properly. For connects, sync_socket_options is called when the socket is still in the closed
state.  The tcp_set_keepalive() function does not act on sockets that
are closed or listening, hence keepalive is not immediately enabled.
Since the SO_KEEPOPEN flag is absent, it is not enabled later in the
connect sequence via tcp_finish_connect.  Setting the keepalive via sockopt after connect does work, but would not address any subsequently
created flows.

Fortunately, the fix here is straight-forward: set SOCK_KEEPOPEN on the
subflow when calling sync_socket_options.

Quoted 7 lines

The fix was valdidated both by using tcpdump to observe keeplaive packets not being sent before the fix, and being sent after the fix.  It
was also possible to observe via ss that the keepalive timer was not
enabled on these sockets before the fix, but was enabled afterwards.

Thank you for the fix! Indeed, the SOCK_KEEPOPEN flag was missing! This
patch looks good to me as well:

@Netdev Maintainers: please apply this patch in 'net' directly. But I can always re-send it later if preferred.

Quoted 7 lines
Quoted 5 lines

nit:

I just noticed his patch breaks 'Reverse X-Mas Tree' order in sync_socket_options(). If you think any changes are needed, please update this when you re-send it.

Sure, I can do the modification and send it with other fixes we have.

Thanks for the reviews, Geliang and Matt. If you'd like me to fix the formatting up and send a v2, I'm happy to do that as well. Just let me know.

-K

maintainer
#7 lore raw

Hi Krister,

Quoted 62 lines · Krister Johansen
Quoted 61 lines · Matthieu Baerts

Hi Geliang,

Quoted 57 lines · Geliang Tang

Hi Matt,

Quoted 43 lines · Matthieu Baerts

Hi Krister,

Quoted 27 lines · Krister Johansen

Users reported a scenario where MPTCP connections that were configured
with SO_KEEPALIVE prior to connect would fail to enable their keepalives
if MTPCP fell back to TCP mode.

After investigating, this affects keepalives for any connection where
sync_socket_options is called on a socket that is in the closed or listening state.  Joins are handled properly. For connects, sync_socket_options is called when the socket is still in the closed
state.  The tcp_set_keepalive() function does not act on sockets that
are closed or listening, hence keepalive is not immediately enabled.
Since the SO_KEEPOPEN flag is absent, it is not enabled later in the
connect sequence via tcp_finish_connect.  Setting the keepalive via sockopt after connect does work, but would not address any subsequently
created flows.

Fortunately, the fix here is straight-forward: set SOCK_KEEPOPEN on the
subflow when calling sync_socket_options.

Quoted 7 lines

The fix was valdidated both by using tcpdump to observe keeplaive packets not being sent before the fix, and being sent after the fix.  It
was also possible to observe via ss that the keepalive timer was not
enabled on these sockets before the fix, but was enabled afterwards.

Thank you for the fix! Indeed, the SOCK_KEEPOPEN flag was missing! This
patch looks good to me as well:

Quoted 5 lines

@Netdev Maintainers: please apply this patch in 'net' directly. But I can always re-send it later if preferred.

nit:

I just noticed his patch breaks 'Reverse X-Mas Tree' order in sync_socket_options(). If you think any changes are needed, please update this when you re-send it.

Quoted 5 lines
Quoted 1 line

Sure, I can do the modification and send it with other fixes we have.

Thanks for the reviews, Geliang and Matt. If you'd like me to fix the formatting up and send a v2, I'm happy to do that as well. Just let me know.

I was going to apply this diff:

Quoted 10 lines
net/mptcp/sockopt.c +1 -1
index 13108e9f982b..2abe6f1e9940 100644
@@ -1532,11 +1532,12 @@ static void sync_socket_options(struct mptcp_sock *msk, struct sock *ssk)
 {
        static const unsigned int tx_rx_locks = SOCK_RCVBUF_LOCK | SOCK_SNDBUF_LOCK;
        struct sock *sk = (struct sock *)msk;
-       int kaval = !!sock_flag(sk, SOCK_KEEPOPEN);
+       bool keep_open;

net/mptcp/sockopt.c static void sync_socket_options(struct mptcp_sock *msk, struct sock *ssk) · line 1543

Quoted 10 lines
net/mptcp/sockopt.c +3 -2
 
+       keep_open = sock_flag(sk, SOCK_KEEPOPEN);
        if (ssk->sk_prot->keepalive)
-               ssk->sk_prot->keepalive(ssk, kaval);
-       sock_valbool_flag(ssk, SOCK_KEEPOPEN, kaval);
+               ssk->sk_prot->keepalive(ssk, keep_open);
+       sock_valbool_flag(ssk, SOCK_KEEPOPEN, keep_open);
 
        ssk->sk_priority = sk->sk_priority;
        ssk->sk_bound_dev_if = sk->sk_bound_dev_if;

(sock_flag() returns a bool, and 'keep_open' is maybe clearer)

But up to you, I really don't mind if you prefer to send the v2 by yourself, just let me know.

Cheers,
Matt

Signature · 1 line
Sponsored by the NGI0 Core fund.
#8 lore raw
Quoted 91 lines · Matthieu Baerts

Hi Krister,

Quoted 62 lines · Krister Johansen
Quoted 61 lines · Matthieu Baerts

Hi Geliang,

Quoted 57 lines · Geliang Tang

Hi Matt,

Quoted 43 lines · Matthieu Baerts

Hi Krister,

Quoted 27 lines · Krister Johansen

Users reported a scenario where MPTCP connections that were configured
with SO_KEEPALIVE prior to connect would fail to enable their keepalives
if MTPCP fell back to TCP mode.

After investigating, this affects keepalives for any connection where
sync_socket_options is called on a socket that is in the closed or listening state.  Joins are handled properly. For connects, sync_socket_options is called when the socket is still in the closed
state.  The tcp_set_keepalive() function does not act on sockets that
are closed or listening, hence keepalive is not immediately enabled.
Since the SO_KEEPOPEN flag is absent, it is not enabled later in the
connect sequence via tcp_finish_connect.  Setting the keepalive via sockopt after connect does work, but would not address any subsequently
created flows.

Fortunately, the fix here is straight-forward: set SOCK_KEEPOPEN on the
subflow when calling sync_socket_options.

Quoted 7 lines

The fix was valdidated both by using tcpdump to observe keeplaive packets not being sent before the fix, and being sent after the fix.  It
was also possible to observe via ss that the keepalive timer was not
enabled on these sockets before the fix, but was enabled afterwards.

Thank you for the fix! Indeed, the SOCK_KEEPOPEN flag was missing! This
patch looks good to me as well:

Quoted 5 lines

@Netdev Maintainers: please apply this patch in 'net' directly. But I can always re-send it later if preferred.

nit:

I just noticed his patch breaks 'Reverse X-Mas Tree' order in sync_socket_options(). If you think any changes are needed, please update this when you re-send it.

Quoted 5 lines
Quoted 1 line

Sure, I can do the modification and send it with other fixes we have.

Thanks for the reviews, Geliang and Matt. If you'd like me to fix the formatting up and send a v2, I'm happy to do that as well. Just let me know.

I was going to apply this diff:

Quoted 18 lines
net/mptcp/sockopt.c +4 -3
index 13108e9f982b..2abe6f1e9940 100644
@@ -1532,11 +1532,12 @@ static void sync_socket_options(struct mptcp_sock *msk, struct sock *ssk)
 {
        static const unsigned int tx_rx_locks = SOCK_RCVBUF_LOCK | SOCK_SNDBUF_LOCK;
        struct sock *sk = (struct sock *)msk;
-       int kaval = !!sock_flag(sk, SOCK_KEEPOPEN);
+       bool keep_open;
 
+       keep_open = sock_flag(sk, SOCK_KEEPOPEN);
        if (ssk->sk_prot->keepalive)
-               ssk->sk_prot->keepalive(ssk, kaval);
-       sock_valbool_flag(ssk, SOCK_KEEPOPEN, kaval);
+               ssk->sk_prot->keepalive(ssk, keep_open);
+       sock_valbool_flag(ssk, SOCK_KEEPOPEN, keep_open);
 
Quoted 7 lines

net/mptcp/sockopt.c static void sync_socket_options(struct mptcp_sock *msk, struct sock *ssk) · line 1542

Quoted 2 lines
net/mptcp/sockopt.c +0 -0
        ssk->sk_priority = sk->sk_priority;
        ssk->sk_bound_dev_if = sk->sk_bound_dev_if;

(sock_flag() returns a bool, and 'keep_open' is maybe clearer)

But up to you, I really don't mind if you prefer to send the v2 by yourself, just let me know.

Thanks, I'll go ahead and amend as you suggest and then send a v2.

-K

maintainer
#9 lore raw

8 Sept 2025 19:45:32 Krister Johansen <[email protected]>:

Quoted 50 lines · Matthieu Baerts
Quoted 49 lines

Hi Krister,

Quoted 15 lines · Krister Johansen
Quoted 14 lines · Matthieu Baerts

Hi Geliang,

Quoted 10 lines · Geliang Tang

Hi Matt,

Quoted 1 line · Matthieu Baerts

…

nit:

I just noticed his patch breaks 'Reverse X-Mas Tree' order in sync_socket_options(). If you think any changes are needed, please update this when you re-send it.

Quoted 5 lines
Quoted 1 line

Sure, I can do the modification and send it with other fixes we have.

Thanks for the reviews, Geliang and Matt.  If you'd like me to fix the formatting up and send a v2, I'm happy to do that as well.  Just let me know.

I was going to apply this diff:

Quoted 10 lines
net/mptcp/sockopt.c +1 -1
index 13108e9f982b..2abe6f1e9940 100644
@@ -1532,11 +1532,12 @@ static void sync_socket_options(struct mptcp_sock *msk, struct sock *ssk)
 {
         static const unsigned int tx_rx_locks = SOCK_RCVBUF_LOCK | SOCK_SNDBUF_LOCK;
         struct sock *sk = (struct sock *)msk;
-       int kaval = !!sock_flag(sk, SOCK_KEEPOPEN);
+       bool keep_open;

net/mptcp/sockopt.c static void sync_socket_options(struct mptcp_sock *msk, struct sock *ssk) · line 1543

Quoted 10 lines
net/mptcp/sockopt.c +3 -2
 
+       keep_open = sock_flag(sk, SOCK_KEEPOPEN);
         if (ssk->sk_prot->keepalive)
-               ssk->sk_prot->keepalive(ssk, kaval);
-       sock_valbool_flag(ssk, SOCK_KEEPOPEN, kaval);
+               ssk->sk_prot->keepalive(ssk, keep_open);
+       sock_valbool_flag(ssk, SOCK_KEEPOPEN, keep_open);
 
         ssk->sk_priority = sk->sk_priority;
         ssk->sk_bound_dev_if = sk->sk_bound_dev_if;

(sock_flag() returns a bool, and 'keep_open' is maybe clearer)

Quoted 4 lines
Quoted 2 lines

But up to you, I really don't mind if you prefer to send the v2 by yourself, just let me know.

Thanks, I'll go ahead and amend as you suggest and then send a v2.

Great, thanks.

While at it, please use [PATCH net] as prefix.

Cheers,
Matt

#10 lore raw
Quoted 52 lines · Matthieu Baerts

8 Sept 2025 19:45:32 Krister Johansen <[email protected]>:

Quoted 50 lines · Matthieu Baerts
Quoted 49 lines

Hi Krister,

Quoted 15 lines · Krister Johansen
Quoted 14 lines · Matthieu Baerts

Hi Geliang,

Quoted 10 lines · Geliang Tang

Hi Matt,

Quoted 1 line · Matthieu Baerts

…

nit:

I just noticed his patch breaks 'Reverse X-Mas Tree' order in sync_socket_options(). If you think any changes are needed, please update this when you re-send it.

Quoted 5 lines
Quoted 1 line

Sure, I can do the modification and send it with other fixes we have.

Thanks for the reviews, Geliang and Matt.  If you'd like me to fix the formatting up and send a v2, I'm happy to do that as well.  Just let me know.

I was going to apply this diff:

Quoted 10 lines
net/mptcp/sockopt.c +1 -1
index 13108e9f982b..2abe6f1e9940 100644
@@ -1532,11 +1532,12 @@ static void sync_socket_options(struct mptcp_sock *msk, struct sock *ssk)
 {
         static const unsigned int tx_rx_locks = SOCK_RCVBUF_LOCK | SOCK_SNDBUF_LOCK;
         struct sock *sk = (struct sock *)msk;
-       int kaval = !!sock_flag(sk, SOCK_KEEPOPEN);
+       bool keep_open;

net/mptcp/sockopt.c static void sync_socket_options(struct mptcp_sock *msk, struct sock *ssk) · line 1543

Quoted 10 lines
net/mptcp/sockopt.c +3 -2
 
+       keep_open = sock_flag(sk, SOCK_KEEPOPEN);
         if (ssk->sk_prot->keepalive)
-               ssk->sk_prot->keepalive(ssk, kaval);
-       sock_valbool_flag(ssk, SOCK_KEEPOPEN, kaval);
+               ssk->sk_prot->keepalive(ssk, keep_open);
+       sock_valbool_flag(ssk, SOCK_KEEPOPEN, keep_open);
 
         ssk->sk_priority = sk->sk_priority;
         ssk->sk_bound_dev_if = sk->sk_bound_dev_if;

(sock_flag() returns a bool, and 'keep_open' is maybe clearer)

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

But up to you, I really don't mind if you prefer to send the v2 by yourself, just let me know.

Thanks, I'll go ahead and amend as you suggest and then send a v2.

Great, thanks.

While at it, please use [PATCH net] as prefix.

Thanks, will do. May I preserve the Reveiwed-By tags from the v1, or would you like to review again?

-K

maintainer
#11 lore raw

8 Sept 2025 19:56:23 Krister Johansen <[email protected]>:

Quoted 42 lines · Matthieu Baerts
Quoted 41 lines

8 Sept 2025 19:45:32 Krister Johansen <[email protected]>:

Quoted 39 lines · Matthieu Baerts
Quoted 37 lines

Hi Krister,

Quoted 6 lines · Krister Johansen
Quoted 1 line · Matthieu Baerts

…

Thanks for the reviews, Geliang and Matt.  If you'd like me to fix the formatting up and send a v2, I'm happy to do that as well.  Just let me know.

I was going to apply this diff:

Quoted 10 lines
net/mptcp/sockopt.c +1 -1
index 13108e9f982b..2abe6f1e9940 100644
@@ -1532,11 +1532,12 @@ static void sync_socket_options(struct mptcp_sock *msk, struct sock *ssk)
 {
         static const unsigned int tx_rx_locks = SOCK_RCVBUF_LOCK | SOCK_SNDBUF_LOCK;
         struct sock *sk = (struct sock *)msk;
-       int kaval = !!sock_flag(sk, SOCK_KEEPOPEN);
+       bool keep_open;

net/mptcp/sockopt.c static void sync_socket_options(struct mptcp_sock *msk, struct sock *ssk) · line 1543

Quoted 10 lines
net/mptcp/sockopt.c +3 -2
 
+       keep_open = sock_flag(sk, SOCK_KEEPOPEN);
         if (ssk->sk_prot->keepalive)
-               ssk->sk_prot->keepalive(ssk, kaval);
-       sock_valbool_flag(ssk, SOCK_KEEPOPEN, kaval);
+               ssk->sk_prot->keepalive(ssk, keep_open);
+       sock_valbool_flag(ssk, SOCK_KEEPOPEN, keep_open);
 
         ssk->sk_priority = sk->sk_priority;
         ssk->sk_bound_dev_if = sk->sk_bound_dev_if;

(sock_flag() returns a bool, and 'keep_open' is maybe clearer)

But up to you, I really don't mind if you prefer to send the v2 by yourself, just let me know.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Thanks, I'll go ahead and amend as you suggest and then send a v2.

Great, thanks.

While at it, please use [PATCH net] as prefix.

Thanks, will do.  May I preserve the Reveiwed-By tags from the v1, or would you like to review again?

You can preserve it.

Cheers,
Matt