Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

do not consider /32 address as being a network address

  • Loading branch information...
commit 759ab15213b99c0955bfe264ad0f2729b2bd4886 1 parent 10c9350
Julien Ammous authored
Showing with 6 additions and 1 deletion.
  1. +1 −1  lib/ipaddress/ipv4.rb
  2. +5 −0 test/ipaddress/ipv4_test.rb
View
2  lib/ipaddress/ipv4.rb
@@ -311,7 +311,7 @@ def broadcast
# #=> true
#
def network?
- @u32 | @prefix.to_u32 == @prefix.to_u32
+ (@prefix < 32) && (@u32 | @prefix.to_u32 == @prefix.to_u32)
end
#
View
5 test/ipaddress/ipv4_test.rb
@@ -144,6 +144,11 @@ def test_method_network?
assert_equal true, @network.network?
assert_equal false, @ip.network?
end
+
+ def test_one_address_network
+ network = @klass.new("172.16.10.1/32")
+ assert_equal false, network.network?
+ end
def test_method_broadcast
@broadcast.each do |addr,bcast|
Please sign in to comment.
Something went wrong with that request. Please try again.