# File lib/ohai/plugins/windows/network.rb, line 28 def derive_bcast(ipaddr, ipmask, zero_bcast = false) begin ipaddr_int = ipaddr.split(".").collect{ |x| x.to_i}.pack("C4").unpack("N").first ipmask_int = ipmask.split(".").collect{ |x| x.to_i}.pack("C4").unpack("N").first if zero_bcast bcast_int = ipaddr_int & ipmask_int else bcast_int = ipaddr_int | 2 ** 32 - ipmask_int - 1 end bcast = [bcast_int].pack("N").unpack("C4").join(".") return bcast rescue return nil end end