Skip to content

Commit c3030c1

Browse files
committed
events: support server-side flag
This flag is being added in the kernel [1]. It is going to replace the server-side attribute. Check both to be future proof. Link: https://lore.kernel.org/20250909-mptcp-pm-user-server-side-flag-v1-0-cb8e2b8d1c0c@kernel.org [1] Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
1 parent 1950e24 commit c3030c1

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

include/linux/mptcp_upstream.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#define MPTCP_INFO_FLAG_REMOTE_KEY_RECEIVED _BITUL(1)
3333

3434
#define MPTCP_PM_EV_FLAG_DENY_JOIN_ID0 _BITUL(0)
35+
#define MPTCP_PM_EV_FLAG_SERVER_SIDE _BITUL(1)
3536

3637
#define MPTCP_PM_ADDR_FLAG_SIGNAL (1 << 0)
3738
#define MPTCP_PM_ADDR_FLAG_SUBFLOW (1 << 1)

include/linux/mptcp_upstream_pm.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
* good time to allocate memory and send ADD_ADDR if needed. Depending on the
1717
* traffic-patterns it can take a long time until the MPTCP_EVENT_ESTABLISHED
1818
* is sent. Attributes: token, family, saddr4 | saddr6, daddr4 | daddr6,
19-
* sport, dport, server-side, [flags].
19+
* sport, dport, [server-side], [flags].
2020
* @MPTCP_EVENT_ESTABLISHED: A MPTCP connection is established (can start new
2121
* subflows). Attributes: token, family, saddr4 | saddr6, daddr4 | daddr6,
22-
* sport, dport, server-side, [flags].
22+
* sport, dport, [server-side], [flags].
2323
* @MPTCP_EVENT_CLOSED: A MPTCP connection has stopped. Attribute: token.
2424
* @MPTCP_EVENT_ANNOUNCED: A new address has been announced by the peer.
2525
* Attributes: token, rem_id, family, daddr4 | daddr6 [, dport].

src/path_manager.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,9 @@ static void handle_connection_created(struct pm_event_attrs const *attrs,
258258

259259
static char const *const pm_name = NULL;
260260
bool const server_side =
261-
(attrs->server_side != NULL ? *attrs->server_side : false);
261+
(attrs->flags != NULL &&
262+
*attrs->flags & MPTCP_PM_EV_FLAG_SERVER_SIDE) ||
263+
(attrs->server_side != NULL && *attrs->server_side);
262264
bool const deny_join_id0 =
263265
attrs->flags != NULL &&
264266
*attrs->flags & MPTCP_PM_EV_FLAG_DENY_JOIN_ID0;
@@ -314,7 +316,9 @@ static void handle_connection_established(struct pm_event_attrs const *attrs,
314316

315317
// Assume server_side is false if event attribute is unavailable.
316318
bool const server_side =
317-
(attrs->server_side != NULL ? *attrs->server_side : false);
319+
(attrs->flags != NULL &&
320+
*attrs->flags & MPTCP_PM_EV_FLAG_SERVER_SIDE) ||
321+
(attrs->server_side != NULL && *attrs->server_side);
318322
bool const deny_join_id0 =
319323
attrs->flags != NULL &&
320324
*attrs->flags & MPTCP_PM_EV_FLAG_DENY_JOIN_ID0;

0 commit comments

Comments
 (0)