Module: Ohai::Mixin::NetworkHelper

Defined in:
lib/ohai/mixin/network_helper.rb

Constant Summary collapse

FAMILIES =
{
  "inet" => "default",
  "inet6" => "default_inet6",
}.freeze

Instance Method Summary collapse

Instance Method Details

#hex_to_dec_netmask(netmask) ⇒ Object



28
29
30
31
32
33
# File 'lib/ohai/mixin/network_helper.rb', line 28

def hex_to_dec_netmask(netmask)
  # example 'ffff0000' -> '255.255.0.0'
  dec = netmask[0..1].to_i(16).to_s(10)
  [2, 4, 6].each { |n| dec = dec + "." + netmask[n..n + 1].to_i(16).to_s(10) }
  dec
end