Skip to content

Commit bf83549

Browse files
committed
Merge branch 'main' into feature/detect-mac-wakeup
2 parents 804a387 + 6654e2d commit bf83549

File tree

3 files changed

+26
-5
lines changed

3 files changed

+26
-5
lines changed

client/cmd/debug.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,14 @@ func getStatusOutput(cmd *cobra.Command, anon bool) string {
307307
if err != nil {
308308
cmd.PrintErrf("Failed to get status: %v\n", err)
309309
} else {
310+
pm := profilemanager.NewProfileManager()
311+
var profName string
312+
if activeProf, err := pm.GetActiveProfile(); err == nil {
313+
profName = activeProf.Name
314+
}
315+
310316
statusOutputString = nbstatus.ParseToFullDetailSummary(
311-
nbstatus.ConvertToStatusOutputOverview(statusResp, anon, "", nil, nil, nil, "", ""),
317+
nbstatus.ConvertToStatusOutputOverview(statusResp, anon, "", nil, nil, nil, "", profName),
312318
)
313319
}
314320
return statusOutputString

client/internal/debug/debug.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ nftables.txt: Anonymized nftables rules with packet counters, if --system-info f
4747
resolved_domains.txt: Anonymized resolved domain IP addresses from the status recorder.
4848
config.txt: Anonymized configuration information of the NetBird client.
4949
network_map.json: Anonymized sync response containing peer configurations, routes, DNS settings, and firewall rules.
50-
state.json: Anonymized client state dump containing netbird states.
50+
state.json: Anonymized client state dump containing netbird states for the active profile.
5151
mutex.prof: Mutex profiling information.
5252
goroutine.prof: Goroutine profiling information.
5353
block.prof: Block profiling information.
@@ -564,6 +564,8 @@ func (g *BundleGenerator) addStateFile() error {
564564
return nil
565565
}
566566

567+
log.Debugf("Adding state file from: %s", path)
568+
567569
data, err := os.ReadFile(path)
568570
if err != nil {
569571
if errors.Is(err, fs.ErrNotExist) {

client/ui/debug.go

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"github.com/skratchdot/open-golang/open"
1919

2020
"github.com/netbirdio/netbird/client/internal"
21+
"github.com/netbirdio/netbird/client/internal/profilemanager"
2122
"github.com/netbirdio/netbird/client/proto"
2223
nbstatus "github.com/netbirdio/netbird/client/status"
2324
uptypes "github.com/netbirdio/netbird/upload-server/types"
@@ -426,14 +427,20 @@ func (s *serviceClient) collectDebugData(
426427
return "", err
427428
}
428429

430+
pm := profilemanager.NewProfileManager()
431+
var profName string
432+
if activeProf, err := pm.GetActiveProfile(); err == nil {
433+
profName = activeProf.Name
434+
}
435+
429436
postUpStatus, err := conn.Status(s.ctx, &proto.StatusRequest{GetFullPeerStatus: true})
430437
if err != nil {
431438
log.Warnf("Failed to get post-up status: %v", err)
432439
}
433440

434441
var postUpStatusOutput string
435442
if postUpStatus != nil {
436-
overview := nbstatus.ConvertToStatusOutputOverview(postUpStatus, params.anonymize, "", nil, nil, nil, "", "")
443+
overview := nbstatus.ConvertToStatusOutputOverview(postUpStatus, params.anonymize, "", nil, nil, nil, "", profName)
437444
postUpStatusOutput = nbstatus.ParseToFullDetailSummary(overview)
438445
}
439446
headerPostUp := fmt.Sprintf("----- NetBird post-up - Timestamp: %s", time.Now().Format(time.RFC3339))
@@ -450,7 +457,7 @@ func (s *serviceClient) collectDebugData(
450457

451458
var preDownStatusOutput string
452459
if preDownStatus != nil {
453-
overview := nbstatus.ConvertToStatusOutputOverview(preDownStatus, params.anonymize, "", nil, nil, nil, "", "")
460+
overview := nbstatus.ConvertToStatusOutputOverview(preDownStatus, params.anonymize, "", nil, nil, nil, "", profName)
454461
preDownStatusOutput = nbstatus.ParseToFullDetailSummary(overview)
455462
}
456463
headerPreDown := fmt.Sprintf("----- NetBird pre-down - Timestamp: %s - Duration: %s",
@@ -574,14 +581,20 @@ func (s *serviceClient) createDebugBundle(anonymize bool, systemInfo bool, uploa
574581
return nil, fmt.Errorf("get client: %v", err)
575582
}
576583

584+
pm := profilemanager.NewProfileManager()
585+
var profName string
586+
if activeProf, err := pm.GetActiveProfile(); err == nil {
587+
profName = activeProf.Name
588+
}
589+
577590
statusResp, err := conn.Status(s.ctx, &proto.StatusRequest{GetFullPeerStatus: true})
578591
if err != nil {
579592
log.Warnf("failed to get status for debug bundle: %v", err)
580593
}
581594

582595
var statusOutput string
583596
if statusResp != nil {
584-
overview := nbstatus.ConvertToStatusOutputOverview(statusResp, anonymize, "", nil, nil, nil, "", "")
597+
overview := nbstatus.ConvertToStatusOutputOverview(statusResp, anonymize, "", nil, nil, nil, "", profName)
585598
statusOutput = nbstatus.ParseToFullDetailSummary(overview)
586599
}
587600

0 commit comments

Comments
 (0)