Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix relay #827

Merged
merged 10 commits into from
Mar 30, 2023
Merged
Prev Previous commit
Next Next commit
Lock the hostmap before copying things from it during tests
  • Loading branch information
brad-defined committed Mar 22, 2023
commit df3e30758bd3db4f5247e6a70ac8857677011602
10 changes: 8 additions & 2 deletions e2e/router/hostmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ func renderHostmap(c *nebula.Control) (string, []*edge) {

// Draw the vpn to index nodes
r += fmt.Sprintf("\t\tsubgraph %s.hosts[\"Hosts (vpn ip to index)\"]\n", clusterName)
for _, vpnIp := range sortedHosts(hm.Hosts) {
hm.RLock()
hosts := sortedHosts(hm.Hosts)
hm.RUnlock()
for _, vpnIp := range hosts {
hi := hm.Hosts[vpnIp]
r += fmt.Sprintf("\t\t\t%v.%v[\"%v\"]\n", clusterName, vpnIp, vpnIp)
lines = append(lines, fmt.Sprintf("%v.%v --> %v.%v", clusterName, vpnIp, clusterName, hi.GetLocalIndex()))
Expand Down Expand Up @@ -94,7 +97,10 @@ func renderHostmap(c *nebula.Control) (string, []*edge) {

// Draw the local index to relay or remote index nodes
r += fmt.Sprintf("\t\tsubgraph indexes.%s[\"Indexes (index to hostinfo)\"]\n", clusterName)
for _, idx := range sortedIndexes(hm.Indexes) {
hm.RLock()
indexes := sortedIndexes(hm.Indexes)
hm.RUnlock()
for _, idx := range indexes {
hi, ok := hm.Indexes[idx]
if ok {
r += fmt.Sprintf("\t\t\t%v.%v[\"%v (%v)\"]\n", clusterName, idx, idx, hi.GetVpnIp())
Expand Down