From d50445e59a8f6bb6d33524cd7d1b6076570f6662 Mon Sep 17 00:00:00 2001 From: Martin Lauer Date: Fri, 9 Nov 2012 14:35:48 +0100 Subject: [PATCH] fixed priority calculation ip_address has to be used as ipaddr object to perform the address family check --- libraries/entry.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/entry.rb b/libraries/entry.rb index 1a952ae6..4aee0a3f 100644 --- a/libraries/entry.rb +++ b/libraries/entry.rb @@ -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