sos/SOURCES/sos-bz1768956-ebpf-per-name...

59 lines
2.3 KiB
Diff

From 93ba31695ad532ce96c93dc511f966e7a3e9ae94 Mon Sep 17 00:00:00 2001
From: Pavel Moravec <pmoravec@redhat.com>
Date: Tue, 3 Dec 2019 22:03:10 +0100
Subject: [PATCH] [kernel,networking] collect bpftool net list for each
namespace
- move "bpftool net list" command execution from kernel to networking
plugin as it belongs rather to networking.
- collect that output per each net name space as well
Resolves: #1874
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
---
sos/plugins/kernel.py | 4 ----
sos/plugins/networking.py | 7 ++++++-
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/sos/plugins/kernel.py b/sos/plugins/kernel.py
index 5c8521433..8224e5c05 100644
--- a/sos/plugins/kernel.py
+++ b/sos/plugins/kernel.py
@@ -142,10 +142,6 @@ class Kernel(Plugin, RedHatPlugin, Debia
if not self.get_option("trace"):
self.add_forbidden_path("/sys/kernel/debug/tracing/trace")
- # collect list of bpf program attachments in the kernel
- # networking subsystem
- self.add_cmd_output("bpftool net list")
-
# collect list of eBPF programs and maps and their dumps
prog_file = self.get_cmd_output_now("bpftool -j prog list")
for prog_id in self.get_bpftool_prog_ids(prog_file):
diff --git a/sos/plugins/networking.py b/sos/plugins/networking.py
index 2f655042a..0026cda9d 100644
--- a/sos/plugins/networking.py
+++ b/sos/plugins/networking.py
@@ -205,6 +205,10 @@ class Networking(Plugin):
if self.get_option("traceroute"):
self.add_cmd_output("/bin/traceroute -n %s" % self.trace_host)
+ # collect list of bpf program attachments in the kernel
+ # networking subsystem
+ self.add_cmd_output("bpftool net list")
+
# Capture additional data from namespaces; each command is run
# per-namespace.
ip_netns_file = self.get_cmd_output_now("ip netns")
@@ -212,7 +216,8 @@ def setup(self):
ns_cmd_prefix + "iptables-save",
ns_cmd_prefix + "netstat %s -neopa" % self.ns_wide,
ns_cmd_prefix + "netstat -s",
- ns_cmd_prefix + "netstat %s -agn" % self.ns_wide
+ ns_cmd_prefix + "netstat %s -agn" % self.ns_wide,
+ ns_cmd_prefix + "bpftool net list",
])
ss_cmd = ns_cmd_prefix + "ss -peaonmi"