Blame SOURCES/bcc-0.16.0-tools-tcptracer-fix-alignement-in-tcp_ipv6_event_t.patch

d4dc1a
From 52c4e8cec4dd560503ff011f8fe7eec5f67b33c9 Mon Sep 17 00:00:00 2001
d4dc1a
From: Jerome Marchand <jmarchan@redhat.com>
d4dc1a
Date: Thu, 17 Sep 2020 10:37:02 +0200
d4dc1a
Subject: [PATCH 2/2] tools: tcptracer: fix alignement in tcp_ipv6_event_t
d4dc1a
d4dc1a
On IPv6, tcptracer ports always appears as zeros:
d4dc1a
d4dc1a
Tracing TCP established connections. Ctrl-C to end.
d4dc1a
T  PID    COMM             IP SADDR            DADDR            SPORT  DPORT
d4dc1a
X  7055   nc               4  127.0.0.1        127.0.0.1        49476  9999
d4dc1a
C  7074   nc               4  127.0.0.1        127.0.0.1        49478  9999
d4dc1a
X  7074   nc               4  127.0.0.1        127.0.0.1        49478  9999
d4dc1a
C  7085   nc               6  [::]             [0:0:0:1::]      0      0
d4dc1a
X  7085   nc               6  [::]             [0:0:0:1::]      0      0
d4dc1a
C  7086   nc               6  [::]             [0:0:0:1::]      0      0
d4dc1a
d4dc1a
This seems related to alignment issue wrt to the __int128 type in
d4dc1a
tcp_ipv6_event_t structure. Moving the u8 field ip to the end of the
d4dc1a
structure fixes the issue.
d4dc1a
d4dc1a
Fixes #2781
d4dc1a
---
d4dc1a
 tools/tcptracer.py | 2 +-
d4dc1a
 1 file changed, 1 insertion(+), 1 deletion(-)
d4dc1a
d4dc1a
diff --git a/tools/tcptracer.py b/tools/tcptracer.py
d4dc1a
index 2e486b15..3220105e 100755
d4dc1a
--- a/tools/tcptracer.py
d4dc1a
+++ b/tools/tcptracer.py
d4dc1a
@@ -73,12 +73,12 @@ struct tcp_ipv6_event_t {
d4dc1a
     u32 type;
d4dc1a
     u32 pid;
d4dc1a
     char comm[TASK_COMM_LEN];
d4dc1a
-    u8 ip;
d4dc1a
     unsigned __int128 saddr;
d4dc1a
     unsigned __int128 daddr;
d4dc1a
     u16 sport;
d4dc1a
     u16 dport;
d4dc1a
     u32 netns;
d4dc1a
+    u8 ip;
d4dc1a
 };
d4dc1a
 BPF_PERF_OUTPUT(tcp_ipv6_event);
d4dc1a
 
d4dc1a
-- 
d4dc1a
2.25.4
d4dc1a