add skip_dcontext_suffix to skip CDRs with dcontext ending in a definable string...
[freeside.git] / FS / FS / svc_IP_Mixin.pm
index c0f202e..8b2b5f1 100644 (file)
@@ -5,6 +5,8 @@ use strict;
 use NEXT;
 use FS::Record qw(qsearchs qsearch);
 use FS::Conf;
+use FS::router;
+use FS::part_svc_router;
 
 =item addr_block
 
@@ -184,7 +186,9 @@ means "Framed-Route" if there's an attached router.
 
 sub radius_reply {
   my $self = shift;
+
   my %reply = ();
+
   if ( my $block = $self->attached_block ) {
     # block routed over dynamic IP: "192.168.100.0/29 0.0.0.0 1"
     # or
@@ -192,11 +196,11 @@ sub radius_reply {
     # (the "1" at the end is the route metric)
     $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{'Motorola-Canopy-Gateway'} = $self->addr_block->ip_gateway
+    if FS::Conf->new->exists('radius-canopy') && $self->addr_block;
+
   %reply;
 }