X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fsvc_IP_Mixin.pm;h=c0f202e6d5469145ebb6368e0b45d2253200137b;hp=ff7c2f5d47576f898e1f6d26091270adbeaa2850;hb=7109ab0b7108ee365fbc958eaaf9e473f2332c08;hpb=00de593a7e5b5b50aeec62c0ddb90db7bcd62f55 diff --git a/FS/FS/svc_IP_Mixin.pm b/FS/FS/svc_IP_Mixin.pm index ff7c2f5d4..c0f202e6d 100644 --- a/FS/FS/svc_IP_Mixin.pm +++ b/FS/FS/svc_IP_Mixin.pm @@ -1,9 +1,10 @@ package FS::svc_IP_Mixin; +use base 'FS::IP_Mixin'; use strict; -use base 'FS::IP_Mixin'; -use FS::Record qw(qsearchs qsearch); use NEXT; +use FS::Record qw(qsearchs qsearch); +use FS::Conf; =item addr_block @@ -96,7 +97,12 @@ sub _used_addresses { my %hash = ( $ip_field => { op => '!=', value => '' } ); #$hash{'blocknum'} = $block->blocknum if $block; $hash{'svcnum'} = { op => '!=', value => $exclude->svcnum } if ref $exclude; - map { $_->NetAddr->addr } qsearch($class->table, \%hash); + map { my $na = $_->NetAddr; $na ? $na->addr : () } + qsearch({ + table => $class->table, + hashref => \%hash, + extra_sql => " AND $ip_field != '0e0'", + }); } sub _is_used { @@ -178,16 +184,18 @@ means "Framed-Route" if there's an attached router. sub radius_reply { my $self = shift; - my %reply; - my ($block) = $self->attached_block; - if ( $block ) { + my %reply = (); + if ( my $block = $self->attached_block ) { # block routed over dynamic IP: "192.168.100.0/29 0.0.0.0 1" # or # block routed over fixed IP: "192.168.100.0/29 192.168.100.1 1" # (the "1" at the end is the route metric) - $reply{'Framed-Route'} = - $block->cidr . ' ' . - ($self->ip_addr || '0.0.0.0') . ' 1'; + $reply{'Framed-Route'} = $block->cidr . ' ' . + ($self->ip_addr || '0.0.0.0') . ' 1'; + + $reply{'Motorola-Canopy-Gateway'} = $block->ip_gateway + if FS::Conf->new->exists('radius-canopy'); + } %reply; }