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 5c26a49 commit c034366
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 @@ -158,7 +158,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 @@ -167,6 +167,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 @@ -211,7 +213,7 @@ func (ns *noiseServer) NoisePollNetMapHandler(
Msg("PollNetMapHandler called")

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

Expand Down Expand Up @@ -270,7 +272,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 c034366

Please sign in to comment.