void-packages/srcpkgs/termshark/patches/default-interface.patch

28 lines
1,017 B
Diff
Raw Normal View History

# reason: default to first interface if no args are given
# source: https://github.com/gcla/termshark/commit/99241799288932a26d92a9a72a69e01829906054
From 99241799288932a26d92a9a72a69e01829906054 Mon Sep 17 00:00:00 2001
From: Ross Jacobs <rj@swit.sh>
Date: Tue, 23 Apr 2019 22:34:20 +0100
Subject: [PATCH] Fixes #5, fixes #8
---
cmd/termshark/termshark.go | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/cmd/termshark/termshark.go b/cmd/termshark/termshark.go
index 16ed5d2..b268f5d 100644
--- cmd/termshark/termshark.go
+++ cmd/termshark/termshark.go
@@ -2230,6 +2230,10 @@ func cmain() int {
// argument is a pcap file e.g. termshark foo.pcap
if pcapf == "" && opts.Iface == "" {
pcapf = string(opts.Args.FilterOrFile)
+ // `termshark` => `termshark -i 1` (livecapture on default interface if no args)
+ if pcapf == "" {
+ opts.Iface = "1"
+ }
} else {
// Add it to filter args. Figure out later if they're capture or display.
filterArgs = append(filterArgs, opts.Args.FilterOrFile)