$self->ip_addr('');
}
+ # Will strip extraneous leading zeros from ip adddresses
+ # e.g. 10.0.022.220 corrected to 10.0.22.220
+ $self->ut_ip46n('ip_addr');
+
if ( $self->ip_addr
and !$self->router
and $self->conf->exists('auto_router') ) {
my $self = shift;
my %opt = @_;
+ #otherwise we'll get the same assignment for concurrent identical calls
+ # this will serialize them
+ $_->lock_table foreach @subclasses;
+
my @blocks;
my $na = $self->NetAddr;
FS::router->by_key($self->routernum);
}
-=item used_addresses [ BLOCK ]
+=item used_addresses [ FS::addr_block ]
+
+Returns a list of all addresses in use within the given L<FS::addr_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.
+If called as an instance method, excludes that instance from the search.
=cut
sub used_addresses {
- my $self = shift;
- my $block = shift;
- return ( map { $_->_used_addresses($block, $self) } @subclasses );
+ my ($self, $block) = @_;
+
+ (
+ $block->ip_gateway ? $block->ip_gateway : (),
+ $block->NetAddr->broadcast->addr,
+ map { $_->_used_addresses($block, $self ) } @subclasses
+ );
}
sub _used_addresses {