Skip to content

Commit

Permalink
fix: bug setting IPv4 address
Browse files Browse the repository at this point in the history
  • Loading branch information
mromulus committed Jul 12, 2024
1 parent 070681e commit 0e05e78
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions app/models/address.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,11 @@ def parse_ipv6

def parse_ipv4
return if ipv6?
if @offset_address && @offset_address.blank?
if offset_address && offset_address.blank?
self.offset = nil
else
network_object = ip_family_network

address = IPAddress::IPv4.new("#{@offset_address}/#{network_object.prefix}") rescue nil
address = IPAddress::IPv4.new("#{offset_address}/#{network_object.prefix}") rescue nil
if address && network_object.include?(address)
self.offset = address.u32 - network_object.network_u32 - 1
else
Expand Down

0 comments on commit 0e05e78

Please sign in to comment.