Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
ipam: Do not deref nil in GET /ipinfo/tracker if tracker doesn't exist
Browse files Browse the repository at this point in the history
In some cases, we do not create any IPAM tracker, which leads
to a panic when GET'ing /ipinfo/tracker.
  • Loading branch information
brb committed Sep 21, 2018
1 parent 1fcd521 commit 75f6cfc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ipam/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ func (alloc *Allocator) HandleHTTP(router *mux.Router, defaultSubnet address.CID
})

router.Methods("GET").Path("/ipinfo/tracker").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, alloc.tracker.String())
tracker := ""
if alloc.tracker != nil {
alloc.tracker.String()
}
fmt.Fprintf(w, tracker)
})
}

0 comments on commit 75f6cfc

Please sign in to comment.