From 8ab46952d46dbbc2ced9ab43705aad1ec3a0eb13 Mon Sep 17 00:00:00 2001 From: James Tucker Date: Sat, 9 Sep 2023 11:39:44 -0700 Subject: [PATCH] net/ping: fix ICMP echo code field to 0 The code was trying to pass the ICMP protocol number here (1), which is not a valid code. Many servers will not respond to echo messages with codes other than 0. https://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml#icmp-parameters-codes-8 Updates #9299 Signed-off-by: James Tucker --- net/ping/ping.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ping/ping.go b/net/ping/ping.go index 170d87fb9..01f3dcf2c 100644 --- a/net/ping/ping.go +++ b/net/ping/ping.go @@ -303,7 +303,7 @@ func (p *Pinger) Send(ctx context.Context, dest net.Addr, data []byte) (time.Dur m := icmp.Message{ Type: icmpType, - Code: icmpType.Protocol(), + Code: 0, Body: &icmp.Echo{ ID: int(p.id), Seq: int(seq),