Blame SOURCES/bcc-0.25.0-Revert-tools-tcpaccept-Fix-support-for-v5.6-kernels.patch

f869ca
From acee5d39d24b102e8ed09a242cb1c53246a1fb7f Mon Sep 17 00:00:00 2001
f869ca
From: Jerome Marchand <jmarchan@redhat.com>
f869ca
Date: Tue, 29 Nov 2022 15:33:49 +0100
f869ca
Subject: [PATCH] Revert "tools/tcpaccept: Fix support for v5.6+ kernels"
f869ca
f869ca
This reverts commit 28955512d991ee3849c2a9accfc54bef9cd35f21.
f869ca
f869ca
It breaks tcpaccept on RHEL 8 kernel.
f869ca
---
f869ca
 tools/tcpaccept.py | 9 ++-------
f869ca
 1 file changed, 2 insertions(+), 7 deletions(-)
f869ca
f869ca
diff --git a/tools/tcpaccept.py b/tools/tcpaccept.py
f869ca
index b2ace4fa..d3e44143 100755
f869ca
--- a/tools/tcpaccept.py
f869ca
+++ b/tools/tcpaccept.py
f869ca
@@ -116,7 +116,7 @@ int kretprobe__inet_csk_accept(struct pt_regs *ctx)
f869ca
         return 0;
f869ca
 
f869ca
     // check this is TCP
f869ca
-    u16 protocol = 0;
f869ca
+    u8 protocol = 0;
f869ca
     // workaround for reading the sk_protocol bitfield:
f869ca
 
f869ca
     // Following comments add by Joe Yin:
f869ca
@@ -132,12 +132,7 @@ int kretprobe__inet_csk_accept(struct pt_regs *ctx)
f869ca
     int gso_max_segs_offset = offsetof(struct sock, sk_gso_max_segs);
f869ca
     int sk_lingertime_offset = offsetof(struct sock, sk_lingertime);
f869ca
 
f869ca
-
f869ca
-    // Since kernel v5.6 sk_protocol is its own u16 field and gso_max_segs
f869ca
-    // precedes sk_lingertime.
f869ca
-    if (sk_lingertime_offset - gso_max_segs_offset == 2)
f869ca
-        protocol = newsk->sk_protocol;
f869ca
-    else if (sk_lingertime_offset - gso_max_segs_offset == 4)
f869ca
+    if (sk_lingertime_offset - gso_max_segs_offset == 4)
f869ca
         // 4.10+ with little endian
f869ca
 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
f869ca
         protocol = *(u8 *)((u64)&newsk->sk_gso_max_segs - 3);
f869ca
-- 
f869ca
2.38.1
f869ca