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

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