From 0e5f2b90a572c2c5ef6866432af0ef40ee36ae76 Mon Sep 17 00:00:00 2001 From: Avery Pennarun Date: Mon, 5 Oct 2020 22:41:16 -0400 Subject: [PATCH] echoRespondToAll: filter.Accept rather than filter.Drop on a match. This function is only called in fake mode, which won't do anything more with the packet after we respond to it anyway, so dropping it in the prefilter is not necessary. And it's kinda semantically wrong: we did not reject it, so telling the upper layer that it was rejected produces an ugly error message. Signed-off-by: Avery Pennarun --- wgengine/userspace.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/wgengine/userspace.go b/wgengine/userspace.go index 1048b791c..42563972e 100644 --- a/wgengine/userspace.go +++ b/wgengine/userspace.go @@ -374,10 +374,15 @@ func echoRespondToAll(p *packet.ParsedPacket, t *tstun.TUN) filter.Response { if p.IsEchoRequest() { header := p.ICMPHeader() header.ToResponse() - packet := packet.Generate(&header, p.Payload()) - t.InjectOutbound(packet) - // We already handled it, stop. - return filter.Drop + outp := packet.Generate(&header, p.Payload()) + t.InjectOutbound(outp) + // We already responded to it, but it's not an error. + // Proceed with regular delivery. (Since this code is only + // used in fake mode, regular delivery just means throwing + // it away. If this ever gets run in non-fake mode, you'll + // get double responses to pings, which is an indicator you + // shouldn't be doing that I guess.) + return filter.Accept } return filter.Accept }