Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit36f3151

Browse files
authored
fix(enterprise/tailnet): properly detect legacy agents (#10083)
1 parent03a7d2f commit36f3151

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

‎enterprise/tailnet/pgcoord.go

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"fmt"
88
"net"
99
"net/http"
10+
"net/netip"
1011
"strings"
1112
"sync"
1213
"time"
@@ -143,10 +144,27 @@ func NewPGCoord(ctx context.Context, logger slog.Logger, ps pubsub.Pubsub, store
143144
returnc,nil
144145
}
145146

147+
// This is copied from codersdk because importing it here would cause an import
148+
// cycle. This is just temporary until wsconncache is phased out.
149+
varlegacyAgentIP=netip.MustParseAddr("fd7a:115c:a1e0:49d6:b259:b7ac:b1b2:48f4")
150+
146151
func (c*pgCoord)ServeMultiAgent(id uuid.UUID) agpl.MultiAgentConn {
147152
ma:= (&agpl.MultiAgent{
148-
ID:id,
149-
AgentIsLegacyFunc:func(agentID uuid.UUID)bool {returntrue },
153+
ID:id,
154+
AgentIsLegacyFunc:func(agentID uuid.UUID)bool {
155+
ifn:=c.Node(agentID);n==nil {
156+
// If we don't have the node at all assume it's legacy for
157+
// safety.
158+
returntrue
159+
}elseiflen(n.Addresses)>0&&n.Addresses[0].Addr()==legacyAgentIP {
160+
// An agent is determined to be "legacy" if it's first IP is the
161+
// legacy IP. Agents with only the legacy IP aren't compatible
162+
// with single_tailnet and must be routed through wsconncache.
163+
returntrue
164+
}else {
165+
returnfalse
166+
}
167+
},
150168
OnSubscribe:func(enq agpl.Queue,agent uuid.UUID) (*agpl.Node,error) {
151169
err:=c.addSubscription(enq,agent)
152170
returnc.Node(agent),err

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp