Skip to content

Commit

Permalink
fixed priority calculation
Browse files Browse the repository at this point in the history
ip_address has to be used as ipaddr object to perform the address family check
  • Loading branch information
Martin Lauer committed Nov 9, 2012
1 parent f13e284 commit d50445e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libraries/entry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ def parse(line)
def calculate_priority(ip_address)
return 81 if ip_address == IPAddr.new("127.0.0.1")
return 80 if IPAddr.new("127.0.0.0/8").include?(ip_address) # local
return 60 if ip_address.ipv4? # ipv4
return 20 if ip_address.ipv6? # ipv6
return 60 if IPAddr.new(ip_address, Socket::AF_UNSPEC).ipv4? # ipv4
return 20 if IPAddr.new(ip_address, Socket::AF_UNSPEC).ipv6? # ipv6
return 00 #
end
end
Expand Down

0 comments on commit d50445e

Please sign in to comment.