Skip to content

Commit

Permalink
patch through m and n key
Browse files Browse the repository at this point in the history
Signed-off-by: Kristoffer Dalby <[email protected]>
  • Loading branch information
kradalby committed Jan 30, 2025
1 parent 655ba66 commit 3656a8b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions hscontrol/noise.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func isSupportedVersion(version tailcfg.CapabilityVersion) bool {
return version >= MinimumCapVersion
}

func rejectUnsupported(writer http.ResponseWriter, version tailcfg.CapabilityVersion) bool {
func rejectUnsupported(writer http.ResponseWriter, version tailcfg.CapabilityVersion, mkey key.MachinePublic, nkey key.NodePublic) bool {
// Reject unsupported versions
if !isSupportedVersion(version) {
log.Error().
Expand All @@ -165,6 +165,8 @@ func rejectUnsupported(writer http.ResponseWriter, version tailcfg.CapabilityVer
Int("client_cap_ver", int(version)).
Str("minimum_version", capver.TailscaleVersion(MinimumCapVersion)).
Str("client_version", capver.TailscaleVersion(version)).
Str("node_key", nkey.ShortString()).
Str("machine_key", mkey.ShortString()).
Msg("unsupported client connected")
http.Error(writer, "unsupported client version", http.StatusBadRequest)

Expand Down Expand Up @@ -196,7 +198,7 @@ func (ns *noiseServer) NoisePollNetMapHandler(
}

// Reject unsupported versions
if rejectUnsupported(writer, mapRequest.Version) {
if rejectUnsupported(writer, mapRequest.Version, ns.machineKey, mapRequest.NodeKey) {
return
}

Expand Down Expand Up @@ -241,7 +243,7 @@ func (ns *noiseServer) NoiseRegistrationHandler(
}

// Reject unsupported versions
if rejectUnsupported(writer, registerRequest.Version) {
if rejectUnsupported(writer, registerRequest.Version, ns.machineKey, registerRequest.NodeKey) {
return
}

Expand Down

0 comments on commit 3656a8b

Please sign in to comment.