From: JR Lanteigne <root@dnim.dev>
To: Eric Dumazet <edumazet@google.com>,
Kuniyuki Iwashima <kuniyu@google.com>,
Paolo Abeni <pabeni@redhat.com>,
Willem de Bruijn <willemb@google.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, Simon Horman <horms@kernel.org>,
Miroslav Lichvar <mlichvar@redhat.com>
Subject: [PATCH net] net: fall back to skb_iif for the timestamping pktinfo if_index
Date: Sun, 23 Aug 2026 02:21:00 -0300 [thread overview]
Message-ID: <178746246095.3786864.2262454553798466512@dnim.dev> (raw)
put_ts_pktinfo() resolves the interface index of a received packet
from its napi id. The lookup fails on drivers whose napi instances
are not attached to the delivering net_device (e.g. ti cpsw, which
keeps them on an internal dummy device) and on kernels built without
CONFIG_NET_RX_BUSY_POLL, where skb_napi_id() is always 0. In those
cases SCM_TIMESTAMPING_PKTINFO carries if_index 0 and applications
cannot tell which interface produced the hardware timestamp. chronyd,
for example, then ignores valid hardware timestamps.
Fall back to skb->skb_iif, which is set for every received packet.
On aggregated interfaces this reports the aggregating device instead
of the physical one, but only in cases where the napi lookup already
failed and nothing was reported at all.
Fixes: aad9c8c470f2 ("net: add new control message for incoming HW-timestamped packets")
Signed-off-by: JR Lanteigne <root@dnim.dev>
---
A userspace fallback for existing kernels was proposed to chrony
separately.
net/socket.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/socket.c b/net/socket.c
--- a/net/socket.c
+++ b/net/socket.c
@@ -900,6 +900,8 @@ static void put_ts_pktinfo(struct msghdr *msg, struct sk_buff *skb,
if_index = orig_dev->ifindex;
rcu_read_unlock();
}
+ if (!if_index)
+ if_index = skb->skb_iif;
ts_pktinfo.if_index = if_index;
ts_pktinfo.pkt_length = skb->len - skb_mac_offset(skb);
next reply other threads:[~2026-08-23 5:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-23 5:21 JR Lanteigne [this message]
2026-08-24 2:21 ` [PATCH net] net: fall back to skb_iif for the timestamping pktinfo if_index Willem de Bruijn
2026-08-24 10:24 ` JR Lanteigne
2026-08-24 7:58 ` Miroslav Lichvar
2026-08-24 10:24 ` JR Lanteigne
2026-08-24 14:06 ` Willem de Bruijn
2026-08-24 16:55 ` JR Lanteigne
2026-08-24 18:35 ` Willem de Bruijn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=178746246095.3786864.2262454553798466512@dnim.dev \
--to=root@dnim.dev \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=mlichvar@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox