Project

General

Profile

« Previous | Next » 

Revision d8619496

Added by Bernhard Suttner about 3 years ago

Fixes #32252 - block ip during host creation

Block the IP during host host creation if IPAM internal db or random db is used.

The block ip mechanism is not used for DHCP IPAM because the IP
reservation is done on the smart proxy side.

View differences:

app/services/ipam/db.rb
def suggest_ip
subnet_range.each do |address|
ip = address.to_s
if !excluded_ips.include?(ip) && !subnet.known_ips.include?(ip)
logger.debug("Found #{ip}")
if !excluded_ips.include?(ip) && !subnet.known_ips.include?(ip) && !is_ip_blocked?(ip)
logger.debug("Found IP #{ip}, blocking it for the next #{block_ip_minutes} minutes")
block_ip(ip)
return ip
end
end

Also available in: Unified diff