Check that peers are registered when fetching them

Fix from https://github.com/awsong/headscale
This commit is contained in:
Juan Font Alonso 2021-02-21 21:03:25 +01:00
parent b0b9e3a9af
commit acb645aa9d

View File

@ -107,7 +107,7 @@ func (h *Headscale) getPeers(m Machine) (*[]*tailcfg.Node, error) {
// Add user management here?
machines := []Machine{}
if err = db.Where("machine_key <> ?", m.MachineKey).Find(&machines).Error; err != nil {
if err = db.Where("machine_key <> ? AND registered", m.MachineKey).Find(&machines).Error; err != nil {
log.Printf("Error accessing db: %s", err)
return nil, err
}