summaryrefslogtreecommitdiff
path: root/src/busctl
diff options
context:
space:
mode:
authorStephen Hemminger <sthemmin@microsoft.com>2021-12-24 22:07:40 -0800
committerGitHub <noreply@github.com>2021-12-25 15:07:40 +0900
commit7c4bd9ac98db6f8804fca6a362a583057f6058f7 (patch)
tree9b7174a8c603500cfed7d87f6584b3b07a40eed3 /src/busctl
parent402b81ffd8548249e846b045b10d6e8c852d2904 (diff)
downloadsystemd-7c4bd9ac98db6f8804fca6a362a583057f6058f7.tar.gz
bus-dump: change capture output to use pcapng (#21738)
This patch changes busctl capture to generate pcapng format instead of the legacy pcap format files. It includes basic meta-data in the file and still uses microsecond time resolution. In future, more things can be added such as high resolution timestams, statistics, etc. PCAP Next Generation capture file format is what tshark uses and is in process of being standardized in IETF. It is also readable with libpcap. $ capinfos /tmp/new.pcapng File name: /tmp/new.pcapng File type: Wireshark/... - pcapng File encapsulation: D-Bus File timestamp precision: microseconds (6) Packet size limit: file hdr: (not set) Packet size limit: inferred: 4096 bytes Number of packets: 22 File size: 21kB Data size: 20kB Capture duration: 0.005694 seconds First packet time: 2021-12-11 11:57:42.788374 Last packet time: 2021-12-11 11:57:42.794068 Data byte rate: 3,671kBps Data bit rate: 29Mbps Average packet size: 950.27 bytes Average packet rate: 3,863 packets/s SHA256: b85ed8b094af60c64aa6d9db4a91404e841736d36b9e662d707db9e4096148f1 RIPEMD160: 81f9bac7ec0ec5cd1d55ede136a5c90413894e3a SHA1: 8400822ef724b934d6000f5b7604b9e6e91be011 Strict time order: True Capture oper-sys: Linux 5.14.0-0.bpo.2-amd64 Capture application: systemd 250 (250-rc2-33-gdc79ae2+) Number of interfaces in file: 1 Interface #0 info: Encapsulation = D-Bus (146 - dbus) Capture length = 4096 Time precision = microseconds (6) Time ticks per second = 1000000 Number of stat entries = 0 Number of packets = 22
Diffstat (limited to 'src/busctl')
-rw-r--r--src/busctl/busctl.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/busctl/busctl.c b/src/busctl/busctl.c
index c0c9b23ae9..b532de4f9b 100644
--- a/src/busctl/busctl.c
+++ b/src/busctl/busctl.c
@@ -20,6 +20,7 @@
#include "json.h"
#include "log.h"
#include "main-func.h"
+#include "os-util.h"
#include "pager.h"
#include "parse-argument.h"
#include "parse-util.h"
@@ -31,6 +32,7 @@
#include "terminal-util.h"
#include "user-util.h"
#include "verbs.h"
+#include "version.h"
static JsonFormatFlags arg_json_format_flags = JSON_FORMAT_OFF;
static PagerFlags arg_pager_flags = 0;
@@ -1329,13 +1331,20 @@ static int verb_monitor(int argc, char **argv, void *userdata) {
}
static int verb_capture(int argc, char **argv, void *userdata) {
+ _cleanup_free_ char *osname = NULL;
+ static const char info[] =
+ "busctl (systemd) " STRINGIFY(PROJECT_VERSION) " (Git " GIT_VERSION ")";
int r;
if (isatty(fileno(stdout)) > 0)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"Refusing to write message data to console, please redirect output to a file.");
- bus_pcap_header(arg_snaplen, stdout);
+ r = parse_os_release(NULL, "PRETTY_NAME", &osname);
+ if (r < 0)
+ log_full_errno(r == -ENOENT ? LOG_DEBUG : LOG_INFO, r,
+ "Failed to read os-release file, ignoring: %m");
+ bus_pcap_header(arg_snaplen, osname, info, stdout);
r = monitor(argc, argv, message_pcap);
if (r < 0)