[freeside-commits] branch master updated. e1157f37c618a7b9cdb2793d61999458076dc51b

Mark Wells mark at 420.am
Tue Dec 10 20:44:11 PST 2013


The branch, master has been updated
       via  e1157f37c618a7b9cdb2793d61999458076dc51b (commit)
       via  7cc8431906315822e8107143920bbca85e5b53ce (commit)
      from  a4c1077430ac3b053c30084dcf76c54be45dca08 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit e1157f37c618a7b9cdb2793d61999458076dc51b
Author: Mark Wells <mark at freeside.biz>
Date:   Tue Dec 10 20:44:06 2013 -0800

    add missing stub method to svc_Common, from #23694?

diff --git a/FS/FS/svc_Common.pm b/FS/FS/svc_Common.pm
index 56567e8..659255e 100644
--- a/FS/FS/svc_Common.pm
+++ b/FS/FS/svc_Common.pm
@@ -336,6 +336,7 @@ sub _check_duplcate { ''; }
 sub preinsert_hook { ''; }
 sub table_dupcheck_fields { (); }
 sub prereplace_hook { ''; }
+sub prereplace_hook_first { ''; }
 sub predelete_hook { ''; }
 sub predelete_hook_first { ''; }
 

commit 7cc8431906315822e8107143920bbca85e5b53ce
Author: Mark Wells <mark at freeside.biz>
Date:   Tue Dec 10 20:44:01 2013 -0800

    actually make auto-assignment avoid forbidden ranges, #25530

diff --git a/FS/FS/addr_block.pm b/FS/FS/addr_block.pm
index 6a62777..1f4000b 100755
--- a/FS/FS/addr_block.pm
+++ b/FS/FS/addr_block.pm
@@ -256,7 +256,17 @@ sub next_free_addr {
   # just do a linear search of the block
   my $freeaddr = $selfaddr->network + 1;
   while ( $freeaddr < $selfaddr->broadcast ) {
-    return $freeaddr unless $used{ $freeaddr->addr };
+    # also make sure it's not blocked from assignment by an address range
+    if ( !$used{$freeaddr->addr } ) {
+      my ($range) = grep { !$_->allow_use }
+                  FS::addr_range->any_contains($freeaddr);
+      if ( !$range ) {
+        # then we've found a free address
+        return $freeaddr;
+      }
+      # otherwise, skip to the end of the range
+      $freeaddr = NetAddr::IP->new($range->end, $self->ip_netmask);
+    }
     $freeaddr++;
   }
   return;
diff --git a/FS/FS/addr_range.pm b/FS/FS/addr_range.pm
index 5faa443..18ae1e2 100644
--- a/FS/FS/addr_range.pm
+++ b/FS/FS/addr_range.pm
@@ -219,11 +219,6 @@ sub desc {
   $status_desc{ $self->status };
 }
 
-sub allow_auto {
-  my $self = shift;
-  $status_allow_auto{ $self->status };
-}
-
 sub allow_use {
   my $self = shift;
   $status_allow_use{ $self->status };
@@ -250,7 +245,7 @@ sub any_contains {
 L<NetAddr::IP> objects have netmasks.  When using them to represent 
 range endpoints, be sure to set the netmask to I<zero> so that math on 
 the address doesn't stop at the subnet boundary.  (The default is /32, 
-which doesn't work very well.  Address ranges ignore subnet boundaries.
+which doesn't work very well.  Address ranges ignore subnet boundaries.)
 
 =head1 BUGS
 

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/addr_block.pm |   12 +++++++++++-
 FS/FS/addr_range.pm |    7 +------
 FS/FS/svc_Common.pm |    1 +
 3 files changed, 13 insertions(+), 7 deletions(-)




More information about the freeside-commits mailing list