[freeside-commits] branch FREESIDE_3_BRANCH updated. 127ab8d0e20b681bac78e13f797c9b0f9b32dbd8

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


The branch, FREESIDE_3_BRANCH has been updated
       via  127ab8d0e20b681bac78e13f797c9b0f9b32dbd8 (commit)
       via  cf176d7745fa93c96c44f2802d02576e36e4bf98 (commit)
      from  2252d7014095b4bc4f8c84424dde5664f8723a70 (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 127ab8d0e20b681bac78e13f797c9b0f9b32dbd8
Author: Mark Wells <mark at freeside.biz>
Date:   Tue Dec 10 20:43:50 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 cf176d7745fa93c96c44f2802d02576e36e4bf98
Author: Mark Wells <mark at freeside.biz>
Date:   Tue Dec 10 20:42:58 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