summaryrefslogtreecommitdiff
path: root/FS/FS/IP_Mixin.pm
diff options
context:
space:
mode:
Diffstat (limited to 'FS/FS/IP_Mixin.pm')
-rw-r--r--FS/FS/IP_Mixin.pm28
1 files changed, 25 insertions, 3 deletions
diff --git a/FS/FS/IP_Mixin.pm b/FS/FS/IP_Mixin.pm
index 8920ceb..07fa9e7 100644
--- a/FS/FS/IP_Mixin.pm
+++ b/FS/FS/IP_Mixin.pm
@@ -270,9 +270,10 @@ sub router {
=item used_addresses [ BLOCK ]
-Returns a list of all addresses (in BLOCK, or in all blocks)
-that are in use. If called as an instance method, excludes
-that instance from the search.
+Returns a list of all addresses that are in use by a service. If called as an
+instance method, excludes that instance from the search.
+
+Does not filter by block, will return ALL used addresses. ref:f197bdbaa1
=cut
@@ -287,6 +288,27 @@ sub _used_addresses {
die "$class->_used_addresses not implemented";
}
+=item used_addresses_in_block [ FS::addr_block ]
+
+Returns a list of all addresses in use within the given L<FS::addr_block>
+
+=cut
+
+sub used_addresses_in_block {
+ my ($self, $block) = @_;
+
+ (
+ $block->ip_gateway ? $block->ip_gateway : (),
+ $block->NetAddr->broadcast->addr,
+ map { $_->_used_addresses_in_block($block, $self ) } @subclasses
+ );
+}
+
+sub _used_addresses_in_block {
+ my $class = shift;
+ die "$class->_used_addresses_in_block not implemented";
+}
+
=item is_used ADDRESS
Returns a string describing what object is using ADDRESS, or