summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkhoff <khoff>2003-04-21 20:27:10 +0000
committerkhoff <khoff>2003-04-21 20:27:10 +0000
commit4eaa305a53b129021c3a40e9ed49196f4b4d8907 (patch)
tree676760578976aaf8b8cb75f423a2f25407b104e0
parentfdccb39f148b8fb2a8a7818e9a7999c20b2e05bd (diff)
excludeaddr option for svc_broadband
-rw-r--r--FS/FS/Conf.pm7
-rwxr-xr-xFS/FS/addr_block.pm10
2 files changed, 15 insertions, 2 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index b00e78255..cb404ff03 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -374,6 +374,13 @@ httemplate/docs/config.html
},
{
+ 'key' => 'excludeaddr',
+ 'section' => 'deprecated',
+ 'description' => 'Addresses to exclude from assignment, one per line.',
+ 'type' => 'textarea',
+ },
+
+ {
'key' => 'erpcdmachines',
'section' => '',
'description' => 'Your ERPCD authenticaion machines, one per line. This enables export of `/usr/annex/acp_passwd\' and `/usr/annex/acp_dialup\'',
diff --git a/FS/FS/addr_block.pm b/FS/FS/addr_block.pm
index b671723aa..c9305f6af 100755
--- a/FS/FS/addr_block.pm
+++ b/FS/FS/addr_block.pm
@@ -5,6 +5,7 @@ use vars qw( @ISA );
use FS::Record qw( qsearchs qsearch dbh );
use FS::router;
use FS::svc_broadband;
+use FS::Conf;
use NetAddr::IP;
@ISA = qw( FS::Record );
@@ -172,9 +173,14 @@ there are no free addresses, returns false.
sub next_free_addr {
my $self = shift;
- my @used = map { $_->NetAddr->addr }
+ my $conf = new FS::Conf;
+ my @excludeaddr = $conf->config('excludeaddr');
+
+ my @used = (
+ map { $_->NetAddr->addr }
($self,
- qsearch('svc_broadband', { blocknum => $self->blocknum }) );
+ qsearch('svc_broadband', { blocknum => $self->blocknum }) ),
+ @excludeaddr );
my @free = $self->NetAddr->hostenum;
while (my $ip = shift @free) {