Netdev List
 help / color / mirror / Atom feed
* [PATCH net] xfrm: espintcp: read the socket error queue for MSG_ERRQUEUE
@ 2026-11-12 16:09 Baek Kyu, Kim
  2026-11-23 11:20 ` Steffen Klassert
  0 siblings, 1 reply; 2+ messages in thread
From: Baek Kyu, Kim @ 2026-11-12 16:09 UTC (permalink / raw)
  To: Steffen Klassert; +Cc: Herbert Xu, David S. Miller, netdev

An ESP-in-TCP socket can have a TX timestamp queued and report POLLERR,
but recvmsg(MSG_ERRQUEUE) returns EAGAIN because espintcp_recvmsg()
reads the IKE queue instead. If an IKE message is pending, the same call
consumes that message as though it were an error-queue result.

Handle MSG_ERRQUEUE through inet_recv_error() before reading the IKE
queue. This exposes queued error metadata and leaves IKE messages for
normal receive calls.

Fixes: e27cca96cd68 ("xfrm: add espintcp (RFC 8229)")
Signed-off-by: Baek Kyu, Kim <pocj8ur4in@gmail.com>
---
With the same arm64 QEMU/KVM configuration and loopback fixture, the
original kernel returned EAGAIN for a queued TX timestamp and consumed
IKE data on MSG_ERRQUEUE. The changed kernel returned the timestamp
metadata and preserved IKE data for normal receive, on both IPv4 and
IPv6. Ordinary TCP and normal IKE receive paths were also compared.
No external IKE peer or physical network was tested.

 net/xfrm/espintcp.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/xfrm/espintcp.c b/net/xfrm/espintcp.c
index 4052ae5bbb2ea5..3e23900d6446b9 100644
--- a/net/xfrm/espintcp.c
+++ b/net/xfrm/espintcp.c
@@ -148,6 +148,9 @@ static int espintcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
 	int copied;
 	int off = 0;
 
+	if (unlikely(flags & MSG_ERRQUEUE))
+		return inet_recv_error(sk, msg, len);
+
 	skb = __skb_recv_datagram(sk, &ctx->ike_queue, flags, &off, &err);
 	if (!skb) {
 		if (err == -EAGAIN && sk->sk_shutdown & RCV_SHUTDOWN)
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-23 11:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-12 16:09 [PATCH net] xfrm: espintcp: read the socket error queue for MSG_ERRQUEUE Baek Kyu, Kim
2026-11-23 11:20 ` Steffen Klassert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox