Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/31 prefix: hosts, network and broadcast #143

Open
PJO2 opened this issue Nov 30, 2023 · 0 comments
Open

/31 prefix: hosts, network and broadcast #143

PJO2 opened this issue Nov 30, 2023 · 0 comments

Comments

@PJO2
Copy link

PJO2 commented Nov 30, 2023

Hello,

in the gem code, a /31 network has a network address, a broadcast address and has no host address.
For instance the 1.2.3.4/31 subnet will return 1.2.3.4 as network add, 1.2.3.5 as broadcast and each_host returns immediatly.

My understanding of the RFC 3021 about /31 prefixes is the contrary :
no network, no broadcast and 2 hosts available.

Tested with the following code:
require 'ipaddress' net=IPAddress "1.2.3.4/31" puts "network:", net.network puts "hosts:" net.each_host { |host| puts host } puts "broadcast:", net.broadcast

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant