From 4eaa305a53b129021c3a40e9ed49196f4b4d8907 Mon Sep 17 00:00:00 2001 From: khoff Date: Mon, 21 Apr 2003 20:27:10 +0000 Subject: [PATCH] excludeaddr option for svc_broadband --- FS/FS/Conf.pm | 7 +++++++ FS/FS/addr_block.pm | 10 ++++++++-- 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) { -- 2.11.0