From cbf8c71fab2dca00e464c6232656d186a06fe001 Mon Sep 17 00:00:00 2001 From: cthuang Date: Wed, 28 Sep 2022 19:02:46 +0100 Subject: [PATCH] TUN-6716: Document limitation of Windows ICMP proxy --- ingress/icmp_windows.go | 3 +++ packet/router.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ingress/icmp_windows.go b/ingress/icmp_windows.go index bc98bcbe..7d9a46e0 100644 --- a/ingress/icmp_windows.go +++ b/ingress/icmp_windows.go @@ -262,6 +262,9 @@ func (ip *icmpProxy) Serve(ctx context.Context) error { return ctx.Err() } +// Request sends an ICMP echo request and wait for a reply or timeout. +// The async version of Win32 APIs take a callback whose memory is not garbage collected, so we use the synchronous version. +// It's possible that a slow request will block other requests, so we set the timeout to only 1s. func (ip *icmpProxy) Request(pk *packet.ICMP, responder packet.FunnelUniPipe) error { if pk == nil { return errPacketNil diff --git a/packet/router.go b/packet/router.go index 8e7e399d..2f0fa37b 100644 --- a/packet/router.go +++ b/packet/router.go @@ -11,7 +11,7 @@ import ( type ICMPRouter interface { // Serve starts listening for responses to the requests until context is done Serve(ctx context.Context) error - // Request sends an ICMP message + // Request sends an ICMP message. Implementations should not modify pk after the function returns. Request(pk *ICMP, responder FunnelUniPipe) error }