diff --git a/control/controlclient/netmap.go b/control/controlclient/netmap.go index 1d8dcca93..dd381a9df 100644 --- a/control/controlclient/netmap.go +++ b/control/controlclient/netmap.go @@ -75,6 +75,15 @@ func (nm *NetworkMap) Concise() string { func (nm *NetworkMap) printConciseHeader(buf *strings.Builder) { fmt.Fprintf(buf, "netmap: self: %v auth=%v", nm.NodeKey.ShortString(), nm.MachineStatus) + login := nm.UserProfiles[nm.User].LoginName + if login == "" { + if nm.User.IsZero() { + login = "?" + } else { + login = fmt.Sprint(nm.User) + } + } + fmt.Fprintf(buf, " u=%s", login) if nm.LocalPort != 0 { fmt.Fprintf(buf, " port=%v", nm.LocalPort) } @@ -92,6 +101,7 @@ func (a *NetworkMap) equalConciseHeader(b *NetworkMap) bool { if a.NodeKey != b.NodeKey || a.MachineStatus != b.MachineStatus || a.LocalPort != b.LocalPort || + a.User != b.User || len(a.Addresses) != len(b.Addresses) { return false } diff --git a/control/controlclient/netmap_test.go b/control/controlclient/netmap_test.go index 6a386589a..909a787f1 100644 --- a/control/controlclient/netmap_test.go +++ b/control/controlclient/netmap_test.go @@ -51,7 +51,7 @@ func TestNetworkMapConcise(t *testing.T) { }, }, }, - want: "netmap: self: [AQEBA] auth=machine-unknown []\n [AgICA] D2 : 192.168.0.100:12 192.168.0.100:12354\n [AwMDA] D4 : 10.2.0.100:12 10.1.0.100:12345\n", + want: "netmap: self: [AQEBA] auth=machine-unknown u=? []\n [AgICA] D2 : 192.168.0.100:12 192.168.0.100:12354\n [AwMDA] D4 : 10.2.0.100:12 10.1.0.100:12345\n", }, { name: "debug_non_nil", @@ -59,7 +59,7 @@ func TestNetworkMapConcise(t *testing.T) { NodeKey: testNodeKey(1), Debug: &tailcfg.Debug{}, }, - want: "netmap: self: [AQEBA] auth=machine-unknown debug={} []\n", + want: "netmap: self: [AQEBA] auth=machine-unknown u=? debug={} []\n", }, { name: "debug_values", @@ -67,7 +67,7 @@ func TestNetworkMapConcise(t *testing.T) { NodeKey: testNodeKey(1), Debug: &tailcfg.Debug{LogHeapPprof: true}, }, - want: "netmap: self: [AQEBA] auth=machine-unknown debug={\"LogHeapPprof\":true} []\n", + want: "netmap: self: [AQEBA] auth=machine-unknown u=? debug={\"LogHeapPprof\":true} []\n", }, } { t.Run(tt.name, func(t *testing.T) { @@ -135,7 +135,7 @@ func TestConciseDiffFrom(t *testing.T) { }, }, }, - want: "-netmap: self: [AQEBA] auth=machine-unknown []\n+netmap: self: [AgICA] auth=machine-unknown []\n", + want: "-netmap: self: [AQEBA] auth=machine-unknown u=? []\n+netmap: self: [AgICA] auth=machine-unknown u=? []\n", }, { name: "peer_add",