Skip to content

Commit 37a6103

Browse files
author
Menglong Dong
committed
bpf: fix icsk_timeout not exist in 6.10+ kernel
Signed-off-by: Menglong Dong <[email protected]>
1 parent f42f90d commit 37a6103

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/progs/skb_parse.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@ static inline int probe_parse_sk(struct sock *sk, sock_t *ske,
388388
struct inet_connection_sock *icsk;
389389
struct sock_common *skc;
390390
u8 saddr[16], daddr[16];
391+
unsigned long tmo;
391392
u16 l3_proto;
392393
u8 l4_proto;
393394

@@ -478,8 +479,13 @@ static inline int probe_parse_sk(struct sock *sk, sock_t *ske,
478479
icsk_retransmits) -
479480
1);
480481

481-
if (bpf_core_helper_exist(jiffies64))
482-
ske->timer_out = _C(icsk, icsk_timeout) - (unsigned long)bpf_jiffies64();
482+
if (bpf_core_helper_exist(jiffies64)) {
483+
if (bpf_core_field_exists(icsk->icsk_timeout))
484+
tmo = _C(icsk, icsk_timeout);
485+
else
486+
tmo = _C(icsk, icsk_retransmit_timer.expires);
487+
ske->timer_out = tmo - (unsigned long)bpf_jiffies64();
488+
}
483489

484490
ske->timer_pending = _C(icsk, icsk_pending);
485491

0 commit comments

Comments
 (0)