Skip to content

Commit

Permalink
Revert "quick bad fix: set ipaddress from global scope addresses only"
Browse files Browse the repository at this point in the history
This reverts commit 83971da.
  • Loading branch information
llaurent committed Apr 13, 2012
1 parent 83971da commit 790a806
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions lib/ohai/plugins/network.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,10 @@
def find_ip_and_mac(addresses, match = nil)
ip = nil; mac = nil; ip6 = nil
addresses.keys.each do |addr|
if addresses[addr]["family"].eql?("inet")
# skip non global scope addresses (if attribute "scope" exists)
next if addresses[addr].has_key? "scope" && addresses[addr]["scope"].downcase != "global"
if match.nil?
ip = addr
else
ip = addr if network_contains_address(match, addr, addresses[addr])
end
if match.nil?
ip = addr if addresses[addr]["family"].eql?("inet")
else
ip = addr if addresses[addr]["family"].eql?("inet") && network_contains_address(match, addr, addresses[addr])
end
ip6 = addr if addresses[addr]["family"].eql?("inet6") && addresses[addr]["scope"].eql?("Global")
mac = addr if addresses[addr]["family"].eql?("lladdr")
Expand Down

0 comments on commit 790a806

Please sign in to comment.