From 2b42672be1c88063a34aa2f56adaa47fb2c1433d Mon Sep 17 00:00:00 2001 From: Akihiro Suda Date: Fri, 11 Oct 2024 15:54:18 +0900 Subject: [PATCH] Move several log messages to the debug level Fix issue 392 Fix lima-vm/lima issue 1160 Signed-off-by: Akihiro Suda --- pkg/services/forwarder/tcp.go | 7 ++++++- pkg/services/forwarder/udp.go | 7 ++++++- pkg/tap/switch.go | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/pkg/services/forwarder/tcp.go b/pkg/services/forwarder/tcp.go index 9026d662d..71a799887 100644 --- a/pkg/services/forwarder/tcp.go +++ b/pkg/services/forwarder/tcp.go @@ -42,7 +42,12 @@ func TCP(s *stack.Stack, nat map[tcpip.Address]tcpip.Address, natLock *sync.Mute ep, tcpErr := r.CreateEndpoint(&wq) r.Complete(false) if tcpErr != nil { - log.Errorf("r.CreateEndpoint() = %v", tcpErr) + if _, ok := tcpErr.(*tcpip.ErrConnectionRefused); ok { + // transient error + log.Debugf("r.CreateEndpoint() = %v", tcpErr) + } else { + log.Errorf("r.CreateEndpoint() = %v", tcpErr) + } return } diff --git a/pkg/services/forwarder/udp.go b/pkg/services/forwarder/udp.go index eef21d8e6..c1c0cea09 100644 --- a/pkg/services/forwarder/udp.go +++ b/pkg/services/forwarder/udp.go @@ -31,7 +31,12 @@ func UDP(s *stack.Stack, nat map[tcpip.Address]tcpip.Address, natLock *sync.Mute var wq waiter.Queue ep, tcpErr := r.CreateEndpoint(&wq) if tcpErr != nil { - log.Errorf("r.CreateEndpoint() = %v", tcpErr) + if _, ok := tcpErr.(*tcpip.ErrConnectionRefused); ok { + // transient error + log.Debugf("r.CreateEndpoint() = %v", tcpErr) + } else { + log.Errorf("r.CreateEndpoint() = %v", tcpErr) + } return } diff --git a/pkg/tap/switch.go b/pkg/tap/switch.go index 189f0d656..bc6b36b16 100644 --- a/pkg/tap/switch.go +++ b/pkg/tap/switch.go @@ -80,7 +80,7 @@ func (e *Switch) DeliverNetworkPacket(_ tcpip.NetworkProtocolNumber, pkt *stack. func (e *Switch) Accept(ctx context.Context, rawConn net.Conn, protocol types.Protocol) error { conn := protocolConn{Conn: rawConn, protocolImpl: protocolImplementation(protocol)} - log.Infof("new connection from %s to %s", conn.RemoteAddr().String(), conn.LocalAddr().String()) + log.Debugf("new connection from %s to %s", conn.RemoteAddr().String(), conn.LocalAddr().String()) id, failed := e.connect(conn) if failed { log.Error("connection failed")