Tighten error checking

This commit is contained in:
Bryan Boreham committed 2015-06-10 17:21:16 +01:00
1 parent 50eaccc60c
commit ecbd514a83
2 files changed
+9 -2

No files matched your search

+4 -1
View File
@@ -182,7 +182,10 @@ func (alloc *Allocator) SetDefaultSubnet(subnet address.CIDR) error {
return fmt.Errorf("Allocation range smaller than minimum size 4: %s", subnet)
}
alloc.actionChan <- func() {
// todo: check default subnet is in range
if !alloc.universe.Overlaps(subnet) {
resultChan <- fmt.Errorf("Default subnet %s out of bounds: %s", subnet, alloc.universe)
return
}
alloc.defaultSubnet = subnet
resultChan <- nil
}