Wondering if this is the best way to stop RTIR from detecting CIDR ranges

I’m wondering if this is the best way to stop RTIR from detecting CIDR
ranges. I’ve been looking
into /opt/rt4/local/plugins/RT-IR/lib/RT/Action/RTIR_FindIP.pm and modified
the following section:

    elsif ( $4 && defined $5 ) { # IPv4/mask
  •        next;  # Do not add IPv4 ranges to tickets*
          my $cidr = join( '.', map $_||0, (split /\./, $4)[0..3] )
    

."/$5";
my $range = (Net::CIDR::cidr2range( $cidr ))[0] or next;
$spots_left -= $self->AddIP(
IP => $range, CustomField => $cf, Skip => %existing
);
}

Is this the best way? Or is there something else I should have done
instead?

Landon Stewart LandonStewart@Gmail.com

I’m wondering if this is the best way to stop RTIR from detecting CIDR ranges. I’ve been
looking into /opt/rt4/local/plugins/RT-IR/lib/RT/Action/RTIR_FindIP.pm and modified the
following section:
elsif ( $4 && defined $5 ) { # IPv4/mask
next; # Do not add IPv4 ranges to tickets
my $cidr = join( ‘.’, map $_||0, (split /./, $4)[0…3] ) ."/$5";
my $range = (Net::CIDR::cidr2range( $cidr ))[0] or next;
$spots_left -= $self->AddIP(
IP => $range, CustomField => $cf, Skip => %existing
);
}
Is this the best way? Or is there something else I should have done instead?

It’s almost impossible for me to parse your changes since the
whitespace has been completely lost.

Can you instead post a unified diff (diff -u) of your change?

Also, if you’re going to change RT/extension code, you should be using
local/lib instead of hacking in place. Otherwise upgrading will be…
fun.

-kevin

Thanks for your reply. The only thing I added was the ‘next; # Do not add
IPv4 ranges to tickets’ line.

— /opt/rt4/local/plugins/RT-IR/lib/RT/Action/RTIR_FindIP.pm.ORIG 2013-05-24
15:31:09.356845837 -0400
+++ /opt/rt4/local/plugins/RT-IR/lib/RT/Action/RTIR_FindIP.pm 2013-05-28
17:00:25.764303577 -0400
@@ -87,6 +87,7 @@
);
}
elsif ( $4 && defined $5 ) { # IPv4/mask

  •        next; # Do not add IPv4 ranges to tickets
           my $cidr = join( '.', map $_||0, (split /\./, $4)[0..3] )
    

."/$5";
my $range = (Net::CIDR::cidr2range( $cidr ))[0] or next;
$spots_left -= $self->AddIP(

In this case where would this modified RTIR_FindIP.pm go and properly
supersede the original? /opt/rt4/local/lib or
/opt/rt4/local/plugins/RT-IR/local/lib?On 28 May 2013 13:49, Kevin Falcone falcone@bestpractical.com wrote:

On Fri, May 24, 2013 at 02:11:58PM -0700, Landon wrote:

I’m wondering if this is the best way to stop RTIR from detecting
CIDR ranges. I’ve been
looking into
/opt/rt4/local/plugins/RT-IR/lib/RT/Action/RTIR_FindIP.pm and modified the
following section:
elsif ( $4 && defined $5 ) { # IPv4/mask
next; # Do not add IPv4 ranges to tickets
my $cidr = join( ‘.’, map $_||0, (split /./, $4)[0…3] ) ."/$5";
my $range = (Net::CIDR::cidr2range( $cidr ))[0] or next;
$spots_left -= $self->AddIP(
IP => $range, CustomField => $cf, Skip => %existing
);
}
Is this the best way? Or is there something else I should have done
instead?

It’s almost impossible for me to parse your changes since the
whitespace has been completely lost.

Can you instead post a unified diff (diff -u) of your change?

Also, if you’re going to change RT/extension code, you should be using
local/lib instead of hacking in place. Otherwise upgrading will be…
fun.

-kevin


Rtir mailing list
Rtir@lists.bestpractical.com
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rtir

Landon Stewart :: lstewart@iweb.com
Lead Specialist, Abuse and Security Management
Spécialiste principal, gestion des abus et sécurité
http://iweb.com :: +1 (888) 909-4932