From 54fa5d1e4a669b4902c089464c1827a1d90737fe Mon Sep 17 00:00:00 2001 From: Charlie Jonas Date: Tue, 9 Feb 2021 18:54:19 +0000 Subject: [PATCH] Add size flag to demo pinger Adds a command line flag to the demo pinger which lets the user set the the size of the ICMP payload. This is useful for testing. The default is set at 16 which is the default for an unconfigured pinger. Signed-off-by: Charlie Jonas --- cmd/ping/ping.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/ping/ping.go b/cmd/ping/ping.go index beba292..ef7f7b6 100644 --- a/cmd/ping/ping.go +++ b/cmd/ping/ping.go @@ -31,12 +31,16 @@ Examples: # Send a privileged raw ICMP ping sudo ping --privileged www.google.com + + # Send ICMP messages with a 100-byte payload + ping -s 100 1.1.1.1 ` func main() { timeout := flag.Duration("t", time.Second*100000, "") interval := flag.Duration("i", time.Second, "") count := flag.Int("c", -1, "") + size := flag.Int("s", 16, "") privileged := flag.Bool("privileged", false, "") flag.Usage = func() { fmt.Print(usage) @@ -81,6 +85,7 @@ func main() { } pinger.Count = *count + pinger.Size = *size pinger.Interval = *interval pinger.Timeout = *timeout pinger.SetPrivileged(*privileged)