tehmaze/ipcalc

dealing with 31-bit subnet masks(with suggested code attached)

Closed this issue · 1 comments

RFC 3021 specifies an exception to this rule when dealing with 31-bit subnet masks (i.e. 1-bit host identifiers). In such networks, usually point-to-point links, only two hosts (the end points) may be connected and a specification of network and broadcast addresses is not necessary.

suggested addition to host first:
def host_first(self):
if (self.version() == 4 and self.mask == 31) or (self.version() == 6 and self.mask == 127):
return self.network()

suggested addition to host last:
def host_last(self):
if (self.version() == 4 and self.mask == 31) or (self.version() == 6 and self.mask == 127):
return self.broadcast()

has been fixed by 9395373