Skip to content

Commit 353b5b4

Browse files
author
David Groves
committed
Added None as return value for IPv6Network /127 and /128
1 parent 0caa433 commit 353b5b4

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Doc/library/ipaddress.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,8 @@ dictionaries.
780780
.. attribute:: subnet_router_anycast_address
781781

782782
The Subnet-Router anycast address for the network, which is the first address
783-
in the network.
783+
in the network or None if the network is a /127 or /128, which do not have
784+
a subnet router, as defined in IETF RFC 6164, section 8.
784785

785786
.. versionadded:: next
786787

Lib/ipaddress.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2370,6 +2370,8 @@ def is_site_local(self):
23702370

23712371
@functools.cached_property
23722372
def subnet_router_anycast_address(self):
2373+
if self._prefixlen == 127 or self._prefixlen == 128:
2374+
return None
23732375
return self.first_address
23742376

23752377
@functools.cached_property

0 commit comments

Comments
 (0)