Bug #23523 » smart-proxy-patch-dhcp-free-ips.diff
modules/dhcp_common/free_ips.rb | ||
---|---|---|
require 'logger'
|
||
require 'set'
|
||
require 'dhcp_common/pingable'
|
||
require 'resolv'
|
||
module Proxy::DHCP
|
||
class FreeIps
|
||
... | ... | |
if tcp_pingable?(possible_ip) || icmp_pingable?(possible_ip)
|
||
logger.debug "Found a pingable IP(#{possible_ip}) address which does not have a Proxy::DHCP record."
|
||
else
|
||
logger.debug "Found free IP #{possible_ip} out of a total of #{num_of_addresses} free IPs."
|
||
return possible_ip
|
||
begin
|
||
name = Resolv.getname(possible_ip)
|
||
logger.debug "Found DNS record #{name} on IP(#{possible_ip}) address, this addresse seems to be used"
|
||
rescue Exception => e
|
||
logger.debug "Found free IP #{possible_ip} out of a total of #{num_of_addresses} free IPs."
|
||
return possible_ip
|
||
end
|
||
end
|
||
rescue Exception => e
|
||
logger.error("Exception when pinging #{possible_ip}. Skipping the address.", e)
|