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;
+use FS::router;
+use FS::part_svc_router;
=item addr_block
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 {
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'} = $self->addr_block->ip_gateway
+ if FS::Conf->new->exists('radius-canopy') && $self->addr_block;
+
%reply;
}