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 network is still incorrect #59

Open
realvitya opened this issue May 7, 2018 · 0 comments
Open

/31 network is still incorrect #59

realvitya opened this issue May 7, 2018 · 0 comments

Comments

@realvitya
Copy link

Cygwin ~ $ ic 1.1.1.1/31
first host: 1.1.1.1/31
last host.: 1.1.1.2

The bug report for this initially:#17 The fix is not correct as seen above.
This may be a fix for the above bug:

def host_first(self):
    if (self.version() == 4 and self.mask > 30) or \
            (self.version() == 6 and self.mask > 126):
         -return self
         +return self.network()
...
def host_last(self):
    """Last available host in this subnet."""
    if (self.version() == 4 and self.mask == 32) or \
    ...
    elif (self.version() == 4 and self.mask == 31) or \
            (self.version() == 6 and self.mask == 127):
        -return IP(int(self) + 1, version=self.version())
        +return IP(int(self.network()) + 1, version=self.version())
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