include/linux/inet_diag.h | 2 +- net/ipv4/inet_diag.c | 6 +++--- net/ipv4/raw_diag.c | 2 +- net/ipv4/tcp_diag.c | 2 +- net/ipv4/udp_diag.c | 2 +- net/mptcp/diag.c | 5 ++--- net/mptcp/mptcp_diag.c | 9 +-------- net/mptcp/protocol.c | 4 ---- net/mptcp/protocol.h | 2 -- net/mptcp/sockopt.c | 13 ++++--------- net/mptcp/subflow.c | 1 - net/sctp/diag.c | 6 +++--- 12 files changed, 17 insertions(+), 37 deletions(-)
Use the MPTCP socket address as an offset when reporting write_seq,
snd_una, ack_seq and map_seq. This removes the need to maintain
separate local_idsn and remote_idsn fields for sequence number
normalization.
With normalized sequence numbers available in MPTCP diagnostics,
remove the masking of MPTCP-level sequence fields for unprivileged
users while retaining the existing net_admin checks for sensitive
subflow diagnostic attributes.
Update the inet_diag get_info callback signature accordingly across
the affected protocol implementations.
Link: https://github.com/multipath-tcp/mptcp_net-next/issues/445
Signed-off-by: Kalpan Jani <kalpan.jani@mpiricsoftware.com>
---
Changes since v11:
- Replace CAP_NET_ADMIN-based sequence counter masking with
sequence-number normalization using the MPTCP socket address.
- Remove the net_admin argument from idiag_get_info callbacks,
as MPTCP-level sequence counters are now normalized.
- Remove local_idsn and remote_idsn fields and their assignments.
- Normalize MPTCP subflow map_seq using the MPTCP socket address
instead of remote_idsn.
- Consolidate the previous two-patch approach into a single
sequence-number normalization patch.
v11: https://lore.kernel.org/all/20261028082704.1609493-1-kalpan.jani@mpiricsoftware.com/
---
include/linux/inet_diag.h | 2 +-
net/ipv4/inet_diag.c | 6 +++---
net/ipv4/raw_diag.c | 2 +-
net/ipv4/tcp_diag.c | 2 +-
net/ipv4/udp_diag.c | 2 +-
net/mptcp/diag.c | 5 ++---
net/mptcp/mptcp_diag.c | 9 +--------
net/mptcp/protocol.c | 4 ----
net/mptcp/protocol.h | 2 --
net/mptcp/sockopt.c | 13 ++++---------
net/mptcp/subflow.c | 1 -
net/sctp/diag.c | 6 +++---
12 files changed, 17 insertions(+), 37 deletions(-)
diff --git a/include/linux/inet_diag.h b/include/linux/inet_diag.h
index 85f6278d5db1d..704fd415c2b49 100644
--- a/include/linux/inet_diag.h
+++ b/include/linux/inet_diag.h
@@ -18,7 +18,7 @@ struct inet_diag_handler {
void (*idiag_get_info)(struct sock *sk,
struct inet_diag_msg *r,
- void *info, bool net_admin);
+ void *info);
int (*idiag_get_aux)(struct sock *sk,
bool net_admin,
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index 362161bf39fe3..34b77aa87d0a4 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -276,7 +276,7 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
}
if (!icsk) {
- handler->idiag_get_info(sk, r, NULL, net_admin);
+ handler->idiag_get_info(sk, r, NULL);
goto out;
}
@@ -327,7 +327,7 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
goto errout;
}
- handler->idiag_get_info(sk, r, info, net_admin);
+ handler->idiag_get_info(sk, r, info);
if (ext & (1 << (INET_DIAG_INFO - 1)) && handler->idiag_get_aux)
if (handler->idiag_get_aux(sk, net_admin, skb) < 0)
@@ -1027,7 +1027,7 @@ int inet_diag_handler_get_info(struct sk_buff *skb, struct sock *sk)
if (attr)
info = nla_data(attr);
- handler->idiag_get_info(sk, r, info, false);
+ handler->idiag_get_info(sk, r, info);
inet_diag_unlock_handler(handler);
nlmsg_end(skb, nlh);
diff --git a/net/ipv4/raw_diag.c b/net/ipv4/raw_diag.c
index 264912d0cb9fc..943e5998e0ad5 100644
--- a/net/ipv4/raw_diag.c
+++ b/net/ipv4/raw_diag.c
@@ -185,7 +185,7 @@ static void raw_diag_dump(struct sk_buff *skb, struct netlink_callback *cb,
}
static void raw_diag_get_info(struct sock *sk, struct inet_diag_msg *r,
- void *info, bool net_admin)
+ void *info)
{
r->idiag_rqueue = sk_rmem_alloc_get(sk);
r->idiag_wqueue = sk_wmem_alloc_get(sk);
diff --git a/net/ipv4/tcp_diag.c b/net/ipv4/tcp_diag.c
index cac32575282e3..ba1fdbe9807fd 100644
--- a/net/ipv4/tcp_diag.c
+++ b/net/ipv4/tcp_diag.c
@@ -19,7 +19,7 @@
#include <net/tcp.h>
static void tcp_diag_get_info(struct sock *sk, struct inet_diag_msg *r,
- void *_info, bool net_admin)
+ void *_info)
{
struct tcp_info *info = _info;
diff --git a/net/ipv4/udp_diag.c b/net/ipv4/udp_diag.c
index 5a1fa627cbee8..f4b24e628cf8d 100644
--- a/net/ipv4/udp_diag.c
+++ b/net/ipv4/udp_diag.c
@@ -142,7 +142,7 @@ static void udp_diag_dump(struct sk_buff *skb, struct netlink_callback *cb,
}
static void udp_diag_get_info(struct sock *sk, struct inet_diag_msg *r,
- void *info, bool net_admin)
+ void *info)
{
r->idiag_rqueue = udp_rqueue_get(sk);
r->idiag_wqueue = sk_wmem_alloc_get(sk);
diff --git a/net/mptcp/diag.c b/net/mptcp/diag.c
index 590cdee419ef9..66695d17a63cc 100644
--- a/net/mptcp/diag.c
+++ b/net/mptcp/diag.c
@@ -16,7 +16,7 @@ static int subflow_get_info(struct sock *sk, struct sk_buff *skb, bool net_admin
{
struct mptcp_subflow_context *sf;
struct nlattr *start;
- u64 map_seq;
+ u64 map_seq = 0;
u32 flags = 0;
bool slow;
int err;
@@ -36,10 +36,9 @@ static int subflow_get_info(struct sock *sk, struct sk_buff *skb, bool net_admin
goto nla_failure;
}
- map_seq = 0;
if (sf->conn && sf->map_seq)
map_seq = sf->map_seq -
- READ_ONCE(mptcp_sk(sf->conn)->remote_idsn);
+ (unsigned long)mptcp_sk(sf->conn);
if (sf->mp_capable)
flags |= MPTCP_SUBFLOW_FLAG_MCAP_REM;
diff --git a/net/mptcp/mptcp_diag.c b/net/mptcp/mptcp_diag.c
index d526b1015da16..136c2d05c0eeb 100644
--- a/net/mptcp/mptcp_diag.c
+++ b/net/mptcp/mptcp_diag.c
@@ -190,7 +190,7 @@ static void mptcp_diag_dump(struct sk_buff *skb, struct netlink_callback *cb,
}
static void mptcp_diag_get_info(struct sock *sk, struct inet_diag_msg *r,
- void *_info, bool net_admin)
+ void *_info)
{
struct mptcp_sock *msk = mptcp_sk(sk);
struct mptcp_info *info = _info;
@@ -215,13 +215,6 @@ static void mptcp_diag_get_info(struct sock *sk, struct inet_diag_msg *r,
return;
mptcp_diag_fill_info(msk, info);
-
- if (!net_admin) {
- /* Hide data sequence numbers from unprivileged users. */
- info->mptcpi_write_seq = 0;
- info->mptcpi_snd_una = 0;
- info->mptcpi_rcv_nxt = 0;
- }
}
static const struct inet_diag_handler mptcp_diag_handler = {
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index e59209b6fc41c..f22d64ab1c53b 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -3216,8 +3216,6 @@ static void __mptcp_init_sock(struct sock *sk)
INIT_WORK(&msk->work, mptcp_worker);
msk->out_of_order_queue = RB_ROOT;
msk->first_pending = NULL;
- WRITE_ONCE(msk->local_idsn, 0);
- WRITE_ONCE(msk->remote_idsn, 0);
/* msk does not go through tcp_init_sock(); seed RTO bounds. */
icsk->icsk_rto_min =
@@ -3765,7 +3763,6 @@ struct sock *mptcp_sk_clone_init(const struct sock *sk,
msk = mptcp_sk(nsk);
WRITE_ONCE(msk->local_key, subflow_req->local_key);
- WRITE_ONCE(msk->local_idsn, subflow_req->idsn);
WRITE_ONCE(msk->token, subflow_req->token);
msk->in_accept_queue = 1;
WRITE_ONCE(msk->fully_established, false);
@@ -4204,7 +4201,6 @@ static int mptcp_connect(struct sock *sk, struct sockaddr_unsized *uaddr,
MPTCP_MIB_TOKENFALLBACKINIT);
}
- WRITE_ONCE(msk->local_idsn, subflow->idsn);
WRITE_ONCE(msk->write_seq, subflow->idsn);
WRITE_ONCE(msk->snd_nxt, subflow->idsn);
WRITE_ONCE(msk->snd_una, subflow->idsn);
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index fc6858863fa89..3d250e8204d52 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -288,8 +288,6 @@ struct mptcp_sock {
* lockless access read
*/
u64 remote_key; /* same as above */
- u64 local_idsn;
- u64 remote_idsn;
u64 write_seq;
u64 bytes_sent;
u64 snd_nxt;
diff --git a/net/mptcp/sockopt.c b/net/mptcp/sockopt.c
index b20263b4cd55c..6ee9dcfea5c79 100644
--- a/net/mptcp/sockopt.c
+++ b/net/mptcp/sockopt.c
@@ -1047,7 +1047,7 @@ static int mptcp_getsockopt_first_sf_only(struct mptcp_sock *msk, int level, int
void mptcp_diag_fill_info(struct mptcp_sock *msk, struct mptcp_info *info)
{
struct sock *sk = (struct sock *)msk;
- u64 local_idsn = 0, remote_idsn = 0;
+ u64 offset = (unsigned long)msk;
u32 flags = 0;
bool slow;
u32 now;
@@ -1085,11 +1085,9 @@ void mptcp_diag_fill_info(struct mptcp_sock *msk, struct mptcp_info *info)
info->mptcpi_flags = flags;
slow = lock_sock_fast(sk);
- local_idsn = READ_ONCE(msk->local_idsn);
-
info->mptcpi_csum_enabled = READ_ONCE(msk->csum_enabled);
info->mptcpi_token = msk->token;
- info->mptcpi_write_seq = msk->write_seq - local_idsn;
+ info->mptcpi_write_seq = msk->write_seq - offset;
info->mptcpi_retransmits = inet_csk(sk)->icsk_retransmits;
info->mptcpi_bytes_sent = msk->bytes_sent;
info->mptcpi_bytes_received = msk->bytes_received;
@@ -1102,20 +1100,17 @@ void mptcp_diag_fill_info(struct mptcp_sock *msk, struct mptcp_info *info)
unlock_sock_fast(sk, slow);
mptcp_data_lock(sk);
- if (READ_ONCE(msk->can_ack))
- remote_idsn = READ_ONCE(msk->remote_idsn);
info->mptcpi_last_ack_recv = jiffies_to_msecs(now - msk->last_ack_recv);
- info->mptcpi_snd_una = msk->snd_una - local_idsn;
- info->mptcpi_rcv_nxt = msk->ack_seq - remote_idsn;
+ info->mptcpi_snd_una = msk->snd_una - offset;
+ info->mptcpi_rcv_nxt = msk->ack_seq - offset;
info->mptcpi_bytes_acked = msk->bytes_acked;
mptcp_data_unlock(sk);
-
}
EXPORT_SYMBOL_GPL(mptcp_diag_fill_info);
static int mptcp_getsockopt_info(struct mptcp_sock *msk, char __user *optval, int __user *optlen)
{
struct mptcp_info m_info = {};
int len;
if (get_user(len, optlen))
diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index 39c7422afa779..55de605226ad0 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -490,12 +490,11 @@ static void subflow_set_remote_key(struct mptcp_sock *msk,
subflow->map_seq = subflow->iasn;
WRITE_ONCE(msk->remote_key, subflow->remote_key);
- WRITE_ONCE(msk->remote_idsn, subflow->iasn - 1);
WRITE_ONCE(msk->ack_seq, subflow->iasn);
WRITE_ONCE(msk->can_ack, true);
atomic64_set(&msk->rcv_wnd_sent, subflow->iasn);
/* publish last, once iasn and the fields above are fully populated */
subflow->remote_key_valid = 1;
}
diff --git a/net/sctp/diag.c b/net/sctp/diag.c
index ab6c560fde053..c2a0de2adf6fd 100644
--- a/net/sctp/diag.c
+++ b/net/sctp/diag.c
@@ -20,7 +20,7 @@
#include <net/sctp/sctp.h>
static void sctp_diag_get_info(struct sock *sk, struct inet_diag_msg *r,
- void *info, bool net_admin);
+ void *info);
/* define some functions to make asoc/ep fill look clean */
static void inet_diag_msg_sctpasoc_fill(struct inet_diag_msg *r,
@@ -200,7 +200,7 @@ static int inet_sctp_diag_fill(struct sock *sk, struct sctp_association *asoc,
}
infox.sctpinfo = (struct sctp_info *)info;
infox.asoc = asoc;
- sctp_diag_get_info(sk, r, &infox, net_admin);
+ sctp_diag_get_info(sk, r, &infox);
addr_list = asoc ? &asoc->base.bind_addr.address_list
: &ep->base.bind_addr.address_list;
@@ -412,7 +412,7 @@ static int sctp_ep_dump(struct sctp_endpoint *ep, void *p)
/* define the functions for sctp_diag_handler*/
static void sctp_diag_get_info(struct sock *sk, struct inet_diag_msg *r,
- void *info, bool net_admin)
+ void *info)
{
struct sctp_infox *infox = (struct sctp_infox *)info;
--
2.43.0
Hi All,
I investigated the patch application failure locally.
The patch applies successfully to the intended base commit 27c69362083ec117ddb553c031e7f1e0e5d2105d.
I also tested both git apply --check and git apply --3way --check in a fresh detached worktree. Both tests passed, and all 12 files applied cleanly.
Could you please check whether the CI environment has the expected base commit and the required Git blob objects available?
The reported sha1 information is lacking or useless error may be related to the CI checkout or missing Git objects.
I have not changed the patch since submission.
Cheers,
Kalpan Jani
From: Kalpan Jani <kalpan.jani@mpiricsoftware.com>
To: <mptcp@lists.linux.dev>
Cc: <shardul.b@mpiricsoftware.com>, <janak@mpiric.us>, <kalpanjani009@gmail.com>, "Kalpan Jani"<kalpan.jani@mpiricsoftware.com>
Date: Fri, 06 Nov 2026 16:46:45 +0530
Subject: [RFC net-next v12] mptcp: normalize sequence numbers using socket address
> Use the MPTCP socket address as an offset when reporting write_seq,
> snd_una, ack_seq and map_seq. This removes the need to maintain
> separate local_idsn and remote_idsn fields for sequence number
> normalization.
>
> With normalized sequence numbers available in MPTCP diagnostics,
> remove the masking of MPTCP-level sequence fields for unprivileged
> users while retaining the existing net_admin checks for sensitive
> subflow diagnostic attributes.
>
> Update the inet_diag get_info callback signature accordingly across
> the affected protocol implementations.
>
> Link: https://github.com/multipath-tcp/mptcp_net-next/issues/445
> Signed-off-by: Kalpan Jani <kalpan.jani@mpiricsoftware.com>
> ---
> Changes since v11:
> - Replace CAP_NET_ADMIN-based sequence counter masking with
> sequence-number normalization using the MPTCP socket address.
> - Remove the net_admin argument from idiag_get_info callbacks,
> as MPTCP-level sequence counters are now normalized.
> - Remove local_idsn and remote_idsn fields and their assignments.
> - Normalize MPTCP subflow map_seq using the MPTCP socket address
> instead of remote_idsn.
> - Consolidate the previous two-patch approach into a single
> sequence-number normalization patch.
>
> v11: https://lore.kernel.org/all/20261028082704.1609493-1-kalpan.jani@mpiricsoftware.com/
> ---
> include/linux/inet_diag.h | 2 +-
> net/ipv4/inet_diag.c | 6 +++---
> net/ipv4/raw_diag.c | 2 +-
> net/ipv4/tcp_diag.c | 2 +-
> net/ipv4/udp_diag.c | 2 +-
> net/mptcp/diag.c | 5 ++---
> net/mptcp/mptcp_diag.c | 9 +--------
> net/mptcp/protocol.c | 4 ----
> net/mptcp/protocol.h | 2 --
> net/mptcp/sockopt.c | 13 ++++---------
> net/mptcp/subflow.c | 1 -
> net/sctp/diag.c | 6 +++---
> 12 files changed, 17 insertions(+), 37 deletions(-)
>
> diff --git a/include/linux/inet_diag.h b/include/linux/inet_diag.h
> index 85f6278d5db1d..704fd415c2b49 100644
> --- a/include/linux/inet_diag.h
> +++ b/include/linux/inet_diag.h
> @@ -18,7 +18,7 @@ struct inet_diag_handler {
>
> void (*idiag_get_info)(struct sock *sk,
> struct inet_diag_msg *r,
> - void *info, bool net_admin);
> + void *info);
>
> int (*idiag_get_aux)(struct sock *sk,
> bool net_admin,
> diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
> index 362161bf39fe3..34b77aa87d0a4 100644
> --- a/net/ipv4/inet_diag.c
> +++ b/net/ipv4/inet_diag.c
> @@ -276,7 +276,7 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
> }
>
> if (!icsk) {
> - handler->idiag_get_info(sk, r, NULL, net_admin);
> + handler->idiag_get_info(sk, r, NULL);
> goto out;
> }
>
> @@ -327,7 +327,7 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
> goto errout;
> }
>
> - handler->idiag_get_info(sk, r, info, net_admin);
> + handler->idiag_get_info(sk, r, info);
>
> if (ext & (1 << (INET_DIAG_INFO - 1)) && handler->idiag_get_aux)
> if (handler->idiag_get_aux(sk, net_admin, skb) < 0)
> @@ -1027,7 +1027,7 @@ int inet_diag_handler_get_info(struct sk_buff *skb, struct sock *sk)
> if (attr)
> info = nla_data(attr);
>
> - handler->idiag_get_info(sk, r, info, false);
> + handler->idiag_get_info(sk, r, info);
> inet_diag_unlock_handler(handler);
>
> nlmsg_end(skb, nlh);
> diff --git a/net/ipv4/raw_diag.c b/net/ipv4/raw_diag.c
> index 264912d0cb9fc..943e5998e0ad5 100644
> --- a/net/ipv4/raw_diag.c
> +++ b/net/ipv4/raw_diag.c
> @@ -185,7 +185,7 @@ static void raw_diag_dump(struct sk_buff *skb, struct netlink_callback *cb,
> }
>
> static void raw_diag_get_info(struct sock *sk, struct inet_diag_msg *r,
> - void *info, bool net_admin)
> + void *info)
> {
> r->idiag_rqueue = sk_rmem_alloc_get(sk);
> r->idiag_wqueue = sk_wmem_alloc_get(sk);
> diff --git a/net/ipv4/tcp_diag.c b/net/ipv4/tcp_diag.c
> index cac32575282e3..ba1fdbe9807fd 100644
> --- a/net/ipv4/tcp_diag.c
> +++ b/net/ipv4/tcp_diag.c
> @@ -19,7 +19,7 @@
> #include <net/tcp.h>
>
> static void tcp_diag_get_info(struct sock *sk, struct inet_diag_msg *r,
> - void *_info, bool net_admin)
> + void *_info)
> {
> struct tcp_info *info = _info;
>
> diff --git a/net/ipv4/udp_diag.c b/net/ipv4/udp_diag.c
> index 5a1fa627cbee8..f4b24e628cf8d 100644
> --- a/net/ipv4/udp_diag.c
> +++ b/net/ipv4/udp_diag.c
> @@ -142,7 +142,7 @@ static void udp_diag_dump(struct sk_buff *skb, struct netlink_callback *cb,
> }
>
> static void udp_diag_get_info(struct sock *sk, struct inet_diag_msg *r,
> - void *info, bool net_admin)
> + void *info)
> {
> r->idiag_rqueue = udp_rqueue_get(sk);
> r->idiag_wqueue = sk_wmem_alloc_get(sk);
> diff --git a/net/mptcp/diag.c b/net/mptcp/diag.c
> index 590cdee419ef9..66695d17a63cc 100644
> --- a/net/mptcp/diag.c
> +++ b/net/mptcp/diag.c
> @@ -16,7 +16,7 @@ static int subflow_get_info(struct sock *sk, struct sk_buff *skb, bool net_admin
> {
> struct mptcp_subflow_context *sf;
> struct nlattr *start;
> - u64 map_seq;
> + u64 map_seq = 0;
> u32 flags = 0;
> bool slow;
> int err;
> @@ -36,10 +36,9 @@ static int subflow_get_info(struct sock *sk, struct sk_buff *skb, bool net_admin
> goto nla_failure;
> }
>
> - map_seq = 0;
> if (sf->conn && sf->map_seq)
> map_seq = sf->map_seq -
> - READ_ONCE(mptcp_sk(sf->conn)->remote_idsn);
> + (unsigned long)mptcp_sk(sf->conn);
>
> if (sf->mp_capable)
> flags |= MPTCP_SUBFLOW_FLAG_MCAP_REM;
> diff --git a/net/mptcp/mptcp_diag.c b/net/mptcp/mptcp_diag.c
> index d526b1015da16..136c2d05c0eeb 100644
> --- a/net/mptcp/mptcp_diag.c
> +++ b/net/mptcp/mptcp_diag.c
> @@ -190,7 +190,7 @@ static void mptcp_diag_dump(struct sk_buff *skb, struct netlink_callback *cb,
> }
>
> static void mptcp_diag_get_info(struct sock *sk, struct inet_diag_msg *r,
> - void *_info, bool net_admin)
> + void *_info)
> {
> struct mptcp_sock *msk = mptcp_sk(sk);
> struct mptcp_info *info = _info;
> @@ -215,13 +215,6 @@ static void mptcp_diag_get_info(struct sock *sk, struct inet_diag_msg *r,
> return;
>
> mptcp_diag_fill_info(msk, info);
> -
> - if (!net_admin) {
> - /* Hide data sequence numbers from unprivileged users. */
> - info->mptcpi_write_seq = 0;
> - info->mptcpi_snd_una = 0;
> - info->mptcpi_rcv_nxt = 0;
> - }
> }
>
> static const struct inet_diag_handler mptcp_diag_handler = {
> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index e59209b6fc41c..f22d64ab1c53b 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
> @@ -3216,8 +3216,6 @@ static void __mptcp_init_sock(struct sock *sk)
> INIT_WORK(&msk->work, mptcp_worker);
> msk->out_of_order_queue = RB_ROOT;
> msk->first_pending = NULL;
> - WRITE_ONCE(msk->local_idsn, 0);
> - WRITE_ONCE(msk->remote_idsn, 0);
>
> /* msk does not go through tcp_init_sock(); seed RTO bounds. */
> icsk->icsk_rto_min =
> @@ -3765,7 +3763,6 @@ struct sock *mptcp_sk_clone_init(const struct sock *sk,
>
> msk = mptcp_sk(nsk);
> WRITE_ONCE(msk->local_key, subflow_req->local_key);
> - WRITE_ONCE(msk->local_idsn, subflow_req->idsn);
> WRITE_ONCE(msk->token, subflow_req->token);
> msk->in_accept_queue = 1;
> WRITE_ONCE(msk->fully_established, false);
> @@ -4204,7 +4201,6 @@ static int mptcp_connect(struct sock *sk, struct sockaddr_unsized *uaddr,
> MPTCP_MIB_TOKENFALLBACKINIT);
> }
>
> - WRITE_ONCE(msk->local_idsn, subflow->idsn);
> WRITE_ONCE(msk->write_seq, subflow->idsn);
> WRITE_ONCE(msk->snd_nxt, subflow->idsn);
> WRITE_ONCE(msk->snd_una, subflow->idsn);
> diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
> index fc6858863fa89..3d250e8204d52 100644
> --- a/net/mptcp/protocol.h
> +++ b/net/mptcp/protocol.h
> @@ -288,8 +288,6 @@ struct mptcp_sock {
> * lockless access read
> */
> u64 remote_key; /* same as above */
> - u64 local_idsn;
> - u64 remote_idsn;
> u64 write_seq;
> u64 bytes_sent;
> u64 snd_nxt;
> diff --git a/net/mptcp/sockopt.c b/net/mptcp/sockopt.c
> index b20263b4cd55c..6ee9dcfea5c79 100644
> --- a/net/mptcp/sockopt.c
> +++ b/net/mptcp/sockopt.c
> @@ -1047,7 +1047,7 @@ static int mptcp_getsockopt_first_sf_only(struct mptcp_sock *msk, int level, int
> void mptcp_diag_fill_info(struct mptcp_sock *msk, struct mptcp_info *info)
> {
> struct sock *sk = (struct sock *)msk;
> - u64 local_idsn = 0, remote_idsn = 0;
> + u64 offset = (unsigned long)msk;
> u32 flags = 0;
> bool slow;
> u32 now;
> @@ -1085,11 +1085,9 @@ void mptcp_diag_fill_info(struct mptcp_sock *msk, struct mptcp_info *info)
> info->mptcpi_flags = flags;
>
> slow = lock_sock_fast(sk);
> - local_idsn = READ_ONCE(msk->local_idsn);
> -
> info->mptcpi_csum_enabled = READ_ONCE(msk->csum_enabled);
> info->mptcpi_token = msk->token;
> - info->mptcpi_write_seq = msk->write_seq - local_idsn;
> + info->mptcpi_write_seq = msk->write_seq - offset;
> info->mptcpi_retransmits = inet_csk(sk)->icsk_retransmits;
> info->mptcpi_bytes_sent = msk->bytes_sent;
> info->mptcpi_bytes_received = msk->bytes_received;
> @@ -1102,20 +1100,17 @@ void mptcp_diag_fill_info(struct mptcp_sock *msk, struct mptcp_info *info)
> unlock_sock_fast(sk, slow);
>
> mptcp_data_lock(sk);
> - if (READ_ONCE(msk->can_ack))
> - remote_idsn = READ_ONCE(msk->remote_idsn);
> info->mptcpi_last_ack_recv = jiffies_to_msecs(now - msk->last_ack_recv);
> - info->mptcpi_snd_una = msk->snd_una - local_idsn;
> - info->mptcpi_rcv_nxt = msk->ack_seq - remote_idsn;
> + info->mptcpi_snd_una = msk->snd_una - offset;
> + info->mptcpi_rcv_nxt = msk->ack_seq - offset;
> info->mptcpi_bytes_acked = msk->bytes_acked;
> mptcp_data_unlock(sk);
> -
> }
> EXPORT_SYMBOL_GPL(mptcp_diag_fill_info);
>
> static int mptcp_getsockopt_info(struct mptcp_sock *msk, char __user *optval, int __user *optlen)
> {
> struct mptcp_info m_info = {};
> int len;
>
> if (get_user(len, optlen))
> diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
> index 39c7422afa779..55de605226ad0 100644
> --- a/net/mptcp/subflow.c
> +++ b/net/mptcp/subflow.c
> @@ -490,12 +490,11 @@ static void subflow_set_remote_key(struct mptcp_sock *msk,
> subflow->map_seq = subflow->iasn;
>
> WRITE_ONCE(msk->remote_key, subflow->remote_key);
> - WRITE_ONCE(msk->remote_idsn, subflow->iasn - 1);
> WRITE_ONCE(msk->ack_seq, subflow->iasn);
> WRITE_ONCE(msk->can_ack, true);
> atomic64_set(&msk->rcv_wnd_sent, subflow->iasn);
>
> /* publish last, once iasn and the fields above are fully populated */
> subflow->remote_key_valid = 1;
> }
>
> diff --git a/net/sctp/diag.c b/net/sctp/diag.c
> index ab6c560fde053..c2a0de2adf6fd 100644
> --- a/net/sctp/diag.c
> +++ b/net/sctp/diag.c
> @@ -20,7 +20,7 @@
> #include <net/sctp/sctp.h>
>
> static void sctp_diag_get_info(struct sock *sk, struct inet_diag_msg *r,
> - void *info, bool net_admin);
> + void *info);
>
> /* define some functions to make asoc/ep fill look clean */
> static void inet_diag_msg_sctpasoc_fill(struct inet_diag_msg *r,
> @@ -200,7 +200,7 @@ static int inet_sctp_diag_fill(struct sock *sk, struct sctp_association *asoc,
> }
> infox.sctpinfo = (struct sctp_info *)info;
> infox.asoc = asoc;
> - sctp_diag_get_info(sk, r, &infox, net_admin);
> + sctp_diag_get_info(sk, r, &infox);
>
> addr_list = asoc ? &asoc->base.bind_addr.address_list
> : &ep->base.bind_addr.address_list;
> @@ -412,7 +412,7 @@ static int sctp_ep_dump(struct sctp_endpoint *ep, void *p)
>
> /* define the functions for sctp_diag_handler*/
> static void sctp_diag_get_info(struct sock *sk, struct inet_diag_msg *r,
> - void *info, bool net_admin)
> + void *info)
> {
> struct sctp_infox *infox = (struct sctp_infox *)info;
>
> --
> 2.43.0
>
Hi Kalpan, On 12/11/2026 05:57, Kalpan Jani wrote: > Hi All, > > I investigated the patch application failure locally. > > The patch applies successfully to the intended base commit 27c69362083ec117ddb553c031e7f1e0e5d2105d. > > I also tested both git apply --check and git apply --3way --check in a fresh detached worktree. Both tests passed, and all 12 files applied cleanly. > Could you please check whether the CI environment has the expected base commit and the required Git blob objects available? The base you mentions here is not in our tree: https://github.com/multipath-tcp/mptcp_net-next/commit/27c69362083ec117ddb553c031e7f1e0e5d2105d Also, it is not mentioned in the patch you sent. The CI cannot apply this patch: https://patchew.org/MPTCP/20261106111645.786225-1-kalpan.jani@mpiricsoftware.com/logs/git/ > The reported sha1 information is lacking or useless error may be related to the CI checkout or missing Git objects. From what I see, the patch you sent is on top of the v11, instead of replacing it. Now, regarding the modifications -- even if it is hard to read -- the offset using the msk address seems to be in place. Now that I'm thinking about that, I'm afraid I might have given a bad direction: it is probably not a good idea to give clues on the msk address while there are many mechanisms in the kernel to hide that. Maybe we could take a hash of this address? But that's costly: maybe we only want to do that when coming from mptcp_diag_get_info? Also, we should probably have one offset per direction (local/remote) not to be able to find out what's the offset is when one direction is known. We could have a hash of the msk address for one, and another hash coming from a XOR of the msk address for example. Any other ideas? Cheers, Matt -- Sponsored by the NGI0 Core fund.
Hi Matt, Thanks for reviewing and pointing this out. Regarding the base commit, I understand the issue. My local patch was tested against a tree that is not present in your current mptcp_net-next tree. I will check the correct base and prepare the patch as a replacement for v11 rather than stacking it on top of v11. Regarding the offset, I understand your concern about exposing information derived from the MPTCP socket address. One alternative could be to use independent random offsets for the local and remote sequence-number directions, generated once per MPTCP connection and stored in the MPTCP socket structure. This would avoid deriving the offsets from a kernel address. However, this introduces additional state and initialization requirements. We should also consider whether it preserves the expected semantics of the sequence numbers reported by MPTCP diagnostics. Would retaining the existing `local_idsn` and `remote_idsn` values be preferable, or do you think independent per-direction random offsets are worth exploring? I would appreciate your thoughts before I proceed with the next revision. Cheers, Kalpan Jani From: Matthieu Baerts <matttbe@kernel.org> To: "Kalpan Jani"<kalpan.jani@mpiricsoftware.com> Cc: "mptcp"<mptcp@lists.linux.dev>, "shardul.b"<shardul.b@mpiricsoftware.com>, "janak"<janak@mpiric.us>, "kalpanjani009"<kalpanjani009@gmail.com> Date: Thu, 12 Nov 2026 15:49:55 +0530 Subject: Re: [RFC net-next v12] mptcp: normalize sequence numbers using socket address > Hi Kalpan, > > On 12/11/2026 05:57, Kalpan Jani wrote: > > Hi All, > > > > I investigated the patch application failure locally. > > > > The patch applies successfully to the intended base commit 27c69362083ec117ddb553c031e7f1e0e5d2105d. > > > > I also tested both git apply --check and git apply --3way --check in a fresh detached worktree. Both tests passed, and all 12 files applied cleanly. > > Could you please check whether the CI environment has the expected base commit and the required Git blob objects available? > > The base you mentions here is not in our tree: > > > https://github.com/multipath-tcp/mptcp_net-next/commit/27c69362083ec117ddb553c031e7f1e0e5d2105d > > Also, it is not mentioned in the patch you sent. The CI cannot apply > this patch: > > > https://patchew.org/MPTCP/20261106111645.786225-1-kalpan.jani@mpiricsoftware.com/logs/git/ > > > The reported sha1 information is lacking or useless error may be related to the CI checkout or missing Git objects. > > From what I see, the patch you sent is on top of the v11, instead of > replacing it. > > Now, regarding the modifications -- even if it is hard to read -- the > offset using the msk address seems to be in place. Now that I'm thinking > about that, I'm afraid I might have given a bad direction: it is > probably not a good idea to give clues on the msk address while there > are many mechanisms in the kernel to hide that. Maybe we could take a > hash of this address? But that's costly: maybe we only want to do that > when coming from mptcp_diag_get_info? Also, we should probably have one > offset per direction (local/remote) not to be able to find out what's > the offset is when one direction is known. We could have a hash of the > msk address for one, and another hash coming from a XOR of the msk > address for example. > > Any other ideas? > > Cheers, > Matt > -- > Sponsored by the NGI0 Core fund. > >
Hi Kalpan, On 12/11/2026 12:37, Kalpan Jani wrote: > Hi Matt, > > Thanks for reviewing and pointing this out. > > Regarding the base commit, I understand the issue. My local patch was > tested against a tree that is not present in your current mptcp_net- next > tree. I will check the correct base and prepare the patch as a replacement > for v11 rather than stacking it on top of v11. > > Regarding the offset, I understand your concern about exposing information > derived from the MPTCP socket address. > > One alternative could be to use independent random offsets for the local > and remote sequence-number directions, generated once per MPTCP connection > and stored in the MPTCP socket structure. This would avoid deriving > the offsets from a kernel address. > > However, this introduces additional state and initialization requirements. Indeed... I think it would be better to avoid that "just to hide the real values". > We should also consider whether it preserves the expected semantics of > the sequence numbers reported by MPTCP diagnostics. > > Would retaining the existing `local_idsn` and `remote_idsn` values be > preferable, or do you think independent per-direction random offsets are > worth exploring? If we want to store the offsets, then better to use that, yes. But it feels like we should do something simpler. At this point, I hesitate with two options: - when mptcp_diag_fill_info() is called from mptcp_diag_get_info() (Netlink, not getsockopt()), use a generated offset based on the msk address (or maybe there is something else we could use for the offset? We don't want to use the token for the same reasons). - Or also only when called from mptcp_diag_get_info(), return 0 for the sequence numbers. Not sure the first option is worth it if it is costly "just for that". So maybe just the simple second version? > I would appreciate your thoughts before I proceed with the next revision. Thank you for your patience. Cheers, Matt -- Sponsored by the NGI0 Core fund.
Hi Matt, For the latest v13, I have removed the address-based sequence-number normalization and zeroed `mptcpi_write_seq`, `mptcpi_snd_una`, and `mptcpi_rcv_nxt` directly in the MPTCP Netlink diagnostic callback. This keeps the changes limited to the diagnostic path and leaves getsockopt() reporting unchanged. Currently, these fields are zeroed for all users, including those with CAP_NET_ADMIN. Would you prefer this behavior for all users, or should we hide these fields only from users without CAP_NET_ADMIN? Cheers, Kalpan Jani From: Matthieu Baerts <matttbe@kernel.org> To: "Kalpan Jani"<kalpan.jani@mpiricsoftware.com> Cc: "mptcp"<mptcp@lists.linux.dev>, "shardul.b"<shardul.b@mpiricsoftware.com>, "janak"<janak@mpiric.us>, "kalpanjani009"<kalpanjani009@gmail.com> Date: Thu, 12 Nov 2026 17:55:31 +0530 Subject: Re: [RFC net-next v12] mptcp: normalize sequence numbers using socket address > Hi Kalpan, > > On 12/11/2026 12:37, Kalpan Jani wrote: > > Hi Matt, > > > > Thanks for reviewing and pointing this out. > > > > Regarding the base commit, I understand the issue. My local patch was > > tested against a tree that is not present in your current mptcp_net- next > > tree. I will check the correct base and prepare the patch as a replacement > > for v11 rather than stacking it on top of v11. > > > > Regarding the offset, I understand your concern about exposing information > > derived from the MPTCP socket address. > > > > One alternative could be to use independent random offsets for the local > > and remote sequence-number directions, generated once per MPTCP connection > > and stored in the MPTCP socket structure. This would avoid deriving > > the offsets from a kernel address. > > > > However, this introduces additional state and initialization requirements. > > Indeed... I think it would be better to avoid that "just to hide the > real values". > > > We should also consider whether it preserves the expected semantics of > > the sequence numbers reported by MPTCP diagnostics. > > > > Would retaining the existing `local_idsn` and `remote_idsn` values be > > preferable, or do you think independent per-direction random offsets are > > worth exploring? > > If we want to store the offsets, then better to use that, yes. But it > feels like we should do something simpler. At this point, I hesitate > with two options: > > - when mptcp_diag_fill_info() is called from mptcp_diag_get_info() > (Netlink, not getsockopt()), use a generated offset based on the msk > address (or maybe there is something else we could use for the offset? > We don't want to use the token for the same reasons). > > - Or also only when called from mptcp_diag_get_info(), return 0 for the > sequence numbers. > > Not sure the first option is worth it if it is costly "just for that". > So maybe just the simple second version? > > > I would appreciate your thoughts before I proceed with the next revision. > > Thank you for your patience. > > Cheers, > Matt > -- > Sponsored by the NGI0 Core fund. > >
Hi Kalpan,
On 16/11/2026 13:43, Kalpan Jani wrote:
> For the latest v13, I have removed the address-based sequence-number
> normalization and zeroed `mptcpi_write_seq`, `mptcpi_snd_una`, and
> `mptcpi_rcv_nxt` directly in the MPTCP Netlink diagnostic callback.
>
> This keeps the changes limited to the diagnostic path and leaves
> getsockopt() reporting unchanged.
Good idea.
> Currently, these fields are zeroed for all users, including those
> with CAP_NET_ADMIN.
>
> Would you prefer this behavior for all users, or should we hide these
> fields only from users without CAP_NET_ADMIN?
Mmh, I think doing this only for users without CAP_NET_ADMIN would be
nice. *But*, I don't think the modifications in the other net subsystems
to get that would be accepted for -net, and maybe not even worth it as
an improvement for -next. So I would say: zero these fields for all
users in the MPTCP Netlink diagnostic callback.
You can prefix your next patch with 'mptcp-net', and with a Fixes tag
(maybe: ac3b45f60954 ("mptcp: add MPTCP socket diag interface")?).
Cheers,
Matt
--
Sponsored by the NGI0 Core fund
Hi Matt, Thanks for the clarification. I agree that introducing additional offsets or hashing the socket address just to hide the original values may add unnecessary complexity. The second approach seems simpler. We can zero the relevant sequence-number fields when `mptcp_diag_fill_info()` is called from `mptcp_diag_get_info()` for Netlink diagnostics, while preserving the existing values for `getsockopt()`. I will investigate this approach and prepare the patch as a replacement for v11, based on the correct mptcp_net-next tree. Cheers, Kalpan Jani From: Matthieu Baerts <matttbe@kernel.org> To: "Kalpan Jani"<kalpan.jani@mpiricsoftware.com> Cc: "mptcp"<mptcp@lists.linux.dev>, "shardul.b"<shardul.b@mpiricsoftware.com>, "janak"<janak@mpiric.us>, "kalpanjani009"<kalpanjani009@gmail.com> Date: Thu, 12 Nov 2026 17:55:31 +0530 Subject: Re: [RFC net-next v12] mptcp: normalize sequence numbers using socket address > Hi Kalpan, > > On 12/11/2026 12:37, Kalpan Jani wrote: > > Hi Matt, > > > > Thanks for reviewing and pointing this out. > > > > Regarding the base commit, I understand the issue. My local patch was > > tested against a tree that is not present in your current mptcp_net- next > > tree. I will check the correct base and prepare the patch as a replacement > > for v11 rather than stacking it on top of v11. > > > > Regarding the offset, I understand your concern about exposing information > > derived from the MPTCP socket address. > > > > One alternative could be to use independent random offsets for the local > > and remote sequence-number directions, generated once per MPTCP connection > > and stored in the MPTCP socket structure. This would avoid deriving > > the offsets from a kernel address. > > > > However, this introduces additional state and initialization requirements. > > Indeed... I think it would be better to avoid that "just to hide the > real values". > > > We should also consider whether it preserves the expected semantics of > > the sequence numbers reported by MPTCP diagnostics. > > > > Would retaining the existing `local_idsn` and `remote_idsn` values be > > preferable, or do you think independent per-direction random offsets are > > worth exploring? > > If we want to store the offsets, then better to use that, yes. But it > feels like we should do something simpler. At this point, I hesitate > with two options: > > - when mptcp_diag_fill_info() is called from mptcp_diag_get_info() > (Netlink, not getsockopt()), use a generated offset based on the msk > address (or maybe there is something else we could use for the offset? > We don't want to use the token for the same reasons). > > - Or also only when called from mptcp_diag_get_info(), return 0 for the > sequence numbers. > > Not sure the first option is worth it if it is costly "just for that". > So maybe just the simple second version? > > > I would appreciate your thoughts before I proceed with the next revision. > > Thank you for your patience. > > Cheers, > Matt > -- > Sponsored by the NGI0 Core fund. > >
© 2016 - 2026 Red Hat, Inc.