Skip to content

Commit

Permalink
fix: return distinct error when not able to allocate interface index
Browse files Browse the repository at this point in the history
  • Loading branch information
tinyzimmer committed Nov 7, 2023
1 parent 3ccaae1 commit 25161cb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/cmd/daemoncmd/connmgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ import (
var (
// ErrNoPortsAvailable is returned when no ports are available.
ErrNoPortsAvailable = status.Errorf(codes.FailedPrecondition, "no ports available")
// ErrNoIndexAvailable is returned when no utun index is available.
ErrNoIndexAvailable = status.Errorf(codes.FailedPrecondition, "no utun index available")
// ErrNotConnected is returned when the node is not connected to the mesh.
ErrNotConnected = status.Errorf(codes.FailedPrecondition, "not connected to the specified network")
// ErrAlreadyConnected is returned when the node is already connected to the mesh.
Expand Down Expand Up @@ -336,7 +338,7 @@ func (m *ConnManager) assignUTUNIndex(connID string) (uint16, error) {
}
index++
if index > maxIndex {
return 0, ErrNoPortsAvailable
return 0, ErrNoIndexAvailable
}
}
}
Expand Down

0 comments on commit 25161cb

Please sign in to comment.