Skip to content

Commit 79aeeca

Browse files
committed
Fixed wrong value returned by cidr_to_ipv6 function
1 parent 7c80852 commit 79aeeca

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8.7.1
1+
8.7.2

ip2location_ruby.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Gem::Specification.new do |s|
22
s.name = "ip2location_ruby"
3-
s.version = "8.7.1"
3+
s.version = "8.7.2"
44

55
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
66
s.require_paths = ["lib"]

lib/ip2location_ruby.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
class Ip2location
1515
attr_accessor :record_class4, :record_class6, :v4, :file, :db_index, :count, :base_addr, :ipno, :count, :record, :database, :columns, :ip_version, :ipv4databasecount, :ipv4databaseaddr, :ipv4indexbaseaddr, :ipv6databasecount, :ipv6databaseaddr, :ipv6indexbaseaddr, :databaseyear, :databasemonth, :databaseday, :last_err_msg
1616

17-
VERSION = '8.7.1'
17+
VERSION = '8.7.2'
1818
FIELD_NOT_SUPPORTED = 'NOT SUPPORTED'
1919
INVALID_IP_ADDRESS = 'INVALID IP ADDRESS'
2020
INVALID_BIN_DATABASE = 'Incorrect IP2Location BIN file format. Please make sure that you are using the latest IP2Location BIN file.'
@@ -988,7 +988,7 @@ def ipv6_to_cidr(ipfrom_ori, ipto)
988988

989989
def cidr_to_ipv6(cidr)
990990
if cidr.include? "/"
991-
ip_start = IPAddr.new(cidr.to_s.split('/').first).to_i.to_s(16).scan(/.{4}/)
991+
ip_start = IPAddr.new(cidr).to_i.to_s(16).scan(/.{4}/)
992992
ip_start = ip_start[0] + ':' + ip_start[1] + ':' + ip_start[2] + ':' + ip_start[3] + ':' + ip_start[4] + ':' + ip_start[5] + ':' + ip_start[6] + ':' + ip_start[7]
993993

994994
cidr_new = IPAddr.new(cidr)

0 commit comments

Comments
 (0)