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

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