hscontrol: send the logtail instruction on the expired-self frame

It opens a deleted node's stream in place of the initial map.
This commit is contained in:
Kristoffer Dalby authored and Kristoffer Dalby committed 2026-10-07 13:25:44 +00:00
1 parent cced8a0aba
commit 01db1dec88
2 files changed
+18 -2

No files matched your search

+2
View File
@@ -742,6 +742,8 @@ func (ns *noiseServer) PollNetMapHandler(
KeyExpiry: time.Unix(1, 0).UTC(), KeyExpiry: time.Unix(1, 0).UTC(),
Expired: true, Expired: true,
}, },
// This frame opens the stream in place of the initial map.
Debug: ns.headscale.cfg.TailcfgDebug(),
} }
err = writeMapResponse(writer, mapRequest.Compress, true, expired) err = writeMapResponse(writer, mapRequest.Compress, true, expired)
+16 -2
View File
@@ -1158,11 +1158,22 @@ func decodeMapResponse(t *testing.T, compress string, body []byte) tailcfg.MapRe
func TestPollNetMapHandler_DeletedNodeGetsExpiredSelf(t *testing.T) { func TestPollNetMapHandler_DeletedNodeGetsExpiredSelf(t *testing.T) {
t.Parallel() t.Parallel()
for _, compress := range []string{"", util.ZstdCompression} { for _, tc := range []struct {
t.Run("compress="+compress, func(t *testing.T) { compress string
logTail bool
wantDebug *tailcfg.Debug
}{
{"", false, &tailcfg.Debug{DisableLogTail: true}},
{util.ZstdCompression, false, &tailcfg.Debug{DisableLogTail: true}},
{"", true, nil},
{util.ZstdCompression, true, nil},
} {
compress := tc.compress
t.Run(fmt.Sprintf("compress=%s/logtail=%t", compress, tc.logTail), func(t *testing.T) {
t.Parallel() t.Parallel()
app := createTestApp(t) app := createTestApp(t)
app.cfg.LogTail.Enabled = tc.logTail
user := app.state.CreateUserForTest("deleted-node-user") user := app.state.CreateUserForTest("deleted-node-user")
node := putTestNodeInStore(t, app, user, "deleted-node") node := putTestNodeInStore(t, app, user, "deleted-node")
@@ -1190,6 +1201,9 @@ func TestPollNetMapHandler_DeletedNodeGetsExpiredSelf(t *testing.T) {
assert.Equal(t, time.Unix(1, 0).UTC(), resp.Node.KeyExpiry, assert.Equal(t, time.Unix(1, 0).UTC(), resp.Node.KeyExpiry,
"a fixed ancient KeyExpiry must remain expired despite client clock skew") "a fixed ancient KeyExpiry must remain expired despite client clock skew")
assert.True(t, resp.Node.Expired) assert.True(t, resp.Node.Expired)
// This frame starts the stream, so it must carry the logtail
// instruction the initial map would have.
assert.Equal(t, tc.wantDebug, resp.Debug)
}) })
} }
} }