From 1d83fccd9c004c52abdd911bb53bb886c87ae1af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Papp?= Date: Wed, 3 Sep 2025 13:28:04 +0200 Subject: [PATCH 1/3] Improve logging for management service connection and system info gathering --- client/internal/engine.go | 3 +-- client/system/info.go | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/client/internal/engine.go b/client/internal/engine.go index ca01bfd14..61ff41600 100644 --- a/client/internal/engine.go +++ b/client/internal/engine.go @@ -949,7 +949,6 @@ func (e *Engine) receiveManagementEvents() { e.config.LazyConnectionEnabled, ) - // err = e.mgmClient.Sync(info, e.handleSync) err = e.mgmClient.Sync(e.ctx, info, e.handleSync) if err != nil { // happens if management is unavailable for a long time. @@ -960,7 +959,7 @@ func (e *Engine) receiveManagementEvents() { } log.Debugf("stopped receiving updates from Management Service") }() - log.Debugf("connecting to Management Service updates stream") + log.Infof("connecting to Management Service updates stream") } func (e *Engine) updateSTUNs(stuns []*mgmProto.HostConfig) error { diff --git a/client/system/info.go b/client/system/info.go index ea3f6063a..397dfe3b9 100644 --- a/client/system/info.go +++ b/client/system/info.go @@ -7,6 +7,7 @@ import ( "strings" "google.golang.org/grpc/metadata" + "gvisor.dev/gvisor/pkg/log" "github.com/netbirdio/netbird/shared/management/proto" ) @@ -180,6 +181,7 @@ func isDuplicated(addresses []NetworkAddress, addr NetworkAddress) bool { // GetInfoWithChecks retrieves and parses the system information with applied checks. func GetInfoWithChecks(ctx context.Context, checks []*proto.Checks) (*Info, error) { + log.Debugf("gathering system information with checks: %d", len(checks)) processCheckPaths := make([]string, 0) for _, check := range checks { processCheckPaths = append(processCheckPaths, check.GetFiles()...) @@ -189,10 +191,12 @@ func GetInfoWithChecks(ctx context.Context, checks []*proto.Checks) (*Info, erro if err != nil { return nil, err } + log.Debugf("gathering process check information completed") info := GetInfo(ctx) info.Files = files + log.Debugf("all system information gathered successfully") return info, nil } From fd13247d66b917f9ab5c339a13769599065e9806 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Papp?= Date: Wed, 3 Sep 2025 14:06:28 +0200 Subject: [PATCH 2/3] Explicit print out the first success handshake time --- client/iface/configurer/usp.go | 7 +++++++ client/internal/peer/wg_watcher.go | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/client/iface/configurer/usp.go b/client/iface/configurer/usp.go index 171458e38..945f1a162 100644 --- a/client/iface/configurer/usp.go +++ b/client/iface/configurer/usp.go @@ -394,6 +394,13 @@ func toLastHandshake(stringVar string) (time.Time, error) { if err != nil { return time.Time{}, fmt.Errorf("parse handshake sec: %w", err) } + + // If sec is 0 (Unix epoch), return zero time instead + // This indicates no handshake has occurred + if sec == 0 { + return time.Time{}, nil + } + return time.Unix(sec, 0), nil } diff --git a/client/internal/peer/wg_watcher.go b/client/internal/peer/wg_watcher.go index 218872c15..b6c5817f8 100644 --- a/client/internal/peer/wg_watcher.go +++ b/client/internal/peer/wg_watcher.go @@ -101,6 +101,10 @@ func (w *WGWatcher) periodicHandshakeCheck(ctx context.Context, ctxCancel contex onDisconnectedFn() return } + if lastHandshake.IsZero() { + w.log.Infof("first wg handshake detected at: %s", handshake) + } + lastHandshake = *handshake resetTime := time.Until(handshake.Add(checkPeriod)) From f86a7f745e9c7446a7860607fc79bb874f6b4ee3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Papp?= Date: Wed, 3 Sep 2025 14:08:53 +0200 Subject: [PATCH 3/3] Fix logging library --- client/system/info.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/system/info.go b/client/system/info.go index 397dfe3b9..5f03abfb1 100644 --- a/client/system/info.go +++ b/client/system/info.go @@ -6,8 +6,8 @@ import ( "net/netip" "strings" + log "github.com/sirupsen/logrus" "google.golang.org/grpc/metadata" - "gvisor.dev/gvisor/pkg/log" "github.com/netbirdio/netbird/shared/management/proto" )