excludeaddr option for svc_broadband
authorkhoff <khoff>
Mon, 21 Apr 2003 20:27:10 +0000 (20:27 +0000)
committerkhoff <khoff>
Mon, 21 Apr 2003 20:27:10 +0000 (20:27 +0000)
FS/FS/Conf.pm
FS/FS/addr_block.pm

index b00e782..cb404ff 100644 (file)
@@ -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\'',
index b671723..c9305f6 100755 (executable)
@@ -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) {