From de00396669b9af5bbec6c94b7de97dd76cacfce9 Mon Sep 17 00:00:00 2001 From: cthuang Date: Mon, 19 Sep 2022 12:36:25 +0100 Subject: [PATCH] TUN-6778: Cleanup logs about ICMP --- ingress/icmp_darwin.go | 2 +- supervisor/supervisor.go | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ingress/icmp_darwin.go b/ingress/icmp_darwin.go index 78d0a87f..352b5c54 100644 --- a/ingress/icmp_darwin.go +++ b/ingress/icmp_darwin.go @@ -202,7 +202,7 @@ func (ip *icmpProxy) Serve(ctx context.Context) error { // In unit test, we found out when the listener listens on 0.0.0.0, the socket reads the full packet after // the second reply if err := ip.handleFullPacket(icmpDecoder, buf[:n]); err != nil { - ip.logger.Err(err).Str("dst", from.String()).Msg("Failed to parse ICMP reply as full packet") + ip.logger.Debug().Err(err).Str("dst", from.String()).Msg("Failed to parse ICMP reply as full packet") } continue } diff --git a/supervisor/supervisor.go b/supervisor/supervisor.go index ebd0e449..252a532c 100644 --- a/supervisor/supervisor.go +++ b/supervisor/supervisor.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "net" "strings" "time" @@ -155,7 +156,11 @@ func (s *Supervisor) Run( if s.edgeTunnelServer.icmpRouter != nil { go func() { if err := s.edgeTunnelServer.icmpRouter.Serve(ctx); err != nil { - s.log.Logger().Err(err).Msg("icmp router terminated") + if errors.Is(err, net.ErrClosed) { + s.log.Logger().Info().Err(err).Msg("icmp router terminated") + } else { + s.log.Logger().Err(err).Msg("icmp router terminated") + } } }() }