Claim IP takes CIDR not IP
This commit is contained in:
1 parent
d2d1d2b43a
commit
eee77d49d1
2 files changed
+4
-4
No files matched your search
+2
-2
@@ -33,8 +33,8 @@ func (client *Client) LookupIP(ID string) (*net.IPNet, error) {
|
||||
}
|
||||
|
||||
// Claim a specific IP on behalf of the ID
|
||||
func (client *Client) ClaimIP(ID string, addr net.IP) error {
|
||||
_, err := client.httpVerb("PUT", fmt.Sprintf("/ip/%s/%s", ID, addr), nil)
|
||||
func (client *Client) ClaimIP(ID string, cidr *net.IPNet) error {
|
||||
_, err := client.httpVerb("PUT", fmt.Sprintf("/ip/%s/%s", ID, cidr), nil)
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
@@ -73,10 +73,10 @@ func (i *ipam) RequestAddress(poolID string, address net.IP, options map[string]
|
||||
return
|
||||
}
|
||||
if address != nil { // try to claim specific address requested
|
||||
if err = i.weave.ClaimIP("_", address); err != nil {
|
||||
ip = &net.IPNet{IP: address, Mask: subnet.Mask}
|
||||
if err = i.weave.ClaimIP("_", ip); err != nil {
|
||||
return
|
||||
}
|
||||
ip = &net.IPNet{IP: address, Mask: subnet.Mask}
|
||||
} else {
|
||||
if _, iprange, err = net.ParseCIDR(parts[2]); err != nil {
|
||||
return
|
||||
|
||||
Reference in new issue
Block a user